private void AltTabPressed(object sender, AltTabHookEventArgs e) { if (!Settings.Default.AltTabHook) { // Ignore Alt+Tab presses if the hook is not activated by the user return; } _foregroundWindow = SystemWindow.ForegroundWindow; if (_foregroundWindow.ClassName == "MultitaskingViewFrame") { // If Windows' task switcher is on the screen then don't do anything return; } e.Handled = true; if (Visibility != Visibility.Visible) { tb.IsEnabled = true; ActivateAndFocusMainWindow(); Keyboard.Focus(tb); if (e.ShiftDown) { LoadData(InitialFocus.PreviousItem); } else { LoadData(InitialFocus.NextItem); } if (Settings.Default.AutoSwitch && !e.CtrlDown) { _altTabAutoSwitch = true; tb.IsEnabled = false; _searchEnabled = false; tb.Text = "Type to search (hold alt)"; } Opacity = 1; } else { if (e.ShiftDown) { PreviousItem(); } else { NextItem(); } } }
private AltTabHookEventArgs OnPressed(bool shiftDown) { var altTabHookEventArgs = new AltTabHookEventArgs { ShiftDown = shiftDown }; var handler = Pressed; if (handler != null) { handler(this, altTabHookEventArgs); } return(altTabHookEventArgs); }
private void AltTabPressed(object sender, AltTabHookEventArgs e) { if (!Settings.Default.AltTabHook) { // Ignore Alt+Tab presses if the hook is not activated by the user return; } e.Handled = true; if (Visibility != Visibility.Visible) { ActivateAndFocusMainWindow(); Keyboard.Focus(tb); LoadData(); if (e.ShiftDown) { lb.SelectedIndex = lb.Items.Count - 1; } else { lb.SelectedIndex = 1; } Opacity = 1; } else { if (e.ShiftDown) { PreviousItem(); } else { NextItem(); } } }
private void AltTabPressed(object sender, AltTabHookEventArgs e) { if (!Settings.Default.AltTabHook) { // Ignore Alt+Tab presses if the hook is not activated by the user return; } e.Handled = true; if (Visibility != Visibility.Visible) { _foregroundWindow = SystemWindow.ForegroundWindow; ActivateAndFocusMainWindow(); Keyboard.Focus(tb); if (e.ShiftDown) { LoadData(InitialFocus.PreviousItem); } else { LoadData(InitialFocus.NextItem); } Opacity = 1; } else { if (e.ShiftDown) { PreviousItem(); } else { NextItem(); } } }
private AltTabHookEventArgs OnPressed(bool shiftDown) { var altTabHookEventArgs = new AltTabHookEventArgs { ShiftDown = shiftDown }; var handler = Pressed; if (handler != null) { handler(this, altTabHookEventArgs); } return altTabHookEventArgs; }