添加项目文件。
This commit is contained in:
43
Views/MainWindow.xaml.cs
Normal file
43
Views/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using AciTester.ViewModels;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace AciTester.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.Loaded += (s, e) =>
|
||||
{
|
||||
var keyGesture = new KeyGesture(Key.P, ModifierKeys.Control);
|
||||
var inputBinding = new InputBinding(
|
||||
new RelayCommand(OpenConfigWindow),
|
||||
keyGesture);
|
||||
this.InputBindings.Add(inputBinding);
|
||||
};
|
||||
}
|
||||
|
||||
private void OpenConfigWindow()
|
||||
{
|
||||
var vm = (MainViewModel)this.DataContext;
|
||||
var configVm = new ConfigViewModel(vm._plcService, vm._config, vm.Calibration);
|
||||
var win = new ConfigWindow { DataContext = configVm, Owner = this };
|
||||
win.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user