public MainWindow() { WindowStartupLocation = WindowStartupLocation.CenterScreen; InitializeComponent(); mListHotkey = TbHotkey.GetAll(); mListHideWin = TbHideWin.GetAll(); }
private void SaveHotKey(IWindowEntry win, Key key) { if (win.hotKey != (int)key) { win.hotKey = (int)key; TbHotkey.updateHotkey(win, string.IsNullOrEmpty(win.ExecutablePath) ? false : true); mCallback(); } }
private void OnHotkeyUpdateEvent() { mListHotkey = TbHotkey.GetAll(); // 把key更新 foreach (var win in mWins.Windows) { SetHotkey(win); } }
private void Button_SetExePath_Click(object sender, RoutedEventArgs e) { var dialog = new Microsoft.Win32.OpenFileDialog(); var tag = (sender as Button).DataContext as TbHotKeyEntity; dialog.Filter = "exe file | *.exe"; dialog.Title = "设置" + tag.name + "路径"; dialog.InitialDirectory = tag.executablePath; if (dialog.ShowDialog() == true) { tag.executablePath = dialog.FileName; TbHotkey.updateHotkey(tag, true); RefreshData(); mCallback(); } }
private void Button_Del_Click(object sender, RoutedEventArgs e) { TbHotkey.Del((sender as Button).DataContext as TbHotKeyEntity); RefreshData(); mCallback(); }
private void RefreshData() { dataGrid1.ItemsSource = TbHotkey.GetAll(); }
private void SetHotkeyButton_Click(object sender, RoutedEventArgs e) { TbHotkey.Focusable = true; TbHotkey.Focus(); SetHotkeyButton.Content = ResourceProvider.GetString("LOCPlayState_SettingPressHotkeyPromtButtonLabel"); }