Exemplo n.º 1
0
 public OSLevelHotkeyRegister(IUISynchronizer synchronizer)
 {
     _synchronizer = synchronizer;
     _synchronizer.RunSync(() => // all operations on hotkeys need to run on the same thread
                           _hiddenWindow = new KeyboardHookWindow(OnHotkey)
                           );
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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());
        }
Exemplo n.º 4
0
 public void Dispose()
 {
     _synchronizer?.RunSync(() => global::Gobchat.UI.Web.CEFManager.Dispose());
     _synchronizer = null;
 }