/// <summary> /// 添加快捷键 /// </summary> /// <param name="keyType"></param> /// <param name="hotKey"></param> public void addHotKey(HotKeyType keyType, IHotKey hotKey) { if (!hotKeyDic.ContainsKey(keyType)) { hotKeyDic.Add(keyType, hotKey); } }
private void Save() { if (IsValid) { _hotKey = _editingHotKey; Closed(this); } }
public MainWindowViewModel(ISteamProxy steamProxy, IFilteredApplicationCategoryFactory applicationCategoryFactory, IHotKey hotKey) { _steamProxy = steamProxy; ApplicationCategories = applicationCategoryFactory.Build(); _hotKey = hotKey; //_hotKey.Enable(); _filter = string.Empty; }
public Host(IServiceProvider services, IServiceCollection pool, IAppBuilder appBuilder, ITerminationNotifier terminationNotifier, ITray tray, IHotKey hotkey, IQuickWindow window) { this.services = services; this.pool = pool; this.appBuilder = appBuilder; this.terminationNotifier = terminationNotifier; this.tray = tray; this.hotkey = hotkey; this.window = window; actions = new ObservableCollection <ActionBase>(); }
public bool Unregister(IHotKey hotKey) { if (hotKey == null) throw new ArgumentNullException("hotKey"); _hookRegistrationController.Unregister(hotKey); if (UnregisterHotKey(hotKey.HookPointer, hotKey.Id) == 0) GenerateException("unregister", hotKey); return true; }
private void OnHotKeyPressed(IHotKey sender, int hotkeyid) { if (window.IsVisible) { window.HideWindow(); return; } pool.EnterScope(); IProgramContext context = services.GetService <IProgramContext>(); window.ClearInput(); window.ShowWindow(context); }
public IHost Build() { string log = ""; if (services.TryGetService <IHotKeyBuilder>(out IHotKeyBuilder hotkeyBuilder) == false) { log += "hotkey not configured"; MessageBox.Show(log); } IHotKey hotkey = hotkeyBuilder.Build(); pool.Remove(pool.GetDescriptor <IHotKeyBuilder>()); pool.Add(ServiceDescriptor.Singleton <IHotKey>(hotkey)); return(services.CreateInstance <Host>()); }
public IEnumerator Process(LanotaliumContext context) { InterfaceCreatorManager creator = new InterfaceCreatorManager(); InterfaceHotKeyManager hotkey = new InterfaceHotKeyManager(); //Load Menu Associated plugins foreach (var file in Directory.GetFiles(Application.dataPath + "/StreamingAssets/Plugins")) { Assembly assembly = Assembly.LoadFrom(file); Type[] types = assembly.GetTypes(); foreach (var type in types) { //Creator Buttons if (type.GetInterface("ICreatorButton") != null) { ICreatorButton button = Activator.CreateInstance(type) as ICreatorButton; creator.AddButton(button); } else if (type.GetInterface("ICreatorButtonHotKey") != null) { ICreatorButtonHotKey button = Activator.CreateInstance(type) as ICreatorButtonHotKey; creator.AddButton(button); } else if (type.GetInterface("ICreatorButtonNumber") != null) { ICreatorButtonNumber button = Activator.CreateInstance(type) as ICreatorButtonNumber; creator.AddButton(button); } if (type.GetInterface("IHotKey") != null) { IHotKey key = Activator.CreateInstance(type) as IHotKey; } creator.UpdateUI(); } } while (true) { yield return(null); } }
private void GenerateException(string action, IHotKey hotKey) { var errorCode = Marshal.GetLastWin32Error(); if (errorCode != 0) { try { Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); } catch (Exception ex) { throw new Exception(string.Format("An error occurred while attempting to {0} the hot key {1}.", action, hotKey.ToString()), ex); } } }
//======================================================================================== // Handlers //======================================================================================== #region Commands and Handlers private void ExecuteHotKeyAction(IHotKey key) { switch (key.Action) { case HotKeyAction.PlayPause: DoPlayPause(null, null); break; case HotKeyAction.NextTrack: DoNextTrack(null, null); break; case HotKeyAction.PrevTrack: DoPrevTrack(null, null); break; case HotKeyAction.VolumeUp: DoVolumeUp(null, null); break; case HotKeyAction.VolumeDown: DoVolumeDown(null, null); break; case HotKeyAction.Mute: DoToggleMute(null, null); break; case HotKeyAction.ShowiTunes: DoShowiTunes(null, null); break; case HotKeyAction.ShowiTuner: DoShowiTuner(null, null); break; case HotKeyAction.ShowLyrics: DoShowLyrics(null, null); break; } }
public int Register(IHotKey hotKey) { if (hotKey == null) throw new ArgumentNullException("hotKey"); var assignedId = hotKey.Id; if (hotKey.Key != Keys.None) { if (assignedId == 0) assignedId = IncrementHotKeyId(); _hookRegistrationController.Register(hotKey); if (RegisterHotKey(hotKey.HookPointer, assignedId, (uint)hotKey.Modifiers, Keys.None) == 0 && Marshal.GetLastWin32Error() != ERROR_HOTKEY_ALREADY_REGISTERED) GenerateException("register", hotKey); } return assignedId; }
public SettingsViewModel(IHotKey hotKey) { _hotKey = hotKey; _editingHotKey = _hotKey; Validate(); }
public void RegisterHotKey(IHotKey hotkey, KeyCode key1, KeyCode key2 = 0, KeyCode key3 = 0) { }