public HotKeyManager Initialize(ConfigurationServiceBase cfgSvc, IKeyboardHookService kbHookSvc) { _cfgSvc = cfgSvc; _kbHookSvc = kbHookSvc; if (_cfgSvc == null) { throw new InvalidOperationException($"_cfgSvc cannot be null during {nameof(HotKeyManager)} initialization"); } if (_config != null) { throw new InvalidOperationException($"{nameof(HotKeyManager)} is already initialized"); } _config = _cfgSvc.Load <HotKeyCfg>().Result ?? new HotKeyCfg(); foreach (var kvp in _config.HotKeyMap) { if (_userHotKeyMap.Reverse.ContainsKey(kvp.Value) == false) { _userHotKeyMap[kvp.Key] = kvp.Value; } } return(this); }
public HotKeyManager Initialize() { if (Svc.Configuration == null) { throw new InvalidOperationException($"Svc.Configuration cannot be null during {nameof(HotKeyManager)} initialization"); } if (_config != null) { throw new InvalidOperationException($"{nameof(HotKeyManager)} is already initialized"); } _config = Svc.Configuration.Load <HotKeyCfg>().Result ?? new HotKeyCfg(); foreach (var kvp in _config.HotKeyMap) { if (_userHotKeyMap.Reverse.ContainsKey(kvp.Value) == false) { _userHotKeyMap[kvp.Key] = kvp.Value; } } return(this); }