mirror of
https://github.com/KeyKeeperApp/KeyKeeper.git
synced 2026-04-22 23:46:29 +03:00
23 lines
732 B
C#
23 lines
732 B
C#
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 async void OpenSettings()
|
|
{
|
|
var settingsWindow = new SettingsWindow();
|
|
await settingsWindow.ShowDialog(GetMainWindow());
|
|
}
|
|
private static Window? GetMainWindow()
|
|
{
|
|
return App.Current?.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktop
|
|
? desktop.MainWindow
|
|
: null;
|
|
}
|
|
}
|