Skip to content
This repository was archived by the owner on Apr 10, 2026. It is now read-only.
Draft
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
4 changes: 2 additions & 2 deletions Editor.Desktop/Editor.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="12.0.0" />
<PackageReference Include="Avalonia.Desktop" Version="12.0.0" />
<PackageReference Include="Avalonia" Version="11.3.13" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.13" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.13" />
</ItemGroup>

Expand Down
9 changes: 5 additions & 4 deletions Editor/App.axaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Application
x:Class="Editor.App"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sty="using:FluentAvalonia.Styling">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand All @@ -12,11 +11,13 @@
<!-- These are not part of MergedDictionaries so we can add or remove them easier -->
<!-- So we put language resources here so that we can switch them at runtime -->
<ResourceInclude x:Key="zh-cn" Source="/Languages/zh-cn.axaml" />

<!-- Symbol icon font family (was previously provided by FluentAvaloniaUI) -->
<FontFamily x:Key="SymbolThemeFontFamily">Segoe Fluent Icons, Segoe MDL2 Assets</FontFamily>
</ResourceDictionary>
</Application.Resources>

<Application.Styles>
<!-- FluentAvalonia Settings -->
<sty:FluentAvaloniaTheme PreferSystemTheme="True" PreferUserAccentColor="True" />
<FluentTheme />
</Application.Styles>
</Application>
7 changes: 3 additions & 4 deletions Editor/Controls/EditorControl.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Editor/Editor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.13" />
<PackageReference Include="Clowd.Clipboard.Avalonia" Version="1.1.4" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
<PackageReference Include="FluentAvaloniaUI" Version="2.5.1" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.13" />
<PackageReference Include="MessageBox.Avalonia" Version="3.3.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.5" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.5" />
Expand Down
63 changes: 2 additions & 61 deletions Editor/Helper/ContentDialogHelper.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
using System;
using System.Threading.Tasks;
using Avalonia.Controls;
using Avalonia.Media;
using FluentAvalonia.UI.Controls;

namespace Editor;

public static class ContentDialogHelper
{
public static async Task<MessageBoxResult> 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.");
}
Expand All @@ -19,67 +17,10 @@ public static async Task<MessageBoxResult> 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
{
Expand Down
10 changes: 5 additions & 5 deletions Editor/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -63,11 +63,11 @@
Command="{Binding ToggleFullScreenModeCommand, Mode=OneTime}"
ToolTip.Tip="{DynamicResource MainWindow_ExitFullScreen}"
IsVisible="{Binding FullScreenButtonVisible, Mode=OneWay}">
<ui:FontIcon
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
Glyph="&#xE73F;" />
Text="&#xE73F;" />
</Button>
<Button
Width="44"
Expand All @@ -77,11 +77,11 @@
Command="{Binding CloseCommand, Mode=OneTime}"
ToolTip.Tip="{DynamicResource Close}"
IsVisible="{Binding FullScreenButtonVisible, Mode=OneWay}">
<ui:FontIcon
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
Glyph="&#xE711;" />
Text="&#xE711;" />
</Button>
</StackPanel>

Expand Down
Loading