Кнопка настроек теперь в верхнем левом углу

This commit is contained in:
Chernykh Aleksandr
2025-11-07 16:48:40 +03:00
parent 0d960bec31
commit f9ff8f05a5

View File

@@ -1,17 +1,22 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using KeyKeeper.Views;
using Avalonia.Controls;
namespace KeyKeeper.ViewModels;
public partial class MainWindowViewModel : ViewModelBase
{
public string Greeting { get; } = "Welcome to Avalonia!";
[RelayCommand]
private void OpenSettings()
private async void OpenSettings()
{
var settingsWindow = new SettingsWindow();
settingsWindow.Show();
await settingsWindow.ShowDialog(GetMainWindow());
}
private static Window? GetMainWindow()
{
return App.Current?.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktop
? desktop.MainWindow
: null;
}
}