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"); }
public string GetShortcutString(ShortcutName name) { foreach (var item in _keys) { if (item.Value == name) { return(item.Key.ToString(KeyToString)); } } return(string.Empty); }
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 ); }
public static void SetClick(ButtonBase attached, ShortcutName value) { attached.SetValue(ClickProperty, value); }
public static void SetFocus(Control attached, ShortcutName value) { attached.SetValue(FocusProperty, value); }
public bool UpdateKey(ShortcutName name, int key) { var info = GetKeyInfo(key); return(UpdateKey(name, info)); }