public OSLevelHotkeyRegister(IUISynchronizer synchronizer) { _synchronizer = synchronizer; _synchronizer.RunSync(() => // all operations on hotkeys need to run on the same thread _hiddenWindow = new KeyboardHookWindow(OnHotkey) ); }
private void RegisterHotKey(int id, ModifierKeys modifier, Keys key) { int errorCode = 0; _synchronizer.RunSync(() => { if (!RegisterHotKey(_hiddenWindow.Handle, id, fsModifiers: (uint)modifier | MOD_NOREPEAT, vk: (uint)key)) { errorCode = Marshal.GetLastWin32Error(); } }); if (errorCode != 0) { var exception = new System.ComponentModel.Win32Exception(errorCode); throw new HotkeyRegisterException(errorCode, $"{modifier}-{key}", exception); } }
public void Initialize(ApplicationStartupHandler handler, IDIContext container) { #if DEBUG var cefFolder = GobchatContext.ApplicationLocation; #else var cefFolder = System.IO.Path.Combine(GobchatContext.ApplicationLocation, "libs", "cef"); #endif System.IO.Directory.CreateDirectory(cefFolder); CEFManager.CefAssemblyLocation = cefFolder; _synchronizer = container.Resolve <IUISynchronizer>(); _synchronizer.RunSync(() => global::Gobchat.UI.Web.CEFManager.Initialize()); }
public void Dispose() { _synchronizer?.RunSync(() => global::Gobchat.UI.Web.CEFManager.Dispose()); _synchronizer = null; }