protected override void OnGotFocus(RoutedEventArgs e) { base.OnGotFocus(e); if (e.OriginalSource == this) { FilterBox.Focus(); } }
private void ModelSystemsDisplay_Loaded(object sender, RoutedEventArgs e) { // This needs to be executed via the dispatcher to avoid an issue with AvalonDock Dispatcher.BeginInvoke(new Action(() => { FilterBox.Focus(); })); }
private void LuaFunctionList_Load(object sender, EventArgs e) { _functionList = _docs .OrderBy(l => l.Library) .ThenBy(l => l.Name) .ToList(); UpdateList(); FilterBox.Focus(); ToWikiMarkupButton.Visible = VersionInfo.DeveloperBuild; }
private void LuaFunctionList_Load(object sender, EventArgs e) { FunctionList = GlobalWin.Tools.LuaConsole.LuaImp.Docs .OrderBy(x => x.Library) .ThenBy(x => x.Name) .ToList(); UpdateList(); FilterBox.Focus(); ToWikiMarkupButton.Visible = VersionInfo.DeveloperBuild; }
private void OnLoaded(object sender, RoutedEventArgs routedEventArgs) { AppModel model = (AppModel)((Page)sender).DataContext; if (model.Servers != null && model.Servers.Any()) { FilterBox.Focus(); } else { AddServerBorder.Width = 200; AddServerBox.Focus(); } }
private void FilterButton_Click(object sender, EventArgs e) { FilterBox.Text = ""; FilterBox.Focus(); }
private void LoadWindow(object sender, RoutedEventArgs e) { PredefinedColors = MainWindow.GetColors(); // Holt die Farben aus der Config FilterBox.Focus(); }
protected override void OnGotFocus(RoutedEventArgs e) { base.OnGotFocus(e); FilterBox.Focus(); }
protected override void OnActivated(EventArgs e) { base.OnActivated(e); FilterBox.Focus(); }
private void ClearButtonClicked(object sender, RoutedEventArgs e) { _data.FilterString = string.Empty; FilterBox.Focus(); }
// This is where I set up keyboard accelerators and do some ridiculous hacks // to get keyboard control+focus working the way I want it. // Space should ALWAYS toggle playback, unless the search box has focus. // Escape should clear+exit the search box. // Enter should start playing a file when in the file view #region KeyboardStuff private void SetUpKeyboardAccelerators() { KeyboardAccelerator CreateAccelerator(VirtualKeyModifiers modifier, VirtualKey key, TypedEventHandler <KeyboardAccelerator, KeyboardAcceleratorInvokedEventArgs> eventHandler) { KeyboardAccelerator ret = new KeyboardAccelerator() { Modifiers = modifier, Key = key }; ret.Invoked += eventHandler; return(ret); } //pull KeyboardAccelerator pullAccelerator = CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.P, async(sender, args) => { args.Handled = true; await ViewModel.PullEventsCommand.ExecuteAsync(null); }); KeyboardAccelerators.Add(pullAccelerator); //push KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control | VirtualKeyModifiers.Shift, VirtualKey.P, async(sender, args) => { args.Handled = true; await ViewModel.PushEventsCommand.ExecuteAsync(null); })); //search accelerator KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.F, (sender, args) => { args.Handled = true; FilterBox.Focus(FocusState.Keyboard); FilterBox.SelectAll(); })); //open local folder KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.E, async(sender, args) => { args.Handled = true; await Launcher.LaunchFolderAsync(Windows.Storage.ApplicationData.Current.LocalFolder); })); //open music folder KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.M, async(sender, args) => { args.Handled = true; await ViewModel.OpenLibraryFolder(); })); //open library DB KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.D, async(sender, args) => { args.Handled = true; Windows.Storage.StorageFile dbFile = await FileHelper.GetLibraryDbFileAsync(); await Launcher.LaunchFileAsync(dbFile); })); //show selected item(s) in File Explorer KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.L, async(sender, args) => { args.Handled = true; LibraryItem selected = (LibraryItem)libraryDataGrid.SelectedItem; await ViewModel.ShowItemInExplorer(selected); })); //show item info KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.I, async(sender, args) => { args.Handled = true; LibraryItem selected = libraryDataGrid.SelectedItem as LibraryItem; if (selected != null) { LibraryItemInfo dialog = new LibraryItemInfo(selected); await dialog.ShowAsync(); } })); //play a random bookmark KeyboardAccelerators.Add(CreateAccelerator(VirtualKeyModifiers.Control, VirtualKey.R, async(sender, args) => { args.Handled = true; await ViewModel.PlayRandomBookmark(); })); }
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnKeyDown(KeyEventArgs e) { base.OnKeyDown(e); if (e.Handled == false) { if (EditorController.IsShiftDown() && EditorController.IsControlDown()) { switch (e.Key) { case Key.F: if (QuickParameterDisplay2.IsEnabled) { QuickParameterDialogHost.IsOpen = true; } else if (ModuleParameterDisplay.IsEnabled) { ModuleParameterDialogHost.IsOpen = true; } break; } } if (EditorController.IsControlDown()) { switch (e.Key) { case Key.M: if (EditorController.IsAltDown()) { //SetMetaModuleStateForSelected(false); } else if (EditorController.IsShiftDown()) { //SetMetaModuleStateForSelected(true); } else { SelectReplacement(); } e.Handled = true; break; case Key.R: //ParameterTabControl.SelectedIndex = 2; //Mo.Focus(); // Keyboard.Focus(ParameterFilterBox); e.Handled = true; break; case Key.P: //ParameterTabControl.SelectedIndex = 1; //ModuleParameterTab.Focus(); ModuleParameterDisplay.Focus(); Keyboard.Focus(ParameterFilterBox); e.Handled = true; break; case Key.E: FilterBox.Focus(); e.Handled = true; break; case Key.W: Close(); e.Handled = true; break; case Key.L: ShowLinkedParameterDialog(true); e.Handled = true; break; case Key.N: CopyParameterName(); e.Handled = true; break; case Key.O: OpenParameterFileLocation(false, false); e.Handled = true; break; case Key.F: SelectFileForCurrentParameter(); e.Handled = true; break; case Key.D: if (ModuleParameterDisplay.IsKeyboardFocusWithin || QuickParameterDisplay2.IsKeyboardFocusWithin) { SelectDirectoryForCurrentParameter(); } e.Handled = true; break; case Key.Z: Undo(); e.Handled = true; break; case Key.Y: Redo(); e.Handled = true; break; case Key.C: CopyCurrentModule(); e.Handled = true; break; case Key.V: PasteCurrentModule(); e.Handled = true; break; case Key.Q: if (EditorController.IsShiftDown()) { ToggleQuickParameterDisplay(); e.Handled = true; } else { ToggleQuickParameterDisplaySearch(); e.Handled = true; break; } break; } } else { switch (e.Key) { case Key.F2: if (EditorController.IsShiftDown()) { RenameDescription(); } else { RenameParameter(); } break; case Key.F1: ShowDocumentation(); e.Handled = true; break; case Key.Delete: if ((ModelSystemDisplayContent.Content as UserControl).IsKeyboardFocusWithin) { RemoveSelectedModules(); e.Handled = true; } break; case Key.F5: e.Handled = true; SaveCurrentlySelectedParameters(); ExecuteRun(); break; case Key.Escape: FilterBox.Box.Text = string.Empty; break; } } } }
private void SelectAuthorWindow_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { ViewModel.GetAuthors(); ViewModel.Filter = string.Empty; FilterBox.Focus(); }