Exemple #1
0
        /// <summary>Specifies the entire information about this HotKey.
        /// </summary>
        /// <returns>A string representation of the information.</returns>
        public string FullInfo()
        {
            string bhot = "";
            string chot = "";

            bhot = HotKeyShared.CombineShortcut(BaseModifier, BaseKey);
            chot = HotKeyShared.CombineShortcut(ChordModifier, ChordKey);

            return(String.Format("{0} ; {1} ; {2} ; {3}Enabled ; ChordHotKey", Name, bhot, chot, Enabled ? "" : "Not "));
        }
        /// <summary>Checks if a hotkey has already been registered as a Local or Global HotKey.
        /// </summary>
        /// <param name="shortcut">The hotkey string to check.</param>
        /// <param name="ToCheck">The HotKey type to check.</param>
        /// <returns>True if the HotKey is already registered, false otherwise.</returns>
        public bool HotKeyExists(string shortcut, CheckKey ToCheck)
        {
            Keys      Key      = (Keys)HotKeyShared.ParseShortcut(shortcut).GetValue(1);
            Modifiers Modifier = (Modifiers)HotKeyShared.ParseShortcut(shortcut).GetValue(0);

            switch (ToCheck)
            {
            case CheckKey.GlobalHotKey:
                return(Program.SysConfig.GlobalHotKeyContainer.Exists
                       (
                           delegate(GlobalHotKey g)
                {
                    return (g.Key == Key && g.Modifier == Modifier);
                }
                       ));

            case CheckKey.LocalHotKey:
                return(Program.SysConfig.LocalHotKeyContainer.Exists
                       (
                           delegate(LocalHotKey l)
                {
                    return (l.Key == Key && l.Modifier == Modifier);
                }
                       )
                       |
                       Program.SysConfig.ChordHotKeyContainer.Exists
                       (
                           delegate(ChordHotKey c)
                {
                    return (c.BaseKey == Key && c.BaseModifier == Modifier);
                }));

            case CheckKey.Both:
                return(HotKeyExists(shortcut, CheckKey.GlobalHotKey) ^ HotKeyExists(shortcut, CheckKey.LocalHotKey));
            }
            return(false);
        }
 /// <summary>Checks if a hotkey has already been registered as a Local or Global HotKey.
 /// </summary>
 /// <param name="key">The key of the HotKey.</param>
 /// <param name="modifier">The modifier of the HotKey.</param>
 /// <param name="ToCheck">The HotKey type to check.</param>
 /// <returns>True if the HotKey is already registered, false otherwise.</returns>
 public bool HotKeyExists(Keys key, Modifiers modifier, CheckKey ToCheck)
 {
     return(HotKeyExists(HotKeyShared.CombineShortcut(modifier, key), ToCheck));
 }
Exemple #4
0
 /// <summary>Information about this Hotkey.
 /// </summary>
 /// <returns>The properties of the hotkey.</returns>
 public string FullInfo()
 {
     return(string.Format("{0} ; {1} ; {2} ; {3}Enabled ; LocalHotKey", Name, HotKeyShared.CombineShortcut(Modifier, Key), WhenToRaise, Enabled ? "" : "Not "));
 }
Exemple #5
0
 /// <summary>Specifies the Chord information of this HotKey.
 /// </summary>
 /// <returns>A string representation of the information.</returns>
 public string ChordInfo()
 {
     return(HotKeyShared.CombineShortcut(ChordModifier, ChordKey));
 }
Exemple #6
0
 /// <summary>Specifies the base information of this HotKey.
 /// </summary>
 /// <returns>A string representation of the information.</returns>
 public string BaseInfo()
 {
     return(HotKeyShared.CombineShortcut(BaseModifier, BaseKey));
 }