diff --git a/Editor.Desktop/Editor.Desktop.csproj b/Editor.Desktop/Editor.Desktop.csproj index a1fa566..b3e4f37 100644 --- a/Editor.Desktop/Editor.Desktop.csproj +++ b/Editor.Desktop/Editor.Desktop.csproj @@ -25,8 +25,8 @@ - - + + diff --git a/Editor/App.axaml b/Editor/App.axaml index 1db7995..fe2e90b 100644 --- a/Editor/App.axaml +++ b/Editor/App.axaml @@ -1,8 +1,7 @@ + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> @@ -12,11 +11,13 @@ + + + Segoe Fluent Icons, Segoe MDL2 Assets - - + \ No newline at end of file diff --git a/Editor/Controls/EditorControl.axaml.cs b/Editor/Controls/EditorControl.axaml.cs index efa9347..d55757e 100644 --- a/Editor/Controls/EditorControl.axaml.cs +++ b/Editor/Controls/EditorControl.axaml.cs @@ -6,7 +6,6 @@ using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Media; -using FluentAvalonia.UI.Controls; using ICSharpCode.SharpZipLib.Core; using ICSharpCode.SharpZipLib.Zip; using ElapsedEventArgs = System.Timers.ElapsedEventArgs; @@ -206,7 +205,7 @@ private void EditorControl_PointerRightButtonPressed(object? sender, PointerPres { Focus(); - // Build context menu using FluentAvalonia MenuFlyout to reliably show at pointer + // Build context menu using native Avalonia MenuFlyout to reliably show at pointer var menu = new MenuFlyout(); var hasSelection = _mainWindow.IsSelecting == true; @@ -217,9 +216,9 @@ void AddMenuItem(string header, string glyph, bool isEnabled, Action action) var mi = new MenuItem { Header = header, - Icon = new FontIcon + Icon = new TextBlock { - Glyph = glyph, + Text = glyph, FontFamily = (FontFamily)Application.Current!.FindResource("SymbolThemeFontFamily")! }, IsEnabled = isEnabled diff --git a/Editor/Editor.csproj b/Editor/Editor.csproj index 7b21061..d9a57cb 100644 --- a/Editor/Editor.csproj +++ b/Editor/Editor.csproj @@ -24,7 +24,7 @@ - + diff --git a/Editor/Helper/ContentDialogHelper.cs b/Editor/Helper/ContentDialogHelper.cs index af2eb40..ce284e3 100644 --- a/Editor/Helper/ContentDialogHelper.cs +++ b/Editor/Helper/ContentDialogHelper.cs @@ -1,8 +1,6 @@ using System; using System.Threading.Tasks; using Avalonia.Controls; -using Avalonia.Media; -using FluentAvalonia.UI.Controls; namespace Editor; @@ -10,7 +8,7 @@ public static class ContentDialogHelper { public static async Task ShowAsync(IMainWindow owner, string messageBoxText, string caption, MessageBoxButton button) { - if (owner is not Window windowOwner) + if (owner is not Window) { throw new InvalidOperationException("Owner must be a Window."); } @@ -19,67 +17,10 @@ public static async Task ShowAsync(IMainWindow owner, string m throw new InvalidOperationException("Owner must implement IContentDialogOwner."); } - var dialog = new ContentDialog - { - Title = caption - }; - switch (button) - { - case MessageBoxButton.OK: - dialog.PrimaryButtonText = Localize.Ok(); - break; - case MessageBoxButton.YesNo: - dialog.PrimaryButtonText = Localize.Yes(); - dialog.SecondaryButtonText = Localize.No(); - break; - case MessageBoxButton.OKCancel: - dialog.PrimaryButtonText = Localize.Ok(); - dialog.SecondaryButtonText = Localize.Cancel(); - break; - case MessageBoxButton.YesNoCancel: - dialog.PrimaryButtonText = Localize.Yes(); - dialog.SecondaryButtonText = Localize.No(); - dialog.CloseButtonText = Localize.Cancel(); - break; - } - dialog.DefaultButton = ContentDialogButton.Primary; - dialog.Content = new TextBlock - { - Text = messageBoxText, - TextWrapping = TextWrapping.Wrap - }; - contentDialogOwner.ContentDialogChanged(true); try { - var result = await dialog.ShowAsync(windowOwner); - return button switch - { - MessageBoxButton.OK => result switch - { - ContentDialogResult.Primary => MessageBoxResult.OK, - _ => MessageBoxResult.None - }, - MessageBoxButton.YesNo => result switch - { - ContentDialogResult.Primary => MessageBoxResult.Yes, - ContentDialogResult.Secondary => MessageBoxResult.No, - _ => MessageBoxResult.None - }, - MessageBoxButton.OKCancel => result switch - { - ContentDialogResult.Primary => MessageBoxResult.OK, - ContentDialogResult.Secondary => MessageBoxResult.Cancel, - _ => MessageBoxResult.None - }, - MessageBoxButton.YesNoCancel => result switch - { - ContentDialogResult.Primary => MessageBoxResult.Yes, - ContentDialogResult.Secondary => MessageBoxResult.No, - _ => MessageBoxResult.Cancel - }, - _ => MessageBoxResult.None, - }; + return await MessageBox.ShowAsync(messageBoxText, caption, button); } finally { diff --git a/Editor/Views/MainWindow.axaml b/Editor/Views/MainWindow.axaml index 37937ea..15067d6 100644 --- a/Editor/Views/MainWindow.axaml +++ b/Editor/Views/MainWindow.axaml @@ -4,7 +4,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Editor" - xmlns:ui="using:FluentAvalonia.UI.Controls" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:trace="clr-namespace:System.Diagnostics;assembly=WindowsBase" xmlns:toolbar="clr-namespace:Avalonia.Controls.ToolBar.Controls;assembly=Avalonia.Controls.ToolBar" @@ -63,11 +63,11 @@ Command="{Binding ToggleFullScreenModeCommand, Mode=OneTime}" ToolTip.Tip="{DynamicResource MainWindow_ExitFullScreen}" IsVisible="{Binding FullScreenButtonVisible, Mode=OneWay}"> - + Text="" />