コード例 #1
0
        static ShareOnFacebookCommand()
        {
            InputGestureCollection gestures = new InputGestureCollection();
            gestures.Add(new KeyGesture(Key.F, ModifierKeys.Control | ModifierKeys.Shift));

            ShareOnFacebook = new RoutedUICommand("Share on Facebook", "Share on Facebook", typeof(ShareOnFacebookCommand), gestures);
        }
コード例 #2
0
        /// <summary>
        /// Creates a routed command instance with a shortcut key.
        /// </summary>
        /// <param name="name">Given name.</param>
        /// <param name="key">Shortcut key.</param>
        /// <param name="displayString">The Routed UI command.</param>
        /// <returns></returns>
        private static RoutedUICommand MakeRoutedUICommand(string name, Key key, string displayString)
        {
            InputGestureCollection gestures = new InputGestureCollection();
            gestures.Add(new KeyGesture(key, ModifierKeys.Control, displayString));

            return new RoutedUICommand(name, name, typeof(ActionCommands), gestures);
        }
コード例 #3
0
        public ApplicationCommand(string text, string name, Type pageType, InputGestureCollection inputGestures)
            : base(text, name, typeof(ApplicationCommands), inputGestures)
        {
            Debug.Assert(pageType != null);

            this.PageType = pageType;
        }
コード例 #4
0
 static DataCommands()
 {
     InputGestureCollection inputs = new InputGestureCollection();
     inputs.Add(new KeyGesture(Key.R, ModifierKeys.Control, "Ctrl+R"));
     requery = new RoutedUICommand(
       "Requery", "Requery", typeof(DataCommands), inputs);
 }
コード例 #5
0
        string strFindWhat = "", strReplaceWith = ""; // strFindWhat : �˻��� ���ڿ� , strReplaceWith : �˻��� ���ڿ�

        #endregion Fields

        #region Methods

        // =======================================================================================================================
        // �޴� �ʱ�ȭ �� ������...
        void AddFindMenuItems(MenuItem itemEdit)
        {
            // Find �޴� �׸� �����...
            MenuItem itemFind = new MenuItem();                                 // itemFind �޴� �߰�
            itemFind.Header = "_Find...";                                       // Herder ����
            itemFind.Command = ApplicationCommands.Find;                        // Command�� Find ����
            itemEdit.Items.Add(itemFind);                                       // itemEdit�� itemFind �߰�
            CommandBindings.Add(new CommandBinding(
                ApplicationCommands.Find, FindOnExecute, FindCanExecute));      // FindOnExecute, FindCanExecute �̺�Ʈ ����
            // -------------------------------------------------------------------------------------------------------------------
            // Ŀ���� RoutedUICommand�� Find Next �׸��� �ʿ�
            InputGestureCollection coll = new InputGestureCollection();         // RoutedUICommand�� �߰��� coll ����
            coll.Add(new KeyGesture(Key.F3));                                   // coll�� F3 ����Ű ���
            RoutedUICommand commFindNext =
                new RoutedUICommand("Find _Next", "FindNext", GetType(), coll); // FindNext ����(text, name, type, gestures)

            MenuItem itemNext = new MenuItem();                                 // itemNext �޴� �߰�
            itemNext.Command = commFindNext;                                    // ������ ���� commFindNext ����
            itemEdit.Items.Add(itemNext);                                       // itemEdit�� itemNext �߰�
            CommandBindings.Add(
                new CommandBinding(commFindNext, FindNextOnExecute,
                                                 FindNextCanExecute));          // FindNextOnExecute, FindNextCanExecute �̺�Ʈ ����
            // -------------------------------------------------------------------------------------------------------------------
            MenuItem itemReplace = new MenuItem();                              // itemReplace �޴� �߰�
            itemReplace.Header = "_Replace...";                                 // Herder ����
            itemReplace.Command = ApplicationCommands.Replace;                  // Command�� Replace ����
            itemEdit.Items.Add(itemReplace);                                    // itemEdit�� itemReplace �߰�
            CommandBindings.Add(new CommandBinding(
                ApplicationCommands.Replace, ReplaceOnExecute, FindCanExecute));// ReplaceOnExecute, FindCanExecute �̺�Ʈ ����
        }
コード例 #6
0
        static MultiKeyGestureTest()
        {
            var gestures = new InputGestureCollection
            {
                new MultiKeyGesture(new[] { Key.K, Key.X }, ModifierKeys.Control)
            };
            Exit = new RoutedUICommand(
              "E_xit",
              "Exit",
              typeof(MultiKeyGestureTest),
              gestures);

            gestures = new InputGestureCollection
            {
                new MultiKeyGesture(new[] { Key.K, Key.F }, ModifierKeys.Control)
            };
            FormatSelection = new RoutedUICommand(
              "Format Selection",
              "FormatSelection",
              typeof(MultiKeyGestureTest),
              gestures);

            gestures = new InputGestureCollection
            {
                new MultiKeyGesture(new[] { Key.K, Key.D }, ModifierKeys.Control | ModifierKeys.Shift)
            };
            FormatDocument = new RoutedUICommand(
              "Format Document",
              "FormatDocument",
              typeof(MultiKeyGestureTest),
              gestures);
        }
コード例 #7
0
ファイル: Commands.cs プロジェクト: exactamente/MBA2
 static CustomCmd()
 {
     // Инициализация команды
     InputGestureCollection inputs = new InputGestureCollection();
     inputs.Add(new KeyGesture(Key.N, ModifierKeys.Control, "Ctrl + Shift + N"));
     add = new RoutedUICommand("Add", "Add", typeof(CustomCmd), inputs);
 }
コード例 #8
0
ファイル: Commands.cs プロジェクト: EverlessDrop41/ModernEdit
        public static InputGestureCollection SaveAsInputGesture()
        {
            InputGestureCollection igc = new InputGestureCollection();
            igc.Add(new KeyGesture(Key.S, ModifierKeys.Control | ModifierKeys.Shift));

            return igc;
        }
コード例 #9
0
        static ExportAllConversationsCommand()
        {
            InputGestureCollection gestures = new InputGestureCollection();
            gestures.Add(new KeyGesture(Key.E, ModifierKeys.Control | ModifierKeys.Shift));

            ExportAllConversations = new RoutedUICommand("Export All Conversations", "Export All Conversations", typeof(ExportAllConversationsCommand), gestures);
        }
コード例 #10
0
        static ShowSettingsDialogCommand()
        {
            InputGestureCollection gestures = new InputGestureCollection();
            gestures.Add(new KeyGesture(Key.D3, ModifierKeys.Control));

            ShowSettingsDialog = new RoutedUICommand("Settings", "Settings", typeof(ShowSettingsDialogCommand), gestures);
        }
コード例 #11
0
        void AddFindMenuItems(MenuItem itemEdit)
        {
            // Find menu item.
            MenuItem itemFind = new MenuItem();
            itemFind.Header = "_Find...";
            itemFind.Command = ApplicationCommands.Find;
            itemEdit.Items.Add(itemFind);
            CommandBindings.Add(new CommandBinding(
                ApplicationCommands.Find, FindOnExecute, FindCanExecute));

            // The Find Next item requires a custom RoutedUICommand.
            InputGestureCollection coll = new InputGestureCollection();
            coll.Add(new KeyGesture(Key.F3));
            RoutedUICommand commFindNext =
                new RoutedUICommand("Find _Next", "FindNext", GetType(), coll);

            MenuItem itemNext = new MenuItem();
            itemNext.Command = commFindNext;
            itemEdit.Items.Add(itemNext);
            CommandBindings.Add(
                new CommandBinding(commFindNext, FindNextOnExecute,
                                                 FindNextCanExecute));

            MenuItem itemReplace = new MenuItem();
            itemReplace.Header = "_Replace...";
            itemReplace.Command = ApplicationCommands.Replace;
            itemEdit.Items.Add(itemReplace);
            CommandBindings.Add(new CommandBinding(
                ApplicationCommands.Replace, ReplaceOnExecute, FindCanExecute));
        }
コード例 #12
0
ファイル: Commands.cs プロジェクト: VivekRagunathan/EI
        static Commands()
        {
            // Initialize the commands

             InputGestureCollection inputs = new InputGestureCollection();
             inputs.Add(new KeyGesture(Key.F, ModifierKeys.Control | ModifierKeys.Shift, "Ctrl+Shift+F"));
             addFolderEntity = new RoutedUICommand("Add Folder", "AddFolder", typeof(Commands), inputs);

             inputs = new InputGestureCollection();
             inputs.Add(new KeyGesture(Key.L, ModifierKeys.Control | ModifierKeys.Shift, "Ctrl+Shift+L"));
             addFileEntity = new RoutedUICommand("Add File", "AddFile", typeof(Commands), inputs);

             inputs = new InputGestureCollection();
             inputs.Add(new KeyGesture(Key.Delete, ModifierKeys.Control, "Ctrl+Del"));
             removeEntity = new RoutedUICommand("Remove Entity", "RemoveEntity", typeof(Commands), inputs);

             inputs = new InputGestureCollection();
             inputs.Add(new KeyGesture(Key.Delete, ModifierKeys.Control | ModifierKeys.Shift, "Ctrl+Shift+Del"));
             removeAllEntities = new RoutedUICommand("Remove All Entities", "RemoveAllEntities", typeof(Commands), inputs);

             inputs = new InputGestureCollection();
             inputs.Add(new KeyGesture(Key.F7, ModifierKeys.None, "F7"));
             buildPackage = new RoutedUICommand("Build Package", "BuildPackage", typeof(Commands), inputs);

             inputs = new InputGestureCollection();
             inputs.Add(new KeyGesture(Key.F2, ModifierKeys.None, "F2"));
             renameEntity = new RoutedUICommand("Rename Entity", "RenameEntity", typeof(Commands), inputs);
        }
コード例 #13
0
 static OrderByTitle()
 {
     InputGestureCollection inputs = new InputGestureCollection();
     inputs.Add(new KeyGesture(Key.T, ModifierKeys.Alt, "Alt+T"));
     orderByTitle = new RoutedUICommand(
       "OrderByTitleCmd", "OrderByTitleCmd", typeof(OrderByTitle), inputs);
 }
コード例 #14
0
 static OrderByAuthor()
 {
     InputGestureCollection inputs = new InputGestureCollection();
     inputs.Add(new KeyGesture(Key.A, ModifierKeys.Alt, "Alt+A"));
     orderByAuthor = new RoutedUICommand(
       "OrderByAuthorCmd", "OrderByAuthorCmd", typeof(OrderByAuthor), inputs);
 }
コード例 #15
0
 static Hotkeys()
 {
     InputGestureCollection inputs = new InputGestureCollection();
     inputs.Add(new KeyGesture(Key.X, ModifierKeys.Alt, "Alt+X"));
     ex = new RoutedUICommand("Exit", "Exit", typeof(Hotkeys), inputs);
     inputs = new InputGestureCollection();
 }
コード例 #16
0
ファイル: IECommands.cs プロジェクト: SimVascular/OpenCASCADE
        static IECommands()
        {
            #region menu

            InputGestureCollection inputsNew = new InputGestureCollection();
            inputsNew.Add( new KeyGesture( Key.N, ModifierKeys.Control, "Ctrl + N" ) );
            New = new RoutedUICommand( "New", "New", typeof(IECommands), inputsNew );
            
            Close = new RoutedUICommand( "Close", "Close", typeof(IECommands) );

            InputGestureCollection inputsQuit = new InputGestureCollection();
            inputsQuit.Add( new KeyGesture( Key.F4, ModifierKeys.Alt, "Alt + F4" ) );
            Quit = new RoutedUICommand( "Quit", "Quit", typeof(IECommands), inputsQuit );

            InputGestureCollection inputsAbout = new InputGestureCollection();
            inputsAbout.Add( new KeyGesture( Key.F1 ) );
            About = new RoutedUICommand( "About", "About", typeof(IECommands), inputsAbout );

            #endregion

            #region aboutDlg
            InputGestureCollection inputsAboutOk = new InputGestureCollection();
            inputsAboutOk.Add( new KeyGesture( Key.Enter ) );
            AboutOk = new RoutedUICommand( "AboutOk", "AboutOk", typeof(IECommands), inputsAboutOk );
            #endregion
        }
コード例 #17
0
ファイル: NumberGrid.cs プロジェクト: abordt/Viking
        static NumberGrid()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(NumberGrid), new FrameworkPropertyMetadata(typeof(NumberGrid)));

            NumberGrid.CenterNumberProperty = DependencyProperty.Register("CenterNumber",
                                                                        typeof(int),
                                                                        typeof(NumberGrid),
                                                                        new FrameworkPropertyMetadata(1, new PropertyChangedCallback(OnCenterNumberChanged)));

            NumberGrid.OffsetArrayProperty = DependencyProperty.Register("OffsetArray",
                                                                        typeof(int[]),
                                                                        typeof(NumberGrid),
                                                                        new FrameworkPropertyMetadata(new int[] {0}, new PropertyChangedCallback(OnOffsetArrayChanged)));

            NumberGrid.GridNumberArrayProperty = DependencyProperty.Register("GridNumberArray",
                                                                        typeof(int?[]),
                                                                        typeof(NumberGrid),
                                                                        new FrameworkPropertyMetadata(new int?[] {1}));

            NumberGrid.ValidNumberSetProperty = DependencyProperty.Register("ValidNumberSet",
                                                                        typeof(List<int>),
                                                                        typeof(NumberGrid),
                                                                        new FrameworkPropertyMetadata(new List<int>(), new PropertyChangedCallback(OnValidNumberSetChanged)));

            InputGestureCollection IncrementInputs = new InputGestureCollection();
            IncrementInputs.Add(new KeyGesture(Key.PageUp));

            InputGestureCollection DecrementInputs = new InputGestureCollection();
            DecrementInputs.Add(new KeyGesture(Key.PageDown));

            incrementSectionCommand = new RoutedUICommand("+", "IncrementSectionCommand", typeof(NumberGrid), IncrementInputs);
            decrementSectionCommand = new RoutedUICommand("-", "DecrementSectionCommand", typeof(NumberGrid), DecrementInputs);
        }
コード例 #18
0
ファイル: MyCommands.cs プロジェクト: AltumSpatium/Labs
 static MyCommands()
 {
     InputGestureCollection inputs = new InputGestureCollection();
     inputs.Add(new KeyGesture(Key.G, ModifierKeys.Alt, "Alt+G"));
     addGroup = new RoutedUICommand("Add group", "Add group", typeof(MyCommands), inputs);
     inputs = new InputGestureCollection();
     inputs.Add(new KeyGesture(Key.R, ModifierKeys.Alt, "Alt+R"));
     removeGroup = new RoutedUICommand("Remove group", "Remove group", typeof(MyCommands), inputs);
     inputs = new InputGestureCollection();
     inputs.Add(new KeyGesture(Key.S, ModifierKeys.Alt, "Alt+S"));
     addStudent = new RoutedUICommand("Add student", "Add student", typeof(MyCommands), inputs);
     inputs = new InputGestureCollection();
     inputs.Add(new KeyGesture(Key.E, ModifierKeys.Alt, "Alt+E"));
     expellStudent = new RoutedUICommand("Add student", "Add student", typeof(MyCommands), inputs);
     inputs = new InputGestureCollection();
     inputs.Add(new KeyGesture(Key.C, ModifierKeys.Alt, "Alt+C"));
     chooseMerge = new RoutedUICommand("Choose", "Choose", typeof(MyCommands), inputs);
     inputs = new InputGestureCollection();
     inputs.Add(new KeyGesture(Key.M, ModifierKeys.Alt, "Alt+M"));
     merge = new RoutedUICommand("Merge", "Merge", typeof(MyCommands), inputs);
     inputs = new InputGestureCollection();
     inputs.Add(new KeyGesture(Key.X, ModifierKeys.Alt, "Alt+X"));
     chooseTransfer = new RoutedUICommand("Choose", "Choose", typeof(MyCommands), inputs);
     inputs = new InputGestureCollection();
     inputs.Add(new KeyGesture(Key.T, ModifierKeys.Alt, "Alt+T"));
     transfer = new RoutedUICommand("Transfer", "Transfer", typeof(MyCommands), inputs);
     inputs = new InputGestureCollection();
     inputs.Add(new KeyGesture(Key.Z, ModifierKeys.Control, "Ctrl+Z"));
     cancel = new RoutedUICommand("Cancel", "Cancel", typeof(MyCommands), inputs);
 }
コード例 #19
0
 internal static void AddGesturesFromResourceStrings(string keyGestures, string displayStrings, InputGestureCollection gestures)
 {
     while (!string.IsNullOrEmpty(keyGestures))
     {
         string str;
         string str2;
         int index = keyGestures.IndexOf(";", StringComparison.Ordinal);
         if (index >= 0)
         {
             str2 = keyGestures.Substring(0, index);
             keyGestures = keyGestures.Substring(index + 1);
         }
         else
         {
             str2 = keyGestures;
             keyGestures = string.Empty;
         }
         index = displayStrings.IndexOf(";", StringComparison.Ordinal);
         if (index >= 0)
         {
             str = displayStrings.Substring(0, index);
             displayStrings = displayStrings.Substring(index + 1);
         }
         else
         {
             str = displayStrings;
             displayStrings = string.Empty;
         }
         UnrestrictedKeyGesture inputGesture = CreateFromResourceStrings(str2, str);
         if (inputGesture != null)
         {
             gestures.Add(inputGesture);
         }
     }
 }
コード例 #20
0
ファイル: HotkeyCommands.cs プロジェクト: Armoken/Learning
        static HotkeyCommands()
        {
            InputGestureCollection inputs = new InputGestureCollection();
            inputs.Add(new KeyGesture(Key.Q, ModifierKeys.Control, "Ctrl+Q"));
            exit = new RoutedUICommand("Exit", "Exit", typeof(HotkeyCommands), inputs);

            inputs = new InputGestureCollection();
            inputs.Add(new KeyGesture(Key.D, ModifierKeys.Control, "Ctrl+D"));
            remove = new RoutedUICommand("Remove desktop", "Remove desktop", typeof(HotkeyCommands), inputs);

            inputs = new InputGestureCollection();
            inputs.Add(new KeyGesture(Key.F, ModifierKeys.Control, "Ctrl+F"));
            clear_all = new RoutedUICommand("Clear all", "Clear all", typeof(HotkeyCommands), inputs);

            inputs = new InputGestureCollection();
            inputs.Add(new KeyGesture(Key.G, ModifierKeys.Control, "Ctrl+G"));
            clear_lan = new RoutedUICommand("Clear selected LAN", "Clear selected LAN", typeof(HotkeyCommands), inputs);

            inputs = new InputGestureCollection();
            inputs.Add(new KeyGesture(Key.T, ModifierKeys.Control, "Ctrl+T"));
            set_stat_ip = new RoutedUICommand("Set static IP", "Set static IP", typeof(HotkeyCommands), inputs);

            inputs = new InputGestureCollection();
            inputs.Add(new KeyGesture(Key.U, ModifierKeys.Control, "Ctrl+U"));
            unset_stat_ip = new RoutedUICommand("Unset static IP", "Unset static IP", typeof(HotkeyCommands), inputs);

            inputs = new InputGestureCollection();
            inputs.Add(new KeyGesture(Key.M, ModifierKeys.Control, "Ctrl+M"));
            move_to = new RoutedUICommand("Move to", "Move to", typeof(HotkeyCommands), inputs);

            inputs = new InputGestureCollection();
            inputs.Add(new KeyGesture(Key.K, ModifierKeys.Control, "Ctrl+K"));
            combine_lans = new RoutedUICommand("Combine LAN's", "Combine LAN's", typeof(HotkeyCommands), inputs);
        }
コード例 #21
0
        static CopyGraphCommand()
        {
            InputGestureCollection gestures = new InputGestureCollection();
            gestures.Add(new KeyGesture(Key.C, ModifierKeys.Control));

            CopyGraph = new RoutedUICommand("Copy Graph", "Copy Graph", typeof(CopyGraphCommand), gestures);
        }
コード例 #22
0
        static ExportSingleConversationCommand()
        {
            InputGestureCollection gestures = new InputGestureCollection();
            gestures.Add(new KeyGesture(Key.E, ModifierKeys.Control));

            ExportSingleConversation = new RoutedUICommand("Export Selected Conversation", "Export Selected Conversation", typeof(ExportSingleConversationCommand), gestures);
        }
コード例 #23
0
ファイル: Res.cs プロジェクト: densem-2013/FifteenImage
        static DataCommands()
        {
            //// Инициализация команды.
               InputGestureCollection inputs = new InputGestureCollection();
               inputs.Add(new KeyGesture(Key.Escape, ModifierKeys.None, "Esc"));
               escape = new RoutedUICommand(
             "Escape", "Escape", typeof(DataCommands), inputs);

               InputGestureCollection inputs2 = new InputGestureCollection();
               inputs2.Add(new KeyGesture(Key.N, ModifierKeys.Control, "Ctr+N"));
               newGame = new RoutedUICommand(
             "NewGame", "NewGame", typeof(DataCommands), inputs2);

               InputGestureCollection inputs3 = new InputGestureCollection();
               inputs3.Add(new KeyGesture(Key.M, ModifierKeys.Control, "Ctr+M"));
               mix = new RoutedUICommand(
             "Mix", "Mix", typeof(DataCommands), inputs3);

               InputGestureCollection inputs4 = new InputGestureCollection();
               inputs4.Add(new KeyGesture(Key.S, ModifierKeys.Control, "Ctr+S"));
               solve = new RoutedUICommand(
             "Solve", "Solve", typeof(DataCommands), inputs4);

               InputGestureCollection inputs5 = new InputGestureCollection();
               inputs5.Add(new KeyGesture(Key.L, ModifierKeys.Control, "Ctr+L"));
               loadPicture = new RoutedUICommand(
             "LoadPicture", "LoadPicture", typeof(DataCommands), inputs5);

               InputGestureCollection inputs6 = new InputGestureCollection();
               inputs6.Add(new KeyGesture(Key.P, ModifierKeys.Control));
               showSolution = new RoutedUICommand(
             "ShowSolution", "ShowSolution", typeof(DataCommands), inputs6);
        }
コード例 #24
0
ファイル: UICommand.cs プロジェクト: 569550384/Rafy
        internal UICommand(ClientCommand command, Type ownerType, InputGestureCollection gestures)
            : base(command.Meta.Label ?? string.Empty, command.Meta.Name, ownerType, gestures)
        {
            if (command == null) { throw new ArgumentNullException("command"); }

            this._command = command;
        }
コード例 #25
0
        static CopyConversationTextFormattedCommand()
        {
            InputGestureCollection gestures = new InputGestureCollection();
            gestures.Add(new KeyGesture(Key.C, ModifierKeys.Control | ModifierKeys.Shift));

            CopyConversationTextFormatted = new RoutedUICommand("Copy Formatted", "Copy Formatted", typeof(CopyConversationTextFormattedCommand), gestures);
        }
コード例 #26
0
        static SwitchToConversationViewCommand()
        {
            InputGestureCollection gestures = new InputGestureCollection();
            gestures.Add(new KeyGesture(Key.D1, ModifierKeys.Control));

            SwitchToConversationView = new RoutedUICommand("Conversation View", "Conversation View", typeof(SwitchToConversationViewCommand), gestures);
        }
コード例 #27
0
        public CommandTheMenu()
        {
            Title = "Command The Menu";

            DockPanel dock = new DockPanel();
            Content = dock;

            Menu menu = new Menu();
            dock.Children.Add(menu);
            DockPanel.SetDock(menu, Dock.Top);

            text = new TextBlock();
            text.Text = "Sample clipboard text";
            text.HorizontalAlignment = HorizontalAlignment.Center;
            text.VerticalAlignment = VerticalAlignment.Center;
            text.FontSize = 32;
            text.TextWrapping = TextWrapping.Wrap;
            dock.Children.Add(text);

            MenuItem itemEdit = new MenuItem();
            itemEdit.Header = "_Edit";
            menu.Items.Add(itemEdit);

            MenuItem itemCut = new MenuItem();
            itemCut.Header = "Cu_t";
            itemCut.Command = ApplicationCommands.Cut;
            itemEdit.Items.Add(itemCut);

            MenuItem itemCopy = new MenuItem();
            itemCopy.Header = "_Copy";
            itemCopy.Command = ApplicationCommands.Copy;
            itemEdit.Items.Add(itemCopy);

            MenuItem itemPaste = new MenuItem();
            itemPaste.Header = "_Paste";
            itemPaste.Command = ApplicationCommands.Paste;
            itemEdit.Items.Add(itemPaste);

            MenuItem itemDelete = new MenuItem();
            itemDelete.Header = "_Delete";
            itemDelete.Command = ApplicationCommands.Delete;
            itemEdit.Items.Add(itemDelete);

            // new command
            InputGestureCollection collGestures = new InputGestureCollection();
            collGestures.Add(new KeyGesture(Key.R, ModifierKeys.Control));
            RoutedUICommand commRestore = new RoutedUICommand("_Restore", "Restore", GetType(), collGestures);

            MenuItem itemRestore = new MenuItem();
            itemRestore.Header = "_Restore";
            itemRestore.Command = commRestore;
            itemEdit.Items.Add(itemRestore);

            CommandBindings.Add(new CommandBinding(ApplicationCommands.Cut, CutOnExecute, CutCanExecute));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy, CopyOnExecute, CutCanExecute));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Paste, PasteOnExecute, PasteCanExecute));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Delete, DeleteOnExecute, CutCanExecute));
            CommandBindings.Add(new CommandBinding(commRestore, RestoreOnExecute));
        }
コード例 #28
0
        private static RoutedUICommand CreateCommand(string name, params Key[] keys)
        {
            var gestures = new InputGestureCollection();
            foreach (var key in keys)
                gestures.Add(new KeyGesture(key));

            return new RoutedUICommand(name, name, typeof(ChartCommands), gestures);
        }
コード例 #29
0
ファイル: Commands.cs プロジェクト: jstrength/Puppy
 static Commands()
 {
     var exitGestures = new InputGestureCollection
                        {
                            new KeyGesture(Key.F4, ModifierKeys.Alt, "Alt+F4")
                        };
     _exitCommand = new RoutedUICommand("Exit", "Exit", typeof (Commands), exitGestures);
 }
コード例 #30
0
ファイル: RoutedUICommand.cs プロジェクト: JianwenSun/cc
 /// <summary>
 ///     Creates an instance of this class.
 /// </summary>
 /// <param name="text">Descriptive and localizable text for the command</param>
 /// <param name="name">Declared Name of the RoutedCommand for Serialization</param>
 /// <param name="ownerType">Type that is registering the property</param>
 /// <param name="inputGestures">Default Input Gestures associated</param>
 public RoutedUICommand(string text, string name, Type ownerType, InputGestureCollection inputGestures)
     : base(name, ownerType, inputGestures)
 {
     if (text == null)
     {
         throw new ArgumentNullException("text");
     }
     _text = text; 
 }
コード例 #31
0
        internal static InputGestureCollection LoadDefaultGestureFromResource(byte commandId)
        {
            InputGestureCollection gestures = new InputGestureCollection();

            //Standard Commands
            switch ((CommandId)commandId)
            {
            case  CommandId.ScrollPageUp:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.ScrollPageUpKey),
                    SR.Get(SRID.ScrollPageUpKeyDisplayString),
                    gestures);
                break;

            case  CommandId.ScrollPageDown:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.ScrollPageDownKey),
                    SR.Get(SRID.ScrollPageDownKeyDisplayString),
                    gestures);
                break;

            case  CommandId.ScrollPageLeft:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.ScrollPageLeftKey),
                    SR.Get(SRID.ScrollPageLeftKeyDisplayString),
                    gestures);
                break;

            case  CommandId.ScrollPageRight:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.ScrollPageRightKey),
                    SR.Get(SRID.ScrollPageRightKeyDisplayString),
                    gestures);
                break;

            case  CommandId.ScrollByLine:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.ScrollByLineKey),
                    SR.Get(SRID.ScrollByLineKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MoveLeft:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MoveLeftKey),
                    SR.Get(SRID.MoveLeftKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MoveRight:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MoveRightKey),
                    SR.Get(SRID.MoveRightKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MoveUp:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MoveUpKey),
                    SR.Get(SRID.MoveUpKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MoveDown:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MoveDownKey),
                    SR.Get(SRID.MoveDownKeyDisplayString),
                    gestures);
                break;

            case  CommandId.ExtendSelectionUp:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.ExtendSelectionUpKey),
                    SR.Get(SRID.ExtendSelectionUpKeyDisplayString),
                    gestures);
                break;

            case  CommandId.ExtendSelectionDown:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.ExtendSelectionDownKey),
                    SR.Get(SRID.ExtendSelectionDownKeyDisplayString),
                    gestures);
                break;

            case  CommandId.ExtendSelectionLeft:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.ExtendSelectionLeftKey),
                    SR.Get(SRID.ExtendSelectionLeftKeyDisplayString),
                    gestures);
                break;

            case  CommandId.ExtendSelectionRight:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.ExtendSelectionRightKey),
                    SR.Get(SRID.ExtendSelectionRightKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MoveToHome:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MoveToHomeKey),
                    SR.Get(SRID.MoveToHomeKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MoveToEnd:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MoveToEndKey),
                    SR.Get(SRID.MoveToEndKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MoveToPageUp:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MoveToPageUpKey),
                    SR.Get(SRID.MoveToPageUpKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MoveToPageDown:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MoveToPageDownKey),
                    SR.Get(SRID.MoveToPageDownKeyDisplayString),
                    gestures);
                break;

            case  CommandId.SelectToHome:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.SelectToHomeKey),
                    SR.Get(SRID.SelectToHomeKeyDisplayString),
                    gestures);
                break;

            case  CommandId.SelectToEnd:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.SelectToEndKey),
                    SR.Get(SRID.SelectToEndKeyDisplayString),
                    gestures);
                break;

            case  CommandId.SelectToPageDown:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.SelectToPageDownKey),
                    SR.Get(SRID.SelectToPageDownKeyDisplayString),
                    gestures);
                break;

            case  CommandId.SelectToPageUp:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.SelectToPageUpKey),
                    SR.Get(SRID.SelectToPageUpKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MoveFocusUp:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MoveFocusUpKey),
                    SR.Get(SRID.MoveFocusUpKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MoveFocusDown:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MoveFocusDownKey),
                    SR.Get(SRID.MoveFocusDownKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MoveFocusBack:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MoveFocusBackKey),
                    SR.Get(SRID.MoveFocusBackKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MoveFocusForward:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MoveFocusForwardKey),
                    SR.Get(SRID.MoveFocusForwardKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MoveFocusPageUp:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MoveFocusPageUpKey),
                    SR.Get(SRID.MoveFocusPageUpKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MoveFocusPageDown:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MoveFocusPageDownKey),
                    SR.Get(SRID.MoveFocusPageDownKeyDisplayString),
                    gestures);
                break;
            }
            return(gestures);
        }
コード例 #32
0
 public RoutedUICommand(string text, string name, Type ownerType, InputGestureCollection inputGestures)
     : base(name, ownerType, inputGestures)
 {
     this.text = text;
 }
コード例 #33
0
ファイル: MediaCommands.cs プロジェクト: beda2280/wpf-1
        internal static InputGestureCollection LoadDefaultGestureFromResource(byte commandId)
        {
            InputGestureCollection gestures = new InputGestureCollection();

            //Standard Commands
            switch ((CommandId)commandId)
            {
            case  CommandId.Play:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaPlayKey),
                    SR.Get(SRID.MediaPlayKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Pause:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaPauseKey),
                    SR.Get(SRID.MediaPauseKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Stop:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaStopKey),
                    SR.Get(SRID.MediaStopKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Record:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaRecordKey),
                    SR.Get(SRID.MediaRecordKeyDisplayString),
                    gestures);
                break;

            case  CommandId.NextTrack:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaNextTrackKey),
                    SR.Get(SRID.MediaNextTrackKeyDisplayString),
                    gestures);
                break;

            case  CommandId.PreviousTrack:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaPreviousTrackKey),
                    SR.Get(SRID.MediaPreviousTrackKeyDisplayString),
                    gestures);
                break;

            case  CommandId.FastForward:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaFastForwardKey),
                    SR.Get(SRID.MediaFastForwardKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Rewind:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaRewindKey),
                    SR.Get(SRID.MediaRewindKeyDisplayString),
                    gestures);
                break;

            case  CommandId.ChannelUp:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaChannelUpKey),
                    SR.Get(SRID.MediaChannelUpKeyDisplayString),
                    gestures);
                break;

            case  CommandId.ChannelDown:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaChannelDownKey),
                    SR.Get(SRID.MediaChannelDownKeyDisplayString),
                    gestures);
                break;

            case  CommandId.TogglePlayPause:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaTogglePlayPauseKey),
                    SR.Get(SRID.MediaTogglePlayPauseKeyDisplayString),
                    gestures);
                break;

            case  CommandId.IncreaseVolume:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaIncreaseVolumeKey),
                    SR.Get(SRID.MediaIncreaseVolumeKeyDisplayString),
                    gestures);
                break;

            case  CommandId.DecreaseVolume:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaDecreaseVolumeKey),
                    SR.Get(SRID.MediaDecreaseVolumeKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MuteVolume:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaMuteVolumeKey),
                    SR.Get(SRID.MediaMuteVolumeKeyDisplayString),
                    gestures);
                break;

            case  CommandId.IncreaseTreble:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaIncreaseTrebleKey),
                    SR.Get(SRID.MediaIncreaseTrebleKeyDisplayString),
                    gestures);
                break;

            case  CommandId.DecreaseTreble:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaDecreaseTrebleKey),
                    SR.Get(SRID.MediaDecreaseTrebleKeyDisplayString),
                    gestures);
                break;

            case  CommandId.IncreaseBass:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaIncreaseBassKey),
                    SR.Get(SRID.MediaIncreaseBassKeyDisplayString),
                    gestures);
                break;

            case  CommandId.DecreaseBass:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaDecreaseBassKey),
                    SR.Get(SRID.MediaDecreaseBassKeyDisplayString),
                    gestures);
                break;

            case  CommandId.BoostBass:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaBoostBassKey),
                    SR.Get(SRID.MediaBoostBassKeyDisplayString),
                    gestures);
                break;

            case  CommandId.IncreaseMicrophoneVolume:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaIncreaseMicrophoneVolumeKey),
                    SR.Get(SRID.MediaIncreaseMicrophoneVolumeKeyDisplayString),
                    gestures);
                break;

            case  CommandId.DecreaseMicrophoneVolume:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaDecreaseMicrophoneVolumeKey),
                    SR.Get(SRID.MediaDecreaseMicrophoneVolumeKeyDisplayString),
                    gestures);
                break;

            case  CommandId.MuteMicrophoneVolume:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaMuteMicrophoneVolumeKey),
                    SR.Get(SRID.MediaMuteMicrophoneVolumeKeyDisplayString),
                    gestures);
                break;

            case  CommandId.ToggleMicrophoneOnOff:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaToggleMicrophoneOnOffKey),
                    SR.Get(SRID.MediaToggleMicrophoneOnOffKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Select:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.MediaSelectKey),
                    SR.Get(SRID.MediaSelectKeyDisplayString),
                    gestures);
                break;
            }
            return(gestures);
        }
コード例 #34
0
        internal static InputGestureCollection LoadDefaultGestureFromResource(byte commandId)
        {
            InputGestureCollection gestures = new InputGestureCollection();

            //Standard Commands
            switch ((CommandId)commandId)
            {
            case  CommandId.BrowseBack:
                KeyGesture.AddGesturesFromResourceStrings(
                    BrowseBackKey,
                    SR.Get(SRID.BrowseBackKeyDisplayString),
                    gestures);
                break;

            case  CommandId.BrowseForward:
                KeyGesture.AddGesturesFromResourceStrings(
                    BrowseForwardKey,
                    SR.Get(SRID.BrowseForwardKeyDisplayString),
                    gestures);
                break;

            case  CommandId.BrowseHome:
                KeyGesture.AddGesturesFromResourceStrings(
                    BrowseHomeKey,
                    SR.Get(SRID.BrowseHomeKeyDisplayString),
                    gestures);
                break;

            case  CommandId.BrowseStop:
                KeyGesture.AddGesturesFromResourceStrings(
                    BrowseStopKey,
                    SR.Get(SRID.BrowseStopKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Refresh:
                KeyGesture.AddGesturesFromResourceStrings(
                    RefreshKey,
                    SR.Get(SRID.RefreshKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Favorites:
                KeyGesture.AddGesturesFromResourceStrings(
                    FavoritesKey,
                    SR.Get(SRID.FavoritesKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Search:
                KeyGesture.AddGesturesFromResourceStrings(
                    SearchKey,
                    SR.Get(SRID.SearchKeyDisplayString),
                    gestures);
                break;

            case  CommandId.IncreaseZoom:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.IncreaseZoomKey),
                    SR.Get(SRID.IncreaseZoomKeyDisplayString),
                    gestures);
                break;

            case  CommandId.DecreaseZoom:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.DecreaseZoomKey),
                    SR.Get(SRID.DecreaseZoomKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Zoom:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.ZoomKey),
                    SR.Get(SRID.ZoomKeyDisplayString),
                    gestures);
                break;

            case  CommandId.NextPage:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.NextPageKey),
                    SR.Get(SRID.NextPageKeyDisplayString),
                    gestures);
                break;

            case  CommandId.PreviousPage:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.PreviousPageKey),
                    SR.Get(SRID.PreviousPageKeyDisplayString),
                    gestures);
                break;

            case  CommandId.FirstPage:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.FirstPageKey),
                    SR.Get(SRID.FirstPageKeyDisplayString),
                    gestures);
                break;

            case  CommandId.LastPage:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.LastPageKey),
                    SR.Get(SRID.LastPageKeyDisplayString),
                    gestures);
                break;

            case  CommandId.GoToPage:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.GoToPageKey),
                    SR.Get(SRID.GoToPageKeyDisplayString),
                    gestures);
                break;

            case  CommandId.NavigateJournal:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.NavigateJournalKey),
                    SR.Get(SRID.NavigateJournalKeyDisplayString),
                    gestures);
                break;
            }
            return(gestures);
        }
コード例 #35
0
        internal static InputGestureCollection LoadDefaultGestureFromResource(byte commandId)
        {
            InputGestureCollection gestures = new InputGestureCollection();

            //Standard Commands
            switch ((CommandId)commandId)
            {
            case  CommandId.Cut:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.CutKey),
                    SR.Get(SRID.CutKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Copy:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.CopyKey),
                    SR.Get(SRID.CopyKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Paste:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.PasteKey),
                    SR.Get(SRID.PasteKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Undo:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.UndoKey),
                    SR.Get(SRID.UndoKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Redo:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.RedoKey),
                    SR.Get(SRID.RedoKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Delete:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.DeleteKey),
                    SR.Get(SRID.DeleteKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Find:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.FindKey),
                    SR.Get(SRID.FindKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Replace:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.ReplaceKey),
                    SR.Get(SRID.ReplaceKeyDisplayString),
                    gestures);
                break;

            case  CommandId.SelectAll:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.SelectAllKey),
                    SR.Get(SRID.SelectAllKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Help:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.HelpKey),
                    SR.Get(SRID.HelpKeyDisplayString),
                    gestures);
                break;

            case  CommandId.New:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.NewKey),
                    SR.Get(SRID.NewKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Open:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.OpenKey),
                    SR.Get(SRID.OpenKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Save:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.SaveKey),
                    SR.Get(SRID.SaveKeyDisplayString),
                    gestures);
                break;

            case  CommandId.SaveAs:
                break;     // there are no default bindings for  CommandId.SaveAs

            case  CommandId.Print:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.PrintKey),
                    SR.Get(SRID.PrintKeyDisplayString),
                    gestures);
                break;

            case  CommandId.CancelPrint:
                break;     // there are no default bindings for  CommandId.CancelPrint

            case  CommandId.PrintPreview:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.PrintPreviewKey),
                    SR.Get(SRID.PrintPreviewKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Close:
                break;     // there are no default bindings for  CommandId.Close

            case  CommandId.ContextMenu:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.ContextMenuKey),
                    SR.Get(SRID.ContextMenuKeyDisplayString),
                    gestures);
                break;

            case  CommandId.CorrectionList:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.CorrectionListKey),
                    SR.Get(SRID.CorrectionListKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Properties:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.PropertiesKey),
                    SR.Get(SRID.PropertiesKeyDisplayString),
                    gestures);
                break;

            case  CommandId.Stop:
                KeyGesture.AddGesturesFromResourceStrings(
                    SR.Get(SRID.StopKey),
                    SR.Get(SRID.StopKeyDisplayString),
                    gestures);
                break;

            case  CommandId.NotACommand:
                break;     // there are no default bindings for  CommandId.NotACommand
            }
            return(gestures);
        }
コード例 #36
0
ファイル: RoutedCommand.cs プロジェクト: stanasse/olive
 public RoutedCommand(string name, Type ownerType, InputGestureCollection inputGestures)
     : this(name, ownerType)
 {
     this.inputGestures = inputGestures;
 }
コード例 #37
0
ファイル: KeyGesture.cs プロジェクト: dox0/DotNet471RS3
        /// <summary>
        /// Decode the strings keyGestures and displayStrings, creating a sequence
        /// of KeyGestures.  Add each KeyGesture to the given InputGestureCollection.
        /// The two input strings typically come from a resource file.
        /// </summary>
        internal static void AddGesturesFromResourceStrings(string keyGestures, string displayStrings, InputGestureCollection gestures)
        {
            while (!String.IsNullOrEmpty(keyGestures))
            {
                string keyGestureToken;
                string keyDisplayString;

                // break apart first gesture from the rest
                int index = keyGestures.IndexOf(MULTIPLEGESTURE_DELIMITER, StringComparison.Ordinal);
                if (index >= 0)
                {   // multiple gestures exist
                    keyGestureToken = keyGestures.Substring(0, index);
                    keyGestures     = keyGestures.Substring(index + 1);
                }
                else
                {
                    keyGestureToken = keyGestures;
                    keyGestures     = String.Empty;
                }

                // similarly, break apart first display string from the rest
                index = displayStrings.IndexOf(MULTIPLEGESTURE_DELIMITER, StringComparison.Ordinal);
                if (index >= 0)
                {   // multiple display strings exist
                    keyDisplayString = displayStrings.Substring(0, index);
                    displayStrings   = displayStrings.Substring(index + 1);
                }
                else
                {
                    keyDisplayString = displayStrings;
                    displayStrings   = String.Empty;
                }

                KeyGesture keyGesture = CreateFromResourceStrings(keyGestureToken, keyDisplayString);

                if (keyGesture != null)
                {
                    gestures.Add(keyGesture);
                }
            }
        }