public Toggler(Process _process, Config _config) { process = _process; config = _config; // Hide from taskbar User32.SetWindowLong(process.MainWindowHandle, User32.GWL_EX_STYLE, (User32.GetWindowLong(process.MainWindowHandle, User32.GWL_EX_STYLE) | User32.WS_EX_TOOLWINDOW) & ~User32.WS_EX_APPWINDOW); if (config.Maximize) { User32.ShowWindow(process.MainWindowHandle, NCmdShow.MAXIMIZE); } User32.Rect rect = default; User32.GetWindowRect(process.MainWindowHandle, ref rect); var terminalWindow = new TerminalWindow(rect, GetScreenWithCursor().Bounds); if (config.Center) { terminalWindow.CenterHorizontally(); } terminalWindow.EnsureVisible(); if (config.Width == 0 || config.Height == 0) { SaveTerminalState(terminalWindow); } else { RestoreTerminalState(terminalWindow); } User32.MoveWindow(_process.MainWindowHandle, terminalWindow.ScreenX, terminalWindow.ScreenY, terminalWindow.Width, terminalWindow.Height, true); User32.ShowWindow(_process.MainWindowHandle, NCmdShow.SHOW); User32.SetForegroundWindow(_process.MainWindowHandle); HotKeyManager.RegisterHotKey(Keys.Oemtilde, KeyModifiers.Control); HotKeyManager.RegisterHotKey(Keys.Q, KeyModifiers.Control); HotKeyManager.HotKeyPressed += handleHotKeyPressed; }
static void Main(string[] args) { using (System.Diagnostics.Process p = new System.Diagnostics.Process()) { //Set Window Title Based on Current if Value is currently in use or not while (WinGetHandle(GetCurrentWindowTitle()) != IntPtr.Zero) { windowTitleNum++; } p.StartInfo = new System.Diagnostics.ProcessStartInfo() { FileName = @"eqgame.exe", Arguments = @"patchme", WorkingDirectory = System.Configuration.ConfigurationManager.AppSettings["EqDirectory"] }; string window_title = GetCurrentWindowTitle(); //Set HotKey Based on Window Number if (GetHotkey() != Keys.None) { HotKeyManager.RegisterHotKey(GetHotkey(), GetKeyMod()); HotKeyManager.HotKeyPressed += new EventHandler <HotKeyEventArgs>(HotKeyManager_HotKeyPressed); } p.Start(); System.Threading.SpinWait.SpinUntil(() => p.HasExited || p.MainWindowHandle != IntPtr.Zero); windowHandle = p.MainWindowHandle; while (!p.HasExited) { p.Refresh(); if (p.MainWindowTitle != GetCurrentWindowTitle()) { SetWindowText(p.MainWindowHandle, window_title); } Thread.Sleep(100); } p.WaitForExit(); } }
protected override void OnApplicationTick(float dt) { if (Campaign.Current != null) { var test = HotKeyManager.GetAllCategories().First().RegisteredGameKeys; if (Campaign.Current.CurrentMenuContext != null && (!Campaign.Current.CurrentMenuContext.GameMenu.IsWaitActive || Campaign.Current.TimeControlModeLock)) { return; } if (Input.IsKeyReleased(InputKey.D4)) { Campaign.Current.SpeedUpMultiplier = Support.settings.extra_fast_forward_speed; Campaign.Current.SetTimeSpeed(2); } if (Input.IsKeyReleased(InputKey.D3)) { Campaign.Current.SpeedUpMultiplier = Support.settings.fast_forward_speed; } if (Input.IsKeyDown(InputKey.LeftControl) && Input.IsKeyDown(InputKey.Space)) { if (Campaign.Current.SpeedUpMultiplier != Support.settings.ctrl_space_speed) { currentSpeed = Campaign.Current.SpeedUpMultiplier; currentTimeMode = Campaign.Current.TimeControlMode; timeSpedUp = true; } Campaign.Current.SpeedUpMultiplier = Support.settings.ctrl_space_speed; Campaign.Current.SetTimeSpeed(2); } else if (timeSpedUp) { timeSpedUp = false; Campaign.Current.SpeedUpMultiplier = currentSpeed; Campaign.Current.TimeControlMode = currentTimeMode; } } }
private bool Close() { RecordingState state = this.recorder.State; bool result = false; switch (state) { case RecordingState.Idle: result = true; break; case RecordingState.Preparing: break; case RecordingState.Paused: case RecordingState.Recording: result = this.view.ShowStopMessage(); if (result) { this.recorder.Stop(); } break; } if (result) { this.view.AllowUpdate = false; if (this.hotKeyManager != null) { this.hotKeyManager.Dispose(); this.hotKeyManager = null; } try { this.configuration.Save(); } catch (ConfigurationException ce) { Trace.TraceError(ce.ToString()); } } return(result); }
private void ApplicationStartup(object sender, StartupEventArgs e) { Log.Information("Started Catapult."); if (!Directory.Exists(CatapultPaths.DataPath)) { Directory.CreateDirectory(CatapultPaths.DataPath); } var loader = new JsonConfigLoader(); var configuration = loader.LoadUserConfig(CatapultPaths.ConfigPath); loader.SaveUserConfig(configuration, CatapultPaths.ConfigPath); Task.Factory.StartNew(() => { SearchResources.SetConfig(configuration); SearchResources.GetFiles(); }); _taskbarIcon = (TaskbarIcon)FindResource("MyNotifyIcon"); InitializeTaskBarIcon(_taskbarIcon); _hotKeyManager = new HotKeyManager(); RegisterHotKey(Key.Space, configuration.UseControlKey ? ModifierKeys.Control : ModifierKeys.Alt); _mainWindow = new MainWindow(); _mainWindow.IsVisibleChanged += _mainWindow_IsVisibleChanged; if (Program.UseSingleLaunchMode) { ToggleMainWindow(); } SquirrelIntegration.Instance.StartPeriodicUpdateCheck(); }
public void HotKeyManager_Should_Do_Not_Executed_When_IsEnabled_False(string factoryName, Factory factory) { using (AvaloniaLocator.EnterScope()) { var styler = new Mock <Styler>(); var target = new KeyboardDevice(); var isExecuted = false; AvaloniaLocator.CurrentMutable .Bind <IWindowingPlatform>().ToConstant(new WindowingPlatformMock()) .Bind <IStyler>().ToConstant(styler.Object); var gesture = new KeyGesture(Key.A, KeyModifiers.Control); var action = new Action <object>(parameter => { isExecuted = true; }); var root = new Window(); var element = factory(0, action, root) as InputElement; element.IsEnabled = false; root.Template = CreateWindowTemplate(); root.ApplyTemplate(); root.Presenter.ApplyTemplate(); HotKeyManager.SetHotKey(element, gesture); target.ProcessRawEvent(new RawKeyEventArgs(target, 0, root, RawKeyEventType.KeyDown, Key.A, RawInputModifiers.Control)); Assert.True(isExecuted == false, $"{factoryName} Execution raised when IsEnabled is false."); } }
protected override void OnInitialize() { base.OnInitialize(); _spriteCategory = UIResourceManager.SpriteData.SpriteCategories["ui_options"]; _spriteCategory.Load(UIResourceManager.ResourceContext, UIResourceManager.UIResourceDepot); _optionsVm = new OptionsVM(true, false, OnKeyBindRequest); _dataSource = new CustomOptionsViewModel(_optionsVm) { ModOptions = new CustomOptionCategoryViewModel(_optionsVm, "ModOptions".Localized(), OptionsStore.GetRegisteredForGui() .SelectMany(store => GenerateOptionDataViewModels(store.GetKnownOptions()))) }; _gauntletLayer = new GauntletLayer(4000); _gauntletMovie = _gauntletLayer.LoadMovie("CustomOptions", _dataSource); _gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericPanelGameKeyCategory")); _gauntletLayer.InputRestrictions.SetInputRestrictions(); _gauntletLayer.IsFocusLayer = true; _keyBindingPopup = new KeybindingPopup(SetHotKey, this); AddLayer(_gauntletLayer); ScreenManager.TrySetFocus(_gauntletLayer); }
void InitScopedMenu(IEnumerable <AMenuItem> items, bool pageUp, bool pageDown) { UnregisterMenu(); IEnumerable <AMenuItem> itemsToShow = items.ToArray(); List <Guid> registeredKeys = new List <Guid>(); if (pageUp) { itemsToShow = itemsToShow.Concat(new AMenuItem[] { new PlaceboItem() { Caption = "PgUp. Prev Page" } }); var keyId = HotKeyManager.RegisterHotKey(Keys.PageUp, KeyModifiers.None, HandleHotkey); registeredKeys.Add(keyId); } if (pageDown) { itemsToShow = itemsToShow.Concat(new AMenuItem[] { new PlaceboItem() { Caption = "PgDown. Next Page" } }); var keyId = HotKeyManager.RegisterHotKey(Keys.PageDown, KeyModifiers.None, HandleHotkey); registeredKeys.Add(keyId); } mGlMenu = new glMenu(itemsToShow); int current = 1; foreach (var item in items) { var keyId = HotKeyManager.RegisterHotKey((Keys)(Keys.D0 + current), KeyModifiers.None, HandleHotkey); registeredKeys.Add(keyId); current++; } mHotkeyIds = registeredKeys; }
protected override void OnInitialize() { base.OnInitialize(); var spriteData = UIResourceManager.SpriteData; var resourceContext = UIResourceManager.ResourceContext; var uiresourceDepot = UIResourceManager.UIResourceDepot; _spriteCategoryOptions = spriteData.SpriteCategories["ui_options"]; _spriteCategoryOptions.Load(resourceContext, uiresourceDepot); _spriteCategoryEncyclopedia = spriteData.SpriteCategories["ui_encyclopedia"]; _spriteCategoryEncyclopedia.Load(resourceContext, uiresourceDepot); _dataSource = new OptionsModOptionsViewModel(new OptionsVM(true, false, OnKeybindRequest), new ModOptionsVM()); _gauntletLayer = new GauntletLayer(4000, "GauntletLayer"); _gauntletMovie = _gauntletLayer.LoadMovie("OptionsWithModOptionsView_v3", _dataSource); _gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericPanelGameKeyCategory")); _gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All); _gauntletLayer.IsFocusLayer = true; _keybindingPopup = new KeybindingPopup(SetHotKey, this); AddLayer(_gauntletLayer); ScreenManager.TrySetFocus(_gauntletLayer); Utilities.SetForceVsync(true); }
protected override void OnInitialize() { UIResourceManager.SpriteData.SpriteCategories["ui_inventory"].Load((ITwoDimensionResourceContext)UIResourceManager.ResourceContext, UIResourceManager.UIResourceDepot); InventoryLogic inventoryLogic = this._inventoryState.InventoryLogic; Mission current = Mission.Current; int num = current != null ? (current.DoesMissionRequireCivilianEquipment ? 1 : 0) : 0; Func <WeaponComponentData, ItemObject.ItemUsageSetFlags> getItemUsageSetFlags = new Func <WeaponComponentData, ItemObject.ItemUsageSetFlags>(this.GetItemUsageSetFlag); string stackShortcutkeyText = this.GetFiveStackShortcutkeyText(); this._dataSource = new SPInventoryVM(inventoryLogic, num != 0, getItemUsageSetFlags, stackShortcutkeyText); GauntletLayer gauntletLayer = new GauntletLayer(15, "GauntletLayer"); gauntletLayer.IsFocusLayer = true; this._gauntletLayer = gauntletLayer; this._gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All); this.AddLayer((ScreenLayer)this._gauntletLayer); ScreenManager.TrySetFocus((ScreenLayer)this._gauntletLayer); this._gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("InventoryHotKeyCategory")); this._gauntletMovie = this._gauntletLayer.LoadMovie("Inventory", (ViewModel)this._dataSource); this._openedFromMission = this._inventoryState.Predecessor is MissionState; InformationManager.ClearAllMessages(); }
protected override void OnInitialize() { base.OnInitialize(); var spriteData = UIResourceManager.SpriteData; var resourceContext = UIResourceManager.ResourceContext; var uiresourceDepot = UIResourceManager.UIResourceDepot; _spriteCategoryEncyclopedia = spriteData.SpriteCategories["ui_encyclopedia"]; _spriteCategoryEncyclopedia.Load(resourceContext, uiresourceDepot); _dataSource = new ModOptionsVM(); if (GauntletLayerUtils.Create(4000, "GauntletLayer") is { } gauntletLayer) { _gauntletLayer = gauntletLayer; _gauntletMovie = LoadMovie is not null?LoadMovie(_gauntletLayer, "ModOptionsView_MCM", _dataSource) : null; _gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericPanelGameKeyCategory")); _gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All); _gauntletLayer.IsFocusLayer = true; AddLayer(_gauntletLayer); ScreenManager.TrySetFocus(_gauntletLayer); } }
public Toggler() { // Hide from taskbar User32.SetWindowLong(_process.MainWindowHandle, User32.GWL_EX_STYLE, (User32.GetWindowLong(_process.MainWindowHandle, User32.GWL_EX_STYLE) | User32.WS_EX_TOOLWINDOW) & ~User32.WS_EX_APPWINDOW); User32.Rect rect = default; User32.ShowWindow(_process.MainWindowHandle, NCmdShow.MAXIMIZE); var isOpen = true; // Register hotkeys Settings.Get(s => { _registeredHotKeys.ForEach(hk => HotKeyManager.UnregisterHotKey(hk)); _registeredHotKeys.Clear(); s.Hotkeys.ForEach(hk => { Log.Information($"Registering hot key {hk.Modifiers} + {hk.Key}"); var reg = HotKeyManager.RegisterHotKey(hk.Key, hk.Modifiers); _registeredHotKeys.Add(reg); }); }); FocusTracker.OnFocusLost += (s, a) => { if (Settings.Instance.HideOnFocusLost && isOpen) { isOpen = false; Toggle(false, 0); } }; HotKeyManager.HotKeyPressed += (s, a) => { Toggle(!isOpen, Settings.Instance.ToggleDurationMs); isOpen = !isOpen; }; }
private void setupPostInit() { // set initial DPI. We do it here so that we get the correct value when DPI has changed since initial user logon to the system. if (Screen.Primary) { Shell.DpiScale = PresentationSource.FromVisual(Application.Current.MainWindow).CompositionTarget.TransformToDevice.M11; } this.dpiScale = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice.M11; setPosition(); appbarMessageId = AppBarHelper.RegisterBar(this, Screen, this.ActualWidth * dpiScale, this.ActualHeight * dpiScale, AppBarHelper.ABEdge.ABE_TOP); Shell.HideWindowFromTasks(handle); if (Settings.EnableCairoMenuHotKey && Screen.Primary && !isCairoMenuHotkeyRegistered) { HotKeyManager.RegisterHotKey(Settings.CairoMenuHotKey, OnShowCairoMenu); isCairoMenuHotkeyRegistered = true; } // Register Windows key to open Programs menu if (Startup.IsCairoUserShell && Screen.Primary && !isProgramsMenuHotkeyRegistered) { HotKeyManager.RegisterHotKey(new List <string> { "Win", "LWin" }, OnShowProgramsMenu); HotKeyManager.RegisterHotKey(new List <string> { "Win", "RWin" }, OnShowProgramsMenu); isProgramsMenuHotkeyRegistered = true; } if (Settings.EnableMenuBarBlur) { Shell.EnableWindowBlur(handle); } }
public void SetGlobalHotkey() { ModifierKeys modifier = ModifierShift.Value ? ModifierKeys.Shift : ModifierKeys.None; modifier |= ModifierAlt.Value ? ModifierKeys.Alt : ModifierKeys.None; modifier |= ModifierCtrl.Value ? ModifierKeys.Control : ModifierKeys.None; modifier |= ModifierWindows.Value ? ModifierKeys.Windows : ModifierKeys.None; if (Enum.TryParse <Key>(ShortcutKey.Value, out Key key)) { if (HotKeyManager.RegisterHotKey(modifier, key)) { GHKeyString.Value = HotKeyManager.GetGHKeyString(); Message.Value = "ショートカットキーを更新しました"; } } else { Message.Value = "キーの記述が不正です。"; } }
void IGameStateListener.OnActivate() { base.OnActivate(); //Configure ScreenLayer this._sceneLayer = new SceneLayer(); this._sceneLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericCampaignPanelsGameKeyCategory")); this.AddLayer((ScreenLayer)this._sceneLayer); //this._sceneLayer.SetScene(Mission.Current.Scene); //Configure Camera this._camera = Camera.CreateCamera(); this._camera.SetViewVolume(true, -0.1f, 0.1f, -0.07f, 0.07f, 0.2f, 300f); this._camera.Position = new Vec3(0.0f, 0.0f, 10f, -1f); this._cameraBearing = 0.0f; this._cameraElevation = 1f; this._cameraDistance = 2.5f; //Configure MouseRay this._mouseRay = new Ray(Vec3.Zero, Vec3.Up, float.MaxValue); }
public MainViewModel(Settings Settings, ILocalizationProvider Loc, HotKeyManager HotKeyManager, IPreviewWindow PreviewWindow, IDialogService DialogService, RecordingModel RecordingModel, IEnumerable <IRefreshable> Refreshables, IFFmpegViewsProvider FFmpegViewsProvider) : base(Settings, Loc) { _dialogService = DialogService; ShowPreviewCommand = new DelegateCommand(PreviewWindow.Show); SelectFFmpegFolderCommand = new DelegateCommand(FFmpegViewsProvider.PickFolder); #region Commands RefreshCommand = RecordingModel .ObserveProperty(M => M.RecorderState) .Select(M => M == RecorderState.NotRecording) .ToReactiveCommand() .WithSubscribe(() => { foreach (var refreshable in Refreshables) { refreshable.Refresh(); } Refreshed?.Invoke(); }); OpenOutputFolderCommand = new DelegateCommand(OpenOutputFolder); SelectOutputFolderCommand = new DelegateCommand(SelectOutputFolder); ResetFFmpegFolderCommand = new DelegateCommand(() => Settings.FFmpeg.FolderPath = ""); TrayLeftClickCommand = new DelegateCommand(() => HotKeyManager.FakeHotkey(Settings.Tray.LeftClickAction)); #endregion }
private void InitializeHotKeys() { _hotKeyManager = new HotKeyManager(); _nipGenerator = new NipGenerator(); _peselGenerator = new PeselGenerator(); _hotKeyManager.RegisterHotKey( KeyModifier.NotSet, Keys.F7, () => { string newNip = _nipGenerator.Generate(); SendKeys.SendWait(newNip); AddNipNumberToHistory(newNip); }); _hotKeyManager.RegisterHotKey( KeyModifier.NotSet, Keys.F8, () => { string newPesel = _peselGenerator.Generate(); SendKeys.SendWait(newPesel); AddPeselNumberToHistory(newPesel); }); _hotKeyManager.RegisterHotKey( KeyModifier.NotSet, Keys.F9, () => { if (!this.IsActive) { this.Visibility = Visibility.Visible; this.Activate(); } }); }
private void UpdateHotkey(object sender, EventArgs e) { var modifier = (KeyModifiers)0; if (this.controlCheckbox.Checked) { modifier |= KeyModifiers.Control; } if (this.altCheckbox.Checked) { modifier |= KeyModifiers.Alt; } if (this.shiftCheckbox.Checked) { modifier |= KeyModifiers.Shift; } int?key = null; if (Enum.TryParse <Keys>(this.hotkeyComboBox.SelectedItem as string, true, out var value)) { key = (int)value; } Settings.Save(bookmarkModifiers: (int)modifier, bookmarkHotkey: key); if (this.hotkey != null) { HotKeyManager.UnregisterHotKey(this.hotkey.Value); } if (key != null) { this.hotkey = HotKeyManager.RegisterHotKey((Keys)key.Value, modifier); } }
public override void Load() { _uic.HideFromTaskbar(true); _uic.Opacity = .9f; Maximize(); // Toggle on Alt-Space HotKeyManager.RegisterHotKey(Settings.ToggleUIKey, Settings.ToggleUIKeyModifiers); HotKeyManager.HotKeyPressed += (s, a) => Toggle(); // Minimize on focus lost _uic.FocusGained += (s, a) => _log.Info("Gained focus"); _uic.FocusLost += (s, a) => { _log.Info("Lost focus"); Minimize(); }; // Background image if (!string.IsNullOrWhiteSpace(Settings.BackgroundImage)) { string bgImage = null; try { bgImage = Environment.ExpandEnvironmentVariables(Settings.BackgroundImage); _bg = Texture2D.FromStream(_uic.GraphicsDevice, File.OpenRead(bgImage)); } catch (Exception ex) { _log.Error($"Could not load background image at '{bgImage}': {ex.Message}.", ex); } } // TODO: Make configurable var style = ImGui.GetStyle(); style.Colors[(int)ImGuiCol.FrameBg] = new Vector4(.2f, .2f, .2f, .5f); style.Colors[(int)ImGuiCol.WindowBg] = new Vector4(0f, 0f, 0f, .8f); }
private void InitHotkeys() { HotKeyManager.AddHotKey(this, Kaydet, Keys.S, true, false, false); // register the hotkeys with the form HotKeyManager.AddHotKey(this, OpenSearch, Keys.F, true); HotKeyManager.AddHotKey(this, OpenFindDialog, Keys.F, true, false, true); HotKeyManager.AddHotKey(this, OpenReplaceDialog, Keys.R, true); HotKeyManager.AddHotKey(this, OpenReplaceDialog, Keys.H, true); HotKeyManager.AddHotKey(this, Uppercase, Keys.U, true); HotKeyManager.AddHotKey(this, Lowercase, Keys.L, true); HotKeyManager.AddHotKey(this, ZoomIn, Keys.Oemplus, true); HotKeyManager.AddHotKey(this, ZoomOut, Keys.OemMinus, true); HotKeyManager.AddHotKey(this, ZoomDefault, Keys.D0, true); HotKeyManager.AddHotKey(this, CloseSearch, Keys.Escape); // remove conflicting hotkeys from scintilla richTextBox1.ClearCmdKey(Keys.Control | Keys.F); richTextBox1.ClearCmdKey(Keys.Control | Keys.R); richTextBox1.ClearCmdKey(Keys.Control | Keys.H); richTextBox1.ClearCmdKey(Keys.Control | Keys.L); richTextBox1.ClearCmdKey(Keys.Control | Keys.U); }
public TataruModel(MainWindow mainWindow) { CmdArgsStatus.LoadArgs(); _MainWindow = mainWindow; _PropertyBinders = new List <PropertyBinder>(); _ChatWindows = new List <ChatWindow>(); _HotKeyManager = new HotKeyManager(UiWindow.Window); _SaveSettingsCancellationTokenSource = new CancellationTokenSource(); _WebTranslator = new WebTranslator(new LoggerWrapper()); _TataruUIModel = new TataruUIModel(); _FFMemoryReader = new FFMemoryReader(); _ChatProcessor = new ChatProcessor(_WebTranslator); _TataruViewModel = new TataruViewModel(this); }
public void Dispose() { SystemEvents.PowerModeChanged -= SystemEvents_PowerModeChanged; if (_hotkeys) { HotKeyManager.Dispose(); } AudioSource.Dispose(); RecentViewModel.Dispose(); // Remember things if not console. if (_persist) { CustomOverlays.Dispose(); Remember(); Settings.Save(); } }
private void InitHotkeys() { // register the hotkeys with the form //HotKeyManager.AddHotKey(form, OpenSearch, Keys.F, true); HotKeyManager.AddHotKey(Form, OpenFindDialog, Keys.F, true, false, true); HotKeyManager.AddHotKey(Form, OpenReplaceDialog, Keys.R, true); HotKeyManager.AddHotKey(Form, OpenReplaceDialog, Keys.H, true); HotKeyManager.AddHotKey(Form, Uppercase, Keys.U, true); HotKeyManager.AddHotKey(Form, SetIndentation, Keys.I, true); HotKeyManager.AddHotKey(Form, Lowercase, Keys.L, true); HotKeyManager.AddHotKey(Form, Lowercase, Keys.L, true); HotKeyManager.AddHotKey(Form, ZoomIn, Keys.Oemplus, true); HotKeyManager.AddHotKey(Form, ZoomOut, Keys.OemMinus, true); HotKeyManager.AddHotKey(Form, ZoomDefault, Keys.D0, true); //HotKeyManager.AddHotKey(this, CloseSearch, Keys.Escape); // remove conflicting hotkeys from scintilla TextArea.ClearCmdKey(Keys.Control | Keys.F); TextArea.ClearCmdKey(Keys.Control | Keys.R); TextArea.ClearCmdKey(Keys.Control | Keys.H); TextArea.ClearCmdKey(Keys.Control | Keys.L); TextArea.ClearCmdKey(Keys.Control | Keys.U); }
// Main entry point private void Application_Startup(object sender, StartupEventArgs e) { SettingsManager = new SettingsManager(new SettingsRepository(new ConfigSettings()), new SettingsManagerHelper()); HotKeyManager = new HotKeyManager(SettingsManager.UserSettings, new GlobalKeyboardHook()); HotKeyManager.TakeWholeScreenEvent += (o, args) => { Screenshot screenshot = new Screenshot(SettingsManager.UserSettings, new ScreenshotHelper()); screenshot.TakeScreenshot(); screenshot.SaveScreenshot(); }; HotKeyManager.TakeAndCropScreenEvent += (o, args) => { if (_screenshotWindow == null) { _screenshotWindow = new ScreenshotWindow(); _screenshotWindow.Show(); _screenshotWindow.Closing += ((sen, a) => _screenshotWindow = null); } }; }
public MameOrchestrator( Settings settings, GameList gameList, ScreenCloner screenCloner, ScreenManager screenManager, HotKeyManager hotKeyManager, PowerManager powerManager, BlankScreenFactory screenFactory, MameInvoker invoker, GamePlayManager gamePlayManager, MameScreen mameScreen) { _settings = settings; _gameList = gameList; _screenCloner = screenCloner; _screenManager = screenManager; _hotKeyManager = hotKeyManager; _powerManager = powerManager; _screenFactory = screenFactory; _invoker = invoker; _gamePlayManager = gamePlayManager; _mameScreen = mameScreen; }
private void btnAdd_Click(object sender, EventArgs e) { if (_mode == HotKeyFormMode.Normal && HotKeyManager.DuplicateHotKey(_hotkey)) { return; } if (_mode == HotKeyFormMode.Edit) { HotKeyManager.DeleteHotKey(_linkedHotKey); } //Add HK if (HotKeyManager.AddHotKey(_hotkey)) { DialogResult = DialogResult.OK; Close(); } else { errorProvider1.SetError(txtHotKey, "Hot Key is already registered"); } }
public MainModel(Settings Settings, IWebCamProvider WebCamProvider, VideoWritersViewModel VideoWritersViewModel, AudioSource AudioSource, HotKeyManager HotKeyManager, RememberByName RememberByName) { _settings = Settings; _webCamProvider = WebCamProvider; _videoWritersViewModel = VideoWritersViewModel; _audioSource = AudioSource; _hotKeyManager = HotKeyManager; _rememberByName = RememberByName; // If Output Dircetory is not set. Set it to Documents\Captura\ if (string.IsNullOrWhiteSpace(Settings.OutPath)) { Settings.OutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Captura"); } // Create the Output Directory if it does not exist Settings.EnsureOutPath(); }
public Form1() { InitializeComponent(); handleChangedNumber(); closeToTray = true; _rightHotkey = new HotKeyManager(); _rightHotkey.KeyPressed += RightKeyManagerPressed; _leftHotkey = new HotKeyManager(); _leftHotkey.KeyPressed += LeftKeyManagerPressed; VirtualDesktop.CurrentChanged += VirtualDesktop_CurrentChanged; VirtualDesktop.Created += VirtualDesktop_Added; VirtualDesktop.Destroyed += VirtualDesktop_Destroyed; this.FormClosing += Form1_FormClosing; useAltKeySettings = Properties.Settings.Default.AltHotKey; checkBox1.Checked = useAltKeySettings; }
public MainWindow() { InitializeComponent(); // Initialize the hotkey manager hkManager = new HotKeyManager(); // set the solo public hotkey to CTRL + ALT + L soloPublicKey = hkManager.Register(Key.L, System.Windows.Input.ModifierKeys.Control); // set the ANTI-AFK hotkey to CTRL + ALT + F1 afkKey = hkManager.Register(Key.F1, System.Windows.Input.ModifierKeys.Control); // Adding the medthod to call when the hotkeys are pressed. hkManager.KeyPressed += HkManager_KeyPressed; // This initialize a thread that is moving to mouse cursor(Used in ANTI-AFK) MouseThread = new Thread(new ThreadStart(MouseThreadFunction)); SoloPublicThread = new Thread(new ThreadStart(SoloPublicThreadMethod)); }
void IPlugin.OnUpdate() { if (!this.areHotkeysRegistered && User32.IsHearthstoneInForeground()) { foreach (KeyValuePair <HotKey, Action> keyCommand in this.keyCommands) { HotKeyManager.RegisterHotkey(keyCommand.Key, keyCommand.Value, keyCommand.Key.Key.ToString()); } this.areHotkeysRegistered = true; } else if (this.areHotkeysRegistered && !User32.IsHearthstoneInForeground()) { //hotkeys are registered, but hearthstone isn't active. unregister them. foreach (KeyValuePair <HotKey, Action> keyCommand in this.keyCommands) { HotKeyManager.RemovePredefinedHotkey(keyCommand.Key); } this.areHotkeysRegistered = false; } }
private void SetupHotKey() { _hkm = new HotKeyManager(); _hkm.Register(Keys.K, HotKeyModifier.Windows, 100, Handler); _atLaunch = true; }
public void TestInitialize() { manager = new HotKeyManager(); }