From 8c8f5c18b1a58e16b2e548412b270f938de4ed90 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Apr 2026 08:27:03 +0000 Subject: [PATCH 1/3] Remove FluentAvaloniaUI package and replace with native Avalonia controls Agent-Logs-Url: https://github.com/Jack251970/Math-Editor/sessions/51fda940-c030-43e4-addb-50c8fc40a2fb Co-authored-by: Jack251970 <53996452+Jack251970@users.noreply.github.com> --- Editor/App.axaml | 9 ++-- Editor/Controls/EditorControl.axaml.cs | 7 ++- Editor/Editor.csproj | 2 +- Editor/Helper/ContentDialogHelper.cs | 63 +------------------------- Editor/Views/MainWindow.axaml | 14 +++--- 5 files changed, 18 insertions(+), 77 deletions(-) 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..f3d0d11 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}"> - + FontFamily="{StaticResource SymbolThemeFontFamily}" + Text="" /> From c5f2271d6543d52f2fb361f8da2e9f2c52cb66b8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Apr 2026 08:29:39 +0000 Subject: [PATCH 2/3] Use DynamicResource for SymbolThemeFontFamily in MainWindow.axaml Agent-Logs-Url: https://github.com/Jack251970/Math-Editor/sessions/51fda940-c030-43e4-addb-50c8fc40a2fb Co-authored-by: Jack251970 <53996452+Jack251970@users.noreply.github.com> --- Editor/Views/MainWindow.axaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Editor/Views/MainWindow.axaml b/Editor/Views/MainWindow.axaml index f3d0d11..15067d6 100644 --- a/Editor/Views/MainWindow.axaml +++ b/Editor/Views/MainWindow.axaml @@ -66,7 +66,7 @@ From a9409ee7092a5bf5720188ea33617ed8f501fd4e Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 10 Apr 2026 16:37:57 +0800 Subject: [PATCH 3/3] Downgrade Avalonia packages to version 11.3.13 The Avalonia and Avalonia.Desktop package references in Editor.Desktop.csproj were downgraded from 12.0.0 to 11.3.13 to ensure compatibility with other dependencies. --- Editor.Desktop/Editor.Desktop.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 @@ - - + +