using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Elfisa.Avalonia.ViewModels;

namespace Elfisa.Avalonia.Views;

public partial class ShellView : UserControl
{
    public ShellView() => AvaloniaXamlLoader.Load(this);

    private async void OnSettingsClick(object? sender, RoutedEventArgs e)
    {
        var win = new SettingsWindow { DataContext = new SettingsViewModel() };
        var owner = (Application.Current?.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.MainWindow;
        if (owner is not null) await win.ShowDialog(owner);
        else win.Show();
    }
}
