Esempio n. 1
0
        protected bool UpdateKey(ShortcutName name, KeyInfo info)
        {
            if (info.Key == 0)
            {
                return(false);
            }

            // Don't overwrite another shortcut
            if (_keys.ContainsKey(info))
            {
                return(false);
            }

            foreach (var item in _keys)
            {
                if (item.Value == name)
                {
                    _keys.Remove(item.Key);
                    break;
                }
            }

            _keys[info] = name;

            return(true);
        }
        public ShortcutInfo(ShortcutName name, KeyboardShortcuts shortcuts)
        {
            _shortcuts = shortcuts;
            _name      = name;

            Name = s_loader.GetString(name.ToString());

            Debug.Assert(!string.IsNullOrWhiteSpace(Name), "A resource string must be available for the shortcut");
        }
Esempio n. 3
0
        public string GetShortcutString(ShortcutName name)
        {
            foreach (var item in _keys)
            {
                if (item.Value == name)
                {
                    return(item.Key.ToString(KeyToString));
                }
            }

            return(string.Empty);
        }
Esempio n. 4
0
        public void BuildCustomShortcut()
        {
            VbsFilePath = VbsFolderPath + ShortcutName + ".vbs";

            File.WriteAllText(VbsFilePath,
                              string.Format(Resources.CustomShortcutVbsTemplate,
                                            ShortcutName.EscapeVba(),
                                            ShortcutItem.ShortcutFileInfo.FullName.EscapeVba(),
                                            TargetPath.QuoteWrap().EscapeVba(),
                                            TargetArguments.EscapeVba(),
                                            ShortcutType,
                                            (int)WindowType
                                            ));

            ShortcutUtils.CreateLnkFile(ShortcutItem.ShortcutFileInfo.FullName, VbsFilePath,
                                        ShortcutName + " shortcut created by TileIconifier",
                                        iconPath: BasicShortcutIcon,
                                        workingDirectory: WorkingFolder
                                        );
        }
Esempio n. 5
0
 public static void SetClick(ButtonBase attached, ShortcutName value)
 {
     attached.SetValue(ClickProperty, value);
 }
Esempio n. 6
0
 public static void SetFocus(Control attached, ShortcutName value)
 {
     attached.SetValue(FocusProperty, value);
 }
Esempio n. 7
0
        public bool UpdateKey(ShortcutName name, int key)
        {
            var info = GetKeyInfo(key);

            return(UpdateKey(name, info));
        }