Ejemplo n.º 1
0
        private static void AddShortcut(ref List <KeyboardShortcut> list, KeyboardCombination combination, Key key, string method, RoutedMethodRegistry mr)
        {
            try
            {
                var res = mr[method];

                KeyboardShortcut ks = new KeyboardShortcut(combination, key, res.handler, res.methodId, res.menuItem);
                list.Add(ks);
            }
            catch (KeyNotFoundException) { }
        }
Ejemplo n.º 2
0
        //public KeyboardShortcut() { }

        /// <summary>
        /// Create a keyboard shortcut entry.
        /// </summary>
        /// <param name="combination">The key combination needed, if any, for activating this shortcut.</param>
        /// <param name="key">The specific key that corresponds to this shortcut.</param>
        /// <param name="action">The action to perform when this shortcut is activated.</param>
        public KeyboardShortcut(KeyboardCombination combination, Key key, IKeyAction action)
        {
            Combination = combination;
            Key         = key;

            Action   = action;
            MethodId = action.ID;

            GenerateKeyString();

            SourceElement = action.SourceElement;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a keyboard shortcut entry.
        /// </summary>
        /// <param name="combination">The key combination needed, if any, for activating this shortcut.</param>
        /// <param name="key">The specific key that corresponds to this shortcut.</param>
        /// <param name="method">The method to run when this shortcut is used.</param>
        /// <param name="methodId">The ID string/name for this method.</param>
        /// <param name="menuItem">The menu item corresponding with the method.</param>
        public KeyboardShortcut(KeyboardCombination combination, Key key, RoutedEventHandler?method, string methodId, System.Windows.Controls.MenuItem?menuItem)
        {
            Combination = combination;
            Key         = key;

            Method   = method;
            MethodId = methodId;

            if (menuItem != null)
            {
                GenerateKeyString();
                MethodHolder = menuItem;
            }
            else
            {
                KeyString    = "";
                MethodHolder = null;
            }
        }
Ejemplo n.º 4
0
 public void RegisterKeyShortcut(KeyboardCombination combination, Key key, (string methodId, RoutedEventHandler method, MenuItem? menuItem) methodRegistryItem)
Ejemplo n.º 5
0
        public void RegisterKeyShortcut(KeyboardCombination combination, Key key, RoutedEventHandler method, string methodId, MenuItem?menuItem)
        {
            KeyboardShortcut kc = new KeyboardShortcut(combination, key, method, methodId, menuItem);

            RegisterKeyShortcut(kc);
        }
Ejemplo n.º 6
0
 public KeyEntry(KeyboardCombination combination, Key key, string methodId)
 {
     KeyboardCombination = combination;
     Key      = key;
     MethodId = methodId;
 }