public MainWindow() { InitializeComponent(); timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(1); timer.Tick += new EventHandler(timer_Tick); tick = new timerTick(changeStatus); hotKeyControl1.HotKeyIsSet += (s, e) => { if (MyHotKeyManager.HotKeyExists(e.Shortcut, HotKeyManager.CheckKey.LocalHotKey)) { e.Cancel = true; MessageBox.Show("This HotKey has already been registered"); } }; hotKeyControl2.HotKeyIsSet += (o, ex) => { if (MyHotKeyManager.HotKeyExists(ex.Shortcut, HotKeyManager.CheckKey.LocalHotKey)) { ex.Cancel = true; MessageBox.Show("This HotKey has already been registered"); } }; }
private void HotKeyIsSet(object sender, HotKeyIsSetEventArgs e) { if (hotKeyManager.HotKeyExists(e.Shortcut, HotKeyManager.CheckKey.LocalHotKey) || CheckHotKeyExist()) { e.Cancel = true; MaterialSkin.MsgBox.Show(Properties.Resources.StrShortcutExist, Properties.Resources.StrWaring, MaterialSkin.MsgBox.Buttons.OK, MaterialSkin.MsgBox.Icon.Warning); } }