feat(ui): complete Avalonia UI port with 7 main pages, tool settings & top MenuBar

This commit is contained in:
Richard
2026-08-10 10:48:34 +02:00
parent a0e18d2a57
commit b5bf97ae74
187 changed files with 20054 additions and 882 deletions
@@ -0,0 +1,56 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Platform.Storage;
using ClawdDotNet.Desktop.ViewModels;
namespace ClawdDotNet.Desktop.Views;
public partial class BackupPageView : UserControl
{
public BackupPageView()
{
InitializeComponent();
}
protected override void OnDataContextChanged(EventArgs e)
{
base.OnDataContextChanged(e);
if (DataContext is BackupPageViewModel vm)
{
vm.RequestRestoreDialog += OnRequestRestoreDialog;
}
}
private async Task<RestoreResultData?> OnRequestRestoreDialog(RestoreBackupViewModel vm)
{
var topLevel = TopLevel.GetTopLevel(this);
if (topLevel is Window window)
{
var dialog = new RestoreBackupWindow { DataContext = vm };
await dialog.ShowDialog(window);
return vm.Result;
}
return null;
}
private async void OnBrowseTargetFolder(object? sender, RoutedEventArgs e)
{
if (DataContext is not BackupPageViewModel vm) return;
var topLevel = TopLevel.GetTopLevel(this);
if (topLevel?.StorageProvider is null) return;
var folders = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{
Title = "Zielordner für Sicherungen wählen",
AllowMultiple = false
});
if (folders.Count > 0 && folders[0].TryGetLocalPath() is { } path)
{
vm.TargetFolder = path;
vm.SaveSettings();
vm.RefreshBackupListCommand.Execute(null);
}
}
}