public QueryEditor() { Document.Language = DefaultLanguage; AreLineModificationMarksVisible = false; foreach (var key in InputBindings.Where(x => x.Key == Key.Enter && x.Modifiers == ModifierKeys.Control).ToList()) { InputBindings.Remove(key); } }
public QueryEditor() { IsSelectionMarginVisible = false; IsOutliningMarginVisible = true; AreLineModificationMarksVisible = false; foreach (var key in InputBindings.Where(x => x.Key == Key.Enter && x.Modifiers == ModifierKeys.Control).ToList()) { InputBindings.Remove(key); } }
private void BindMacro(InputGesture gesture, Action <PadEditor> action) { var oldBinding = InputBindings.OfType <InputBinding>().FirstOrDefault(i => i.Gesture.Equals(gesture)); if (oldBinding != null) { InputBindings.Remove(oldBinding); } InputBindings.Add( new InputBinding(EditingCommands.HandleKey, gesture) { CommandParameter = action }); }
IDisposable Bind(IImmutableList <Tuple <HotKey, System.Windows.Controls.MenuItem, ICommand> > bindings) { return(Disposable.Combine( bindings.Select( args => { var hotkey = args.Item1; var item = args.Item2; var command = args.Item3; var binding = new InputBinding(command, hotkey.ToWpfGesture()); item.InputGestureText = ((KeyGesture)binding.Gesture).DisplayString; InputBindings.Add(binding); return Disposable.Create(() => { InputBindings.Remove(binding); }); }))); }
private void OpenSettings(object sender, RoutedEventArgs e) { var modalWindow = new Settings { Owner = this }; modalWindow.ShowDialog(); var mainViewModel = (MainViewModel)DataContext; mainViewModel.AlwaysOverride = IOManager.ReadSetting("AlwaysOverride") == "True"; foreach (InputBinding metaShortcut in _metaShortcuts) { InputBindings.Remove(metaShortcut); } _metaShortcuts.Clear(); var viewModel = (MainViewModel)DataContext; var newMetaShortcut = SetGetMetaShortcut("Undo", "Ctrl+Z"); GetKeyModifier(newMetaShortcut.Split('+'), out var metaKey, out var metaModifier); _metaShortcuts.Add(AddBinding(viewModel.UndoCommand, metaKey, metaModifier)); newMetaShortcut = SetGetMetaShortcut("Delete", "Delete"); GetKeyModifier(newMetaShortcut.Split('+'), out metaKey, out metaModifier); _metaShortcuts.Add(AddBinding(viewModel.DeleteFileCommand, metaKey, metaModifier)); newMetaShortcut = SetGetMetaShortcut("Left", "Left"); GetKeyModifier(newMetaShortcut.Split('+'), out metaKey, out metaModifier); _metaShortcuts.Add(AddBinding(viewModel.PrevCommand, metaKey, metaModifier)); newMetaShortcut = SetGetMetaShortcut("Right", "Right"); GetKeyModifier(newMetaShortcut.Split('+'), out metaKey, out metaModifier); _metaShortcuts.Add(AddBinding(viewModel.NextCommand, metaKey, metaModifier)); }
/// <summary> /// Removes the InputBinding instance with the specified name from the cache. /// </summary> /// <param name="name">Name of the InputBinding instance to remove.</param> /// <returns>True if found and removed, false if not.</returns> public bool RemoveInputBinding(string name) { return(InputBindings.Remove(name)); }
public void RemoveInputBinding(InputBinding inputBinding) { InputBindings.Remove(inputBinding); }