Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert collection expression. #493

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Ursa/Common/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Ursa.Common;

internal static class Constants
{
public static readonly char[] SpaceSeparator = [' '];
}
5 changes: 3 additions & 2 deletions src/Ursa/Controls/Dialog/Dialog.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Ursa.Common;

namespace Ursa.Controls;

Expand Down Expand Up @@ -216,7 +217,7 @@ private static void ConfigureDialogWindow(DialogWindow window, DialogOptions? op
}
if (!string.IsNullOrWhiteSpace(options.StyleClass))
{
var styles = options.StyleClass!.Split([' '], StringSplitOptions.RemoveEmptyEntries);
var styles = options.StyleClass!.Split(Constants.SpaceSeparator, StringSplitOptions.RemoveEmptyEntries);
window.Classes.AddRange(styles);
}
}
Expand Down Expand Up @@ -247,7 +248,7 @@ private static void ConfigureDefaultDialogWindow(DefaultDialogWindow window, Dia
}
if (!string.IsNullOrWhiteSpace(options.StyleClass))
{
var styles = options.StyleClass!.Split([' '], StringSplitOptions.RemoveEmptyEntries);
var styles = options.StyleClass!.Split(Constants.SpaceSeparator, StringSplitOptions.RemoveEmptyEntries);
window.Classes.AddRange(styles);
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/Ursa/Controls/Dialog/OverlayDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Layout;
using Ursa.Common;

namespace Ursa.Controls;

Expand Down Expand Up @@ -207,7 +208,7 @@ private static void ConfigureCustomDialogControl(CustomDialogControl control, Ov
control.CanResize = options.CanResize;
if (!string.IsNullOrWhiteSpace(options.StyleClass))
{
var styles = options.StyleClass!.Split([' '], StringSplitOptions.RemoveEmptyEntries);
var styles = options.StyleClass!.Split(Constants.SpaceSeparator, StringSplitOptions.RemoveEmptyEntries);
control.Classes.AddRange(styles);
}
DialogControlBase.SetCanDragMove(control, options.CanDragMove);
Expand Down Expand Up @@ -238,7 +239,7 @@ private static void ConfigureDefaultDialogControl(DefaultDialogControl control,
control.CanResize = options.CanResize;
if (!string.IsNullOrWhiteSpace(options.StyleClass))
{
var styles = options.StyleClass!.Split([' '], StringSplitOptions.RemoveEmptyEntries);
var styles = options.StyleClass!.Split(Constants.SpaceSeparator, StringSplitOptions.RemoveEmptyEntries);
control.Classes.AddRange(styles);
}
DialogControlBase.SetCanDragMove(control, options.CanDragMove);
Expand Down
5 changes: 3 additions & 2 deletions src/Ursa/Controls/Drawer/Drawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Avalonia.Input;
using Ursa.Common;
using Ursa.Controls.Options;
// ReSharper disable RedundantExplicitArrayCreation

namespace Ursa.Controls;

Expand Down Expand Up @@ -220,7 +221,7 @@ private static void ConfigureCustomDrawer(CustomDrawerControl drawer, DrawerOpti

if (!string.IsNullOrWhiteSpace(options.StyleClass))
{
var styles = options.StyleClass!.Split([' '], StringSplitOptions.RemoveEmptyEntries);
var styles = options.StyleClass!.Split(Constants.SpaceSeparator, StringSplitOptions.RemoveEmptyEntries);
drawer.Classes.AddRange(styles);
}
}
Expand All @@ -247,7 +248,7 @@ private static void ConfigureDefaultDrawer(DefaultDrawerControl drawer, DrawerOp
}
if (!string.IsNullOrWhiteSpace(options.StyleClass))
{
var styles = options.StyleClass!.Split([' '], StringSplitOptions.RemoveEmptyEntries);
var styles = options.StyleClass!.Split(Constants.SpaceSeparator, StringSplitOptions.RemoveEmptyEntries);
drawer.Classes.AddRange(styles);
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/Ursa/Controls/MessageBox/MessageBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Input;
using Ursa.Common;

namespace Ursa.Controls;

Expand All @@ -22,7 +23,7 @@ public static async Task<MessageBoxResult> ShowAsync(
};
if (!string.IsNullOrWhiteSpace(styleClass))
{
var styles = styleClass!.Split([' '], StringSplitOptions.RemoveEmptyEntries);
var styles = styleClass!.Split(Constants.SpaceSeparator, StringSplitOptions.RemoveEmptyEntries);
messageWindow.Classes.AddRange(styles);
}
var lifetime = Application.Current?.ApplicationLifetime;
Expand Down Expand Up @@ -54,7 +55,7 @@ public static async Task<MessageBoxResult> ShowAsync(
};
if (!string.IsNullOrWhiteSpace(styleClass))
{
var styles = styleClass!.Split([' '], StringSplitOptions.RemoveEmptyEntries);
var styles = styleClass!.Split(Constants.SpaceSeparator, StringSplitOptions.RemoveEmptyEntries);
messageWindow.Classes.AddRange(styles!);
}
var result = await messageWindow.ShowDialog<MessageBoxResult>(owner);
Expand Down Expand Up @@ -82,7 +83,7 @@ public static async Task<MessageBoxResult> ShowOverlayAsync(
};
if (!string.IsNullOrWhiteSpace(styleClass))
{
var styles = styleClass!.Split([' '], StringSplitOptions.RemoveEmptyEntries);
var styles = styleClass!.Split(Constants.SpaceSeparator, StringSplitOptions.RemoveEmptyEntries);
messageControl.Classes.AddRange(styles!);
}
host.AddModalDialog(messageControl);
Expand Down