Exemplo 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);
        }
Exemplo n.º 2
0
        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");
        }
Exemplo 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);
        }
Exemplo 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
                                        );
        }
Exemplo n.º 5
0
 public static void SetClick(ButtonBase attached, ShortcutName value)
 {
     attached.SetValue(ClickProperty, value);
 }
Exemplo n.º 6
0
 public static void SetFocus(Control attached, ShortcutName value)
 {
     attached.SetValue(FocusProperty, value);
 }
Exemplo n.º 7
0
        public bool UpdateKey(ShortcutName name, int key)
        {
            var info = GetKeyInfo(key);

            return(UpdateKey(name, info));
        }