private void KeyPressed(Key key, int virtualKey) { if (key == Key.CapsLock || key == Key.Capital) { var islock = !Keyboard.IsKeyToggled(Key.CapsLock); Prepare(LockKeys.CapsLock, islock); ShowFlyout(); } else if (key == Key.NumLock) { var islock = !Keyboard.IsKeyToggled(Key.NumLock); Prepare(LockKeys.NumLock, islock); ShowFlyout(); } else if (key == Key.Scroll) { var islock = !Keyboard.IsKeyToggled(Key.Scroll); Prepare(LockKeys.ScrollLock, islock); ShowFlyout(); } else if (key == Key.Insert) { var islock = !Keyboard.IsKeyToggled(Key.Insert); Prepare(LockKeys.Insert, islock); ShowFlyout(); } void ShowFlyout() { ShowFlyoutRequested?.Invoke(this); } }
public void OnExternalUpdated(bool isMediaKey) { if ((!isMediaKey && device != null) || (isMediaKey && _SMTCAvail)) { ShowFlyoutRequested?.Invoke(this); } }
private void AirplaneModeWatcher_Changed(object sender, AirplaneModeChangedEventArgs e) { Dispatcher.Invoke(() => { Prepare(e); ShowFlyoutRequested?.Invoke(this); }); }
private bool _isInCodeValueChange = false; //Prevents a LOOP between changing brightness private void UpdateBrightness(int brightness) { brightnessControl.Dispatcher.Invoke(() => { UpdateBrightnessGlyph(brightness); _isInCodeValueChange = true; brightnessControl.BrightnessSlider.Value = brightness; _isInCodeValueChange = false; brightnessControl.textVal.Text = brightness.ToString("00"); ShowFlyoutRequested?.Invoke(this); }); }
private void KeyPressed(Key Key, int virtualKey) { if (Key == Key.VolumeUp || Key == Key.VolumeDown || Key == Key.VolumeMute) { ShowFlyout(); } if ((Key == Key.MediaNextTrack || Key == Key.MediaPreviousTrack || Key == Key.MediaPlayPause || Key == Key.MediaStop) && SMTCAvail()) { ShowFlyout(); } void ShowFlyout() { ShowFlyoutRequested?.Invoke(this); } bool SMTCAvail() { return(SessionsStackPanel.Children.Count > 0); } }
private void KeyPressed(Key key, int virtualKey) { LockKeys?lockKey = key switch { Key.CapsLock => LockKeys.CapsLock, Key.NumLock => LockKeys.NumLock, Key.Scroll => LockKeys.ScrollLock, Key.Insert => LockKeys.Insert, _ => null }; if (lockKey.HasValue) { Prepare(lockKey.Value, !Keyboard.IsKeyToggled(key)); ShowFlyout(); } void ShowFlyout() { ShowFlyoutRequested?.Invoke(this); } }
//This is if it was "updated" using other methods (e.g. Shellhook) public void OnExternalUpdated() => ShowFlyoutRequested?.Invoke(this);