feat: add gui shell with theme, i18n and error pages

This commit is contained in:
yyc12345 committed 2026-10-03 11:22:39 +08:00
1 parent 22a0f61cb5
commit f36561cb7f
33 files changed
+1333 -26

No files matched your search

+42 -1
View File
@@ -1,11 +1,52 @@
using Avalonia.Controls;
using YKanBan.ViewModels;
using YKanBan.ViewModels.Dialogs;
using YKanBan.Views.Dialogs;
namespace YKanBan.Views;
public partial class MainWindow : Window
{
private bool _interactionsRegistered;
public MainWindow()
{
InitializeComponent();
}
}
protected override void OnDataContextChanged(EventArgs e)
{
base.OnDataContextChanged(e);
if (DataContext is MainWindowViewModel viewModel && !_interactionsRegistered)
{
_interactionsRegistered = true;
viewModel.ShowSettings.RegisterHandler(ShowSettingsAsync);
viewModel.ShowAbout.RegisterHandler(ShowAboutAsync);
}
}
/// <summary>Shows the settings dialog centered on this window.</summary>
private async Task ShowSettingsAsync(Unit input)
{
if (App.Services is null)
{
return;
}
var dialog = new SettingsDialog
{
DataContext = new SettingsDialogViewModel(App.Services.Config, App.StartupLanguage),
};
await dialog.ShowDialog(this);
}
/// <summary>Shows the about dialog centered on this window.</summary>
private async Task ShowAboutAsync(Unit input)
{
var dialog = new AboutDialog
{
DataContext = new AboutDialogViewModel(),
};
await dialog.ShowDialog(this);
}
}