예제 #1
0
        void InstallCommands()
        {
            CodeBindings.Add(new RoutedCommand("GoToLine", typeof(MainWindow)), GoToLineExecuted, GoToLineExecutedCanExecute, ModifierKeys.Control, Key.G);

            var bindings = new TabBindings();
            bindings.Add(new RoutedCommand("OpenNewTab", typeof(MainWindow)), OpenNewTabExecuted, null, ModifierKeys.Control, Key.T);
            bindings.Add(new RoutedCommand("CloseActiveTab", typeof(MainWindow)), CloseActiveTabExecuted, CloseActiveTabCanExecute, ModifierKeys.Control, Key.W, ModifierKeys.Control, Key.F4);
            bindings.Add(new RoutedCommand("SelectNextTab", typeof(MainWindow)), SelectNextTabExecuted, SelectNextTabCanExecute, ModifierKeys.Control, Key.Tab);
            bindings.Add(new RoutedCommand("SelectPrevTab", typeof(MainWindow)), SelectPrevTabExecuted, SelectPrevTabCanExecute, ModifierKeys.Control | ModifierKeys.Shift, Key.Tab);
            bindings.Add(new RoutedCommand("ZoomIncrease", typeof(MainWindow)), ZoomIncreaseExecuted, ZoomIncreaseCanExecute, ModifierKeys.Control, Key.OemPlus, ModifierKeys.Control, Key.Add);
            bindings.Add(new RoutedCommand("ZoomDecrease", typeof(MainWindow)), ZoomDecreaseExecuted, ZoomDecreaseCanExecute, ModifierKeys.Control, Key.OemMinus, ModifierKeys.Control, Key.Subtract);
            bindings.Add(new RoutedCommand("ZoomReset", typeof(MainWindow)), ZoomResetExecuted, ZoomResetCanExecute, ModifierKeys.Control, Key.D0, ModifierKeys.Control, Key.NumPad0);
            bindings.Add(new RoutedCommand("FocusCode", typeof(MainWindow)), FocusCodeExecuted, FocusCodeCanExecute, ModifierKeys.None, Key.F7, ModifierKeys.Control | ModifierKeys.Alt, Key.D0, ModifierKeys.Control | ModifierKeys.Alt, Key.NumPad0);
            bindings.Add(new RoutedCommand("FocusTreeView", typeof(MainWindow)), FocusTreeViewExecuted, FocusTreeViewCanExecute, ModifierKeys.Control | ModifierKeys.Alt, Key.L);
            bindings.Add(NavigationCommands.BrowseBack, BackCommandExecuted, BackCommandCanExecute, ModifierKeys.None, Key.Back);
            bindings.CommandBindings.Add(new CommandBinding(NavigationCommands.BrowseForward, ForwardCommandExecuted, ForwardCommandCanExecute));
            bindings.Add(new RoutedCommand("FullScreen", typeof(MainWindow)), FullScreenExecuted, FullScreenCanExecute, ModifierKeys.Shift | ModifierKeys.Alt, Key.Enter);
            bindings.CommandBindings.Add(new CommandBinding(ApplicationCommands.Open, OpenCommandExecuted));
            bindings.CommandBindings.Add(new CommandBinding(ApplicationCommands.Save, SaveCommandExecuted, SaveCommandCanExecute));
            bindings.CommandBindings.Add(new CommandBinding(NavigationCommands.Search, SearchCommandExecuted));
            bindings.Add(new RoutedCommand("WordWrap", typeof(MainWindow)), WordWrapExecuted, WordWrapCanExecute, ModifierKeys.Control | ModifierKeys.Alt, Key.W);
            bindings.Install(this);
        }
예제 #2
0
 void RemoveCommandBindings(TabBindings bindings, UIElement elem)
 {
     bindings.Uninstall(this);
     foreach (CommandBinding binding in elem.CommandBindings)
         this.CommandBindings.Remove(binding);
 }
예제 #3
0
 void AddCommandBindings(TabBindings bindings, UIElement elem)
 {
     bindings.Install(this);
     this.CommandBindings.AddRange(elem.CommandBindings);
 }