using ASTM_D7896_Tester.Views;
using CommunityToolkit.Mvvm.Input;
using System.Windows;
using System.Windows.Input;

namespace ASTM_D7896_Tester.Views;

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
        // 注册快捷键
        KeyGesture keyGesture = new KeyGesture(Key.P, ModifierKeys.Control);
        var inputBinding = new InputBinding(OpenConfigCommand, keyGesture);
        this.InputBindings.Add(inputBinding);
    }

    private ICommand _openConfigCommand;
    public ICommand OpenConfigCommand => _openConfigCommand ??= new RelayCommand(OpenConfig);

    private void OpenConfig()
    {
        var configWindow = new ConfigWindow();
        configWindow.Owner = this;
        configWindow.ShowDialog();
    }
}