private void HotkeyTextBox_LosingFocus(object sender, RoutedEventArgs e) { if (lastValidSettings != null && (lastValidSettings.IsValid() || lastValidSettings.IsEmpty())) { HotkeySettings = lastValidSettings.Clone(); } HotkeyTextBox.Text = hotkeySettings.ToString(); if (AutomationPeer.ListenerExists(AutomationEvents.PropertyChanged)) { TextBoxAutomationPeer peer = FrameworkElementAutomationPeer.FromElement(HotkeyTextBox) as TextBoxAutomationPeer; string textBoxChangeActivityId = "textBoxChangedOnLosingFocus"; if (peer != null) { peer.RaiseNotificationEvent( AutomationNotificationKind.ActionCompleted, AutomationNotificationProcessing.ImportantMostRecent, HotkeyTextBox.Text, textBoxChangeActivityId); } } _isActive = false; }
private void HotkeyTextBox_LosingFocus(object sender, RoutedEventArgs e) { if (internalSettings.IsValid() || internalSettings.IsEmpty()) { HotkeySettings = internalSettings; } HotkeyTextBox.Text = hotkeySettings.ToString(); }
private void HotkeyTextBox_LosingFocus(object sender, RoutedEventArgs e) { if (lastValidSettings != null && (lastValidSettings.IsValid() || lastValidSettings.IsEmpty())) { HotkeySettings = lastValidSettings.Clone(); } HotkeyTextBox.Text = hotkeySettings.ToString(); _isActive = false; }
private async void Hotkey_KeyDown(int key) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { KeyEventHandler(key, true, key, Lib.Utilities.Helper.GetKeyName((uint)key)); if (internalSettings.Code > 0) { lastValidSettings = internalSettings.Clone(); HotkeyTextBox.Text = lastValidSettings.ToString(); } }); }
private async void Hotkey_KeyDown(int key) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { KeyEventHandler(key, true, key, Library.Utilities.Helper.GetKeyName((uint)key)); // Tab and Shift+Tab are accessible keys and should not be displayed in the hotkey control. if (internalSettings.Code > 0 && !internalSettings.IsAccessibleShortcut()) { HotkeyTextBox.Text = internalSettings.ToString(); lastValidSettings = internalSettings.Clone(); } }); }
private void HotkeyTextBox_KeyDown(object sender, KeyRoutedEventArgs e) { e.Handled = true; if ( e.Key == Windows.System.VirtualKey.LeftWindows || e.Key == Windows.System.VirtualKey.RightWindows || e.Key == Windows.System.VirtualKey.Control || e.Key == Windows.System.VirtualKey.Menu || e.Key == Windows.System.VirtualKey.Shift) { return; } if (e.Key == Windows.System.VirtualKey.Escape) { internalSettings = new HotkeySettings(); HotkeySettings = new HotkeySettings(); return; } var settings = new HotkeySettings(); // Display HotKey value if (IsDown(Windows.System.VirtualKey.LeftWindows) || IsDown(Windows.System.VirtualKey.RightWindows)) { settings.Win = true; } if (IsDown(Windows.System.VirtualKey.Control)) { settings.Ctrl = true; } if (IsDown(Windows.System.VirtualKey.Menu)) { settings.Alt = true; } if (IsDown(Windows.System.VirtualKey.Shift)) { settings.Shift = true; } settings.Key = Lib.Utilities.Helper.GetKeyName((uint)e.Key); settings.Code = (int)e.OriginalKey; internalSettings = settings; HotkeyTextBox.Text = internalSettings.ToString(); }