public virtual void OnKeyReleased(KeyPressedEventArgs e) { if (KeyReleased != null) { KeyReleased(this, e); } }
private void Refactor_SplitString_KeyPressed(KeyPressedEventArgs ea) { if (this.settings.SmartEnterSplitString && ea.IsEnter && !ea.ShiftKeyDown && !ea.AltKeyDown && !ea.CtrlKeyDown) { TextViewCaret caret = GetCaretInActiveFocusedView(); if (caret != null) { CodeRush.Source.ParseIfTextChanged(); if (CodeRush.Caret.InsideString && CaretInCodeEditor()) { CodeRush.SmartTags.UpdateContext(); RefactoringProviderBase splitString = CodeRush.Refactoring.Get("Split String"); if (splitString != null && IsRefactoringAvailable(splitString)) { splitString.Execute(); if (this.settings.LeaveConcatenationOperatorAtTheEndOfLine) { caret.MoveRight(1); } caret.Insert(CodeRush.Language.LineContinuationCharacter, true); return; } } } } }
void EventNexus_KeyPressed(KeyPressedEventArgs ea) { // Exit if key is not Delete or Ctrl+X (Clipboard Cut). if (!ea.IsDelete && !(ea.KeyCode == (int)Keys.X && ea.CtrlKeyDown) && !(ea.KeyCode == (int)Keys.Back) && !KeyIsVisible(ea)) return; // Exit if we have no Active Document. TextDocument ActiveDoc = CodeRush.Documents.ActiveTextDocument; if (ActiveDoc == null) return; // Exit if Editor does not have focus. if (!CodeRush.Editor.HasFocus) return; // Exit if Selection does not contain collapsed code. if (!SelectionContainsCollapsedCode()) return; // All criteria met. Eat Key. ea.EatKey(); }
private void HookKeyPressed(object sender, KeyPressedEventArgs e) { foreach (var key in _keyList) if (e.Key == key) HighlightHeater(_keyList.IndexOf(key) + 1); if (e.Key == Keys.Tab) return; #region // /* case Keys.Up: // if (ActiveControl.GetType() == typeof(OmronEdit.OmronEdit)) // { // var oedit = (OmronEdit.OmronEdit) ActiveControl; // oedit.FieldUp.Focus(); // } // break; // case Keys.Down: // if (ActiveControl.GetType() == typeof(OmronEdit.OmronEdit)) // { // var oedit = (OmronEdit.OmronEdit)ActiveControl; // oedit.FieldDown.Focus(); // } // break; //*/ // } #endregion Obsolete code }
private bool KeyIsVisible(KeyPressedEventArgs ea) { if (ea.CtrlKeyDown || ea.AltKeyDown) { // Return false since ctrl and alt modifiers prevent printing. return false; } bool KeyIsNumber = ea.KeyCode >= 0x30 && ea.KeyCode <= 0x39; bool KeyIsLetter = ea.KeyCode >= 0x41 && ea.KeyCode <= 0x5a; bool KeyIsPunctuation = ea.KeyCode >= 186 && ea.KeyCode <= 222; return (KeyIsNumber || KeyIsLetter || KeyIsPunctuation); }
void hook_KeyPressed(object sender, KeyPressedEventArgs e) { // show the keys pressed in a label. print("hotkey pressed"); try { if (configFile.games[currentGameI].process != null){ if (!configFile.games[currentGameI].process.CloseMainWindow()){ configFile.games[currentGameI].process.Kill(); } configFile.games[currentGameI].process.Close(); configFile.games[currentGameI].OnGameExited(); } } catch (Exception err) { } }
private void Input_OnKeyPressed(object sender, KeyPressedEventArgs e) { KeyStroke stroke = KeyStroke.KeyboardStroke(e.Key); if (isAwaitingNormalKey || isAwaitingSwitchedKey) { bool isNormal = isAwaitingNormalKey; BindingList <KeyStroke> keyList = isNormal ? normalKeys : switchedKeys; if (e.State == KeyState.Down && !keyList.Contains(stroke)) { this.Invoke((MethodInvoker) delegate { keyList.Add(stroke); saveSettings(); }); isAwaitingSwitchedKey = false; isAwaitingNormalKey = false; } return; } else if (isAwaitingEditKey && e.State == KeyState.Down) { editKey = stroke; this.Invoke((MethodInvoker) delegate { btnEditKey.Text = editKey.ToString(); saveSettings(); }); isAwaitingEditKey = false; return; } if (enableEditKey && editKey != null && stroke.Equals(editKey)) { if (waitingEditKeyRelease) { if (e.State == KeyState.Up) { waitingEditKeyRelease = false; } return; } if (!isMouseSpeedSwitched) { isMouseSpeedSwitched = true; enteredSwitchUsingEditkey = true; } else { if (enteredSwitchUsingEditkey) { isMouseSpeedSwitched = false; } } waitingEditKeyRelease = true; return; } bool switchContained = switchedKeys.Contains(stroke); bool normalContained = normalKeys.Contains(stroke); if (switchContained || normalContained) { if (!isAwaitingRelease && e.State == KeyState.Down) { isMouseSpeedSwitched = switchContained && normalContained ? !isMouseSpeedSwitched : switchContained; enteredSwitchUsingEditkey = false; } else if (isAwaitingRelease && e.State == KeyState.Up) { isAwaitingRelease = false; } } }
void EverythingHook_KeyPressed(object sender, KeyPressedEventArgs e) { var printscreen = Helpers.GetAllMonitorsScreenshot(); SaveToClipboard(printscreen); }
public void ShowHide(object sender, KeyPressedEventArgs e) { ShowHide(); }
void hook_KeyPressed(object sender, KeyPressedEventArgs e) { }
void hook_KeyPressed( object sender, KeyPressedEventArgs e ) { if ( OnHotKeyPressed != null ) OnHotKeyPressed( this, e ); }
void hook_KeyPressed(object sender, KeyPressedEventArgs e) { switch (e.Key.ToString()) { case "MediaPlayPause": playerExecute("play-pause"); break; case "MediaNextTrack": playerExecute("play-next"); break; case "MediaPreviousTrack": playerExecute("play-prev"); break; } uint KeyAsInt = (uint)(e.Key | hook.keyToModifierKey(e.Modifier)); if (KeyAsInt == Properties.Settings.Default.hotkeyPlay) { htmlClickOn("#play-pause"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyNext) { htmlClickOn("#play-next"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyPrevious) { htmlClickOn("#play-prev"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyLike) { LikeCurrentSong(); } else if (KeyAsInt == Properties.Settings.Default.hotkeyDislike) { DislikeCurrentSong(); } else if (KeyAsInt == Properties.Settings.Default.hotkeyFavorite) { htmlClickOn("#np-fav"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyMute) { htmlClickOn("#volume"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyShowHide) { showHideWindow(); } else if (KeyAsInt == Properties.Settings.Default.hotkeyShuffle) { htmlClickOn("#shuffle"); } }
void Form1_OnHotKeyPressed( object sender, KeyPressedEventArgs e ) { //if ( !ContainsFocus && !Focused ) // return; //if ( e.Modifier == VarocalCross.ModifierKeys.Control && e.Key == Keys.S ) // saveToolStripMenuItem_Click( null, null ); //else if ( (e.Modifier & ( VarocalCross.ModifierKeys.Shift & VarocalCross.ModifierKeys.Control )) // ==( VarocalCross.ModifierKeys.Shift & VarocalCross.ModifierKeys.Control) && e.Key == Keys.S ) // saveAllToolStripMenuItem_Click( null, null ); }
private void hotkeyHandler(object source, KeyPressedEventArgs e) { if (e.Key.Keys.First() == Keys.F12) { IntPtr test = Process.GetProcesses().FirstOrDefault().MainWindowHandle; Form lolwindow = Control.FromHandle(test) as Form; try { lolwindow.Opacity = 0.5; } catch (NullReferenceException) { MessageBox.Show("Null"); } } }
protected virtual void OnVirtualKeyboardAction(KeyPressedEventArgs e) { VirtualKeyboardAction?.Invoke(this, e); }
async void HotKeyPressed(object sender, KeyPressedEventArgs e) { try { log($"Hotkey pressed: {e.Modifier} + {e.Key}"); if (e.Key == Keys.F1) { splitContainer2.Panel2Collapsed = true; uiLog.Focus(); saveSels(); await _app.Toggle(); } if (e.Key == Keys.F2) { splitContainer2.Panel2Collapsed = false; splitContainer2.SplitterDistance = 600; Height = 1200; var fd = new OpenFileDialog(); fd.Filter = "Iamge|*.bmp;*.png;*.jpg"; if (fd.ShowDialog() == DialogResult.OK) { log($"Loading file: {fd.FileName}"); _app.TestOcr2(fd.FileName, uiPicture, uiPicture2); } } if (e.Key == Keys.F3) { splitContainer2.Panel2Collapsed = false; splitContainer2.SplitterDistance = 600; Height = 1200; _app.TestOcr(uiPicture, uiPicture2); } if (e.Key == Keys.F4) { //var f = new KeyRecorder(this); //var keys = await f.GetKeys(); //uiName1.Text = keys.text; //uiLog.Focus(); //Thread.Sleep(100); //var kp = new KeysPlayer(keys.data); //kp.Start(); _app.SetOrigin(); log($"cursor={Cursor.Position}"); log($"size={this.Size}"); } if (e.Key == Keys.F5) { _app.testSearch(uiPicture, uiPicture2); } if (e.Key == Keys.F6) { _app.testFilter(uiPicture, uiPicture2); } if (e.Key == Keys.F7) { _app.FindAddress(); } if (e.Key == Keys.F12) { _app.testFilter(uiPicture, uiPicture2); } } catch (Exception ex) { log(ex); } }
private void GB_KeyPressed(object sender, KeyPressedEventArgs e) { if (!keysEnabled) { return; } if (e.Key == options.CycleOverlayTabs) { overlay.CurTab = (Overlay.Tabs)(((uint)overlay.CurTab + 1) % 3); //lul } if (overlay.Visible && overlay.CurTab == Overlay.Tabs.Clock) { } else if (overlay.Visible && overlay.CurTab == Overlay.Tabs.Stopwatch) { if (e.Key == options.OverlayKey1) { SWstart(); } else if (e.Key == options.OverlayKey2) { SWreset(); } } else if (overlay.Visible && overlay.CurTab == Overlay.Tabs.Countdown) { //All hardocded keays in this function are used for numerical entery, // therefore they cannot be changed if (e.Key == options.OverlayKey3) { CD_EnterMode = !CD_EnterMode; if (CD_EnterMode) { for (uint i = (uint)Keys.NumPad0, l = (uint)Keys.D0; i <= (uint)Keys.NumPad9; i++, l++) { numpadKeys.Add(KeyHook.RegisterHotKey((Keys)i)); numpadKeys.Add(KeyHook.RegisterHotKey((Keys)l)); } numpadKeys.Add(KeyHook.RegisterHotKey(Keys.Enter)); numpadKeys.Add(KeyHook.RegisterHotKey(Keys.Back)); //I would register the delete key aswell, but that would lock you out //of ctrl+alt+del if something screws up. } else { UnregNumberKeys(); } } else if (e.Key == options.OverlayKey1) { CDtoggle(); } else if (e.Key == options.OverlayKey2) { if (!CDclock.Running) { CDreset(true); } } else if (e.Key.First() == Keys.Enter) { UnregNumberKeys(); CD_EnterMode = false; CDtoggle(); } else { switch (e.Key.First()) { case Keys.D0: case Keys.NumPad0: timeThing.pushNumber(0); break; case Keys.D1: case Keys.NumPad1: timeThing.pushNumber(1); break; case Keys.D2: case Keys.NumPad2: timeThing.pushNumber(2); break; case Keys.D3: case Keys.NumPad3: timeThing.pushNumber(3); break; case Keys.D4: case Keys.NumPad4: timeThing.pushNumber(4); break; case Keys.D5: case Keys.NumPad5: timeThing.pushNumber(5); break; case Keys.D6: case Keys.NumPad6: timeThing.pushNumber(6); break; case Keys.D7: case Keys.NumPad7: timeThing.pushNumber(7); break; case Keys.D8: case Keys.NumPad8: timeThing.pushNumber(8); break; case Keys.D9: case Keys.NumPad9: timeThing.pushNumber(9); break; case Keys.Back: timeThing.popNumber(); break; } CDdisplay.Text = timeThing.getUnproccesdString(); } } }
private void KeyboardHook_KeyPressed(object sender, KeyPressedEventArgs e) { Button_Click_1(null, null); }
public void HotKeyPressed(KeyPressedEventArgs args) { Execute(); }
void hook_KeyPressed(object sender, KeyPressedEventArgs e) { RunButton_Click(this, e); }
private void PlugIn1_KeyPressed(KeyPressedEventArgs ea) { const int KEY_Backspaces = 8; if (_ConvertingSpacesToCamelCase && ea.KeyCode == KEY_Backspaces && ea.NoShiftKeys) { char leftChar = CodeRush.Caret.LeftChar; if (leftChar == char.ToUpper(leftChar)) _NextCharIsUpper = true; } }
private void Hook_KeyPressed(object sender, KeyPressedEventArgs e) { lblHotkeyInfo.Text = e.Modifier + " + " + e.Key; if (e.Modifier == Helpers.ModifierKeys.Ctrl && e.Key == Keys.F5) { cmdReloadRotationAndUI.PerformClick(); } if (e.Modifier == Helpers.ModifierKeys.Ctrl && e.Key == Keys.F6) { cmdReloadRotation.PerformClick(); } if (ConfigFile.ReadValue("Hotkeys", "cmbStartRotationKey") != "") { if (e.Modifier == Keyboard.StartRotationModifierKey && e.Key == Keyboard.StartRotationKey) { cmdStartBot_Click(null, null); return; } if (e.Modifier == Keyboard.StopRotationModifierKey && e.Key == Keyboard.StopRotationKey) { cmdStartBot_Click(null, null); return; } if (combatRoutine == null) { return; } if (Keyboard.SingleTargetModifierKey == Keyboard.AOEModifierKey && Keyboard.SingleTargetKey == Keyboard.AOEKey) { if (e.Modifier == Keyboard.SingleTargetModifierKey && e.Key == Keyboard.SingleTargetKey) // or AOEKey - since they the same in this case { if (combatRoutine.Type == CombatRoutine.RotationType.SingleTarget) { combatRoutine.ChangeType(CombatRoutine.RotationType.AOE); return; } if (combatRoutine.Type == CombatRoutine.RotationType.AOE) { combatRoutine.ChangeType(CombatRoutine.RotationType.SingleTargetCleave); return; } combatRoutine.ChangeType(CombatRoutine.RotationType.SingleTarget); } } else { if (e.Modifier == Keyboard.SingleTargetModifierKey && e.Key == Keyboard.SingleTargetKey) { if (combatRoutine.Type != CombatRoutine.RotationType.SingleTarget) { combatRoutine.ChangeType(CombatRoutine.RotationType.SingleTarget); return; } } if (e.Modifier == Keyboard.AOEModifierKey && e.Key == Keyboard.AOEKey) { if (combatRoutine.Type != CombatRoutine.RotationType.AOE) { combatRoutine.ChangeType(CombatRoutine.RotationType.AOE); } else { combatRoutine.ChangeType(CombatRoutine.RotationType.SingleTargetCleave); } } } } else // If defaults are not setup, then use these as defaults { if (e.Modifier == Helpers.ModifierKeys.Ctrl) { if (e.Key == Keys.S) { cmdStartBot_Click(null, null); } } if (e.Modifier == Helpers.ModifierKeys.Alt) { if (e.Key == Keys.S) { combatRoutine.ChangeType(CombatRoutine.RotationType.SingleTarget); } if (e.Key == Keys.A) { combatRoutine.ChangeType(CombatRoutine.RotationType.AOE); } if (e.Key == Keys.C) { combatRoutine.ChangeType(CombatRoutine.RotationType.SingleTargetCleave); } } } }
private void onGlobalStartKeyPressed(object sender, KeyPressedEventArgs e) { if (this.isTracking) { using (Performance.Measure("stopping time entry from global short cut", this.isInManualMode)) { Toggl.Stop(); } } else { using (Performance.Measure("starting time entry from global short cut, manual mode: {0}", this.isInManualMode)) { this.startTimeEntry(true); } } }
private void _easyHotKey_KeyPressed(object sender, KeyPressedEventArgs e) { MessageBox.Show($"{e.HotKey} Hot Key Pressed!"); }
void LeftKeyManagerPressed(object sender, KeyPressedEventArgs e) { desktops[(CurrentDesktopIndex - 1 + desktops.Count) % desktops.Count].Switch(); }
void hook_KeyPressed(object sender, KeyPressedEventArgs e) { // show the keys pressed in a label. label1.Text = e.Modifier.ToString() + " + " + e.Key.ToString(); }
void hook_KeyPressed(object sender, KeyPressedEventArgs e) { switch(e.Key) { case Keys.D3: screen_capture("screen"); break; case Keys.D4: screen_capture("region"); break; case Keys.D5: screen_capture("window"); break; } }
private void hook_KeyPressed(object sender, KeyPressedEventArgs e) { Debug.WriteLine($@"Key Pressed: Key: {e.Key} Modifier(s) Pressed: {e.Modifier != 0000}"); // show the keys pressed in a label. label1.Text = e.Modifier.ToString() + " + " + e.Key.ToString(); }
private void KeyMessageWindow_OnKeyPressed(object sender, KeyPressedEventArgs e) => KeyPressed?.Invoke(this, e);
private static void Hook_KeyPressed(object sender, KeyPressedEventArgs e) { if (DateTime.Now.Subtract(_lastKeyPress).TotalMilliseconds < 200) // Don't allow rapid keypresses return; _lastKeyPress = DateTime.Now; long key = (long)e.Key; if (0 != (e.Modifier & ModifierKeys.Alt)) key |= (long)Keys.Alt; if (0 != (e.Modifier & ModifierKeys.Control)) key |= (long)Keys.Control; if (0 != (e.Modifier & ModifierKeys.Shift)) key |= (long)Keys.Shift; if (0 != (e.Modifier & ModifierKeys.Win)) key |= (long)Keys.LWin; for (int i = 0; i < SmartVolManagerPackage.BgMusicManager.MuteFmConfig.Hotkeys.Length; i++) { Hotkey hotkey = SmartVolManagerPackage.BgMusicManager.MuteFmConfig.Hotkeys[i]; if (hotkey.Key == key) { switch (hotkey.Name.ToLower()) { case "play": UiCommands.OnOperation(Operation.Play); break; case "pause": UiCommands.OnOperation(Operation.Pause); break; case "stop": UiCommands.OnOperation(Operation.Stop); break; case "mute": UiCommands.OnOperation(Operation.Mute); break; case "unmute": UiCommands.OnOperation(Operation.Unmute); break; case "previous track": UiCommands.OnOperation(Operation.PrevTrack); break; case "next track": UiCommands.OnOperation(Operation.NextTrack); break; case "show": UiCommands.OnOperation(Operation.Show); break; case "toggle muting music/videos": // Could add this to enumeration SmartVolManagerPackage.BgMusicManager.ToggleFgMute(); UiCommands.OnOperation(Operation.Restore); break; default: break; } } } }
void AreaHook_KeyPressed(object sender, KeyPressedEventArgs e) { grabberForm = new Grabber(this); grabberForm.FormClosing += DisposeGrabber; grabberForm.Show(); }
private void Hook_KeyPressed(object sender, KeyPressedEventArgs e) { // Show the keys pressed in a label. string key = e.Key.ToString(); //string keyComb = e.Modifier.ToString() + " + " + key; //MessageBox.Show(keyComb); switch (key) { case "A": if (!isBookmarkView) { AddBookMark(); } else { JumpThroughBookMarks(-1); } break; case "S": if (!isBookmarkView) { ToggleBookmarkView(); } else { JumpThroughBookMarks(1); } break; case "Z": ReadBackward(); break; case "X": ReadForward(); break; case "Q": QuitTaskBarReader(); break; case "Space": HideShow(); break; case "C": ToggleBookmarkView(); break; case "D": DeleteCurBookMark(); break; default: MessageBox.Show(tools.GetString("hotkey_invalid_pressed")); break; } }
private void keyPressedHandler(object sender, KeyPressedEventArgs args) { Console.Error.WriteLine($"Key {args.State} on {args.DeviceId}: {args.Key}"); }
private void hook_KeyPressed(object sender, KeyPressedEventArgs e) { ShowAndSetFocus(); }
private void hook_KeyPressed(object sender, KeyPressedEventArgs e) { ShowMe(); }
private void hook() { bool s = true; bool l1 = true; bool l2 = true; bool winkey = false; Stroke stroke = new Stroke(); InterceptionDriver.SetFilter(context, InterceptionDriver.IsMouse, (Int32)MouseFilterMode.All); InterceptionDriver.SetFilter(context, InterceptionDriver.IsKeyboard, (Int32)KeyboardFilterMode.All); while (InterceptionDriver.Receive(context, device = InterceptionDriver.Wait(context), ref stroke, 1) > 0) { s = true; if (InterceptionDriver.IsMouse(device) > 0) { if (l1) { l1 = false; devm = device; } user_out = false; if (_lock) { s = false; } if (OnMousePressed != null) { var args = new MousePressedEventArgs() { X = stroke.Mouse.X, Y = stroke.Mouse.Y, State = stroke.Mouse.State, Rolling = stroke.Mouse.Rolling }; OnMousePressed(this, args); if (args.Handled) { continue; } stroke.Mouse.X = args.X; stroke.Mouse.Y = args.Y; stroke.Mouse.State = args.State; stroke.Mouse.Rolling = args.Rolling; } } if (InterceptionDriver.IsKeyboard(device) > 0) { if (l2) { l2 = false; devk = device; } if (_lock) { s = false; } user_out = false; if ((stroke.Key.Code == Keys.WindowsKeyLeft) | (stroke.Key.Code == Keys.WindowsKeyRight)) { if (stroke.Key.State == KeyState.E0) { winkey = true; } else { winkey = false; } } if (stroke.Key.Code == Keys.NumpadMinus) { try { Thread blk = new Thread(block); blk.IsBackground = true; blk.Start(); s = false; } catch { System.Windows.MessageBox.Show("Error"); } } if (stroke.Key.Code == Keys.Q) { if (winkey) { try { Thread unblk = new Thread(unblock); unblk.IsBackground = true; unblk.Start(); } catch { System.Windows.MessageBox.Show("Error"); } } } if (OnKeyPressed != null) { var args = new KeyPressedEventArgs() { Key = stroke.Key.Code, State = stroke.Key.State }; OnKeyPressed(this, args); if (args.Handled) { continue; } stroke.Key.Code = args.Key; stroke.Key.State = args.State; } } if (s) { InterceptionDriver.Send(context, device, ref stroke, 1); } } Stop(); }
private void hook_KeyPressed(object sender, KeyPressedEventArgs e) { var keys = e.Key; switch (keys) { case (Keys.D1): OpenFileDialog(); break; case (Keys.D2): if (_applicationManager.GetStatus() != PlaybackStatus.Playing) { _applicationManager.Play(); timer_track.Start(); } else { _applicationManager.Pause(); } break; case (Keys.D3): _applicationManager.Stop(); SetTimeLabel(); timer_track.Stop(); break; case (Keys.D4): _applicationManager.Rewind(); break; case (Keys.D5): if (_applicationManager.GetStatus() == PlaybackStatus.Stopped) { SetTimeLabel(); } _applicationManager.Forward(); break; case (Keys.D6): SetVolumeLabel(-10); _applicationManager.VolumeUp(); break; case (Keys.D7): SetVolumeLabel(10); _applicationManager.VolumeDown(); break; case (Keys.D8): if (reporter.Equals(Empty)) { ContentWriter.WriteQuote( Internal.Resources.SettingsResources.ResourceManager.GetString("reporter_quote")); } else { ContentWriter.WriteQuote(reporter); } break; case (Keys.D9): if (interviewed.Equals(Empty)) { ContentWriter.WriteQuote( Internal.Resources.SettingsResources.ResourceManager.GetString("interviewed_quote")); } else { ContentWriter.WriteQuote(interviewed); } break; } }
public override void OnKeyPressed(KeyPressedEventArgs args) => KeyPressed? .Invoke(this, args);
public void HotKeyManagerPressed(object sender, KeyPressedEventArgs e) { if ((e.HotKey.Key == Key.F2) && (e.HotKey.Modifiers == ModifierKeys.Control)) { // 20210719 mark this line to simplify logging, Reason: 太多了啦 // log.Info("Hotkey Ctrl-F2 pressed."); // 20210718 簡單版本, Subjective // 決定日期, 有strID就用, 沒有就用今天 string D = DateTime.Now.ToShortDateString(); if (DateTime.TryParse(m.strID.Content.ToString().Split(' ')[0], out DateTime o)) { D = o.ToShortDateString(); } Random crandom = new Random(); // 1句的機率, 2/3*1*2/3=4/9 // 3句的機率, 1/3*1*1/3=1/9 // 2句的機率, 4/9 // Short sentence // 1/3 機會有這一段 int n; string output; List <string> strShort = new List <string> { "OK.", "No specific complaints.", "Satisfied with medication.", "Nothing particular.", "Mostly unchanged since last visit.", "Aloof to inquiry.", "For drug refill.", "Maintenance phase.", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; n = crandom.Next(strShort.Count); output = strShort[crandom.Next(n)]; // Adjectives List <string> strAdj = new List <string> { "Stationary ", "No change in ", "Improved ", "Stable ", "Unchanged ", "Stable ", "Unchanged ", "Fluctuated ", "Acceptable ", "Tolerable ", "Fairly good ", "Pretty good ", "Awesome ", "Fantastic ", "Uneventful ", "Stationary ", "Stationary " }; n = crandom.Next(strAdj.Count); if (output.Length != 0) { output += " "; } output += strAdj[crandom.Next(n)]; // Nouns List <string> strNoun = new List <string> { "condition.", "clinical picture.", "mental status.", "state.", "course.", "situation.", "being.", "progress.", "psychiatric state.", "circumstance.", "condition.", "condition.", "mental status.", "clinical picture.", "state.", "sate.", "mental status.", "clinical picture.", "situation.", "condition." }; n = crandom.Next(strNoun.Count); output += strNoun[crandom.Next(n)]; // Ask for // 1/3 有這一段 n = crandom.Next(3); if (n == 0) { List <string> strVerb = new List <string> { "Ask for ", "Request for ", "Need ", "Keep ", "Continue ", "Carry on ", "Keep on " }; n = crandom.Next(strVerb.Count); output += $" {strVerb[crandom.Next(n)]}"; List <string> strAdj2 = new List <string> { "same ", "the same ", "present ", "current ", "identical ", "", "", "", "", "" }; n = crandom.Next(strAdj2.Count); output += strAdj2[crandom.Next(n)]; List <string> strNoun2 = new List <string> { "medication.", "prescription refill.", "prescription.", "treatment plan.", "drug treatment.", "drug.", "psychiatric treatment." }; n = crandom.Next(strNoun2.Count); output += strNoun2[crandom.Next(n)]; } output = $"{D}: {output}\n"; InputSimulator sim = new InputSimulator(); sim.Keyboard.TextEntry(output); } if ((e.HotKey.Key == Key.Y) && (e.HotKey.Modifiers == ModifierKeys.Control)) { log.Info("Hotkey Ctrl-Y pressed."); //更新雲端資料 w.HotKey_Ctrl_Y(); } if ((e.HotKey.Key == Key.G) && (e.HotKey.Modifiers == ModifierKeys.Control)) { log.Info("Hotkey Ctrl-G pressed."); //讀寫雲端資料 w.HotKey_Ctrl_G(); } if ((e.HotKey.Key == Key.T) && (e.HotKey.Modifiers == ModifierKeys.Control)) { log.Info("Hotkey Ctrl-T pressed."); //讀寫雲端資料 Com_clDataContext dc = new Com_clDataContext(); var list_vpn = dc.sp_querytable2(); string show_list = string.Empty; int order = 0; foreach (var a in list_vpn) { if (order > 3) { break; } show_list += $"[{a.uid}] {a.cname} \r\n"; order++; } tb.ShowBalloonTip("最近四人", show_list, BalloonIcon.Info); } }
protected virtual void Pressed(KeyPressedEventArgs e) { KeyPressed?.Invoke(this, e); }
private void Pause_Press(object sender, KeyPressedEventArgs e) { Pause_Pressed?.Invoke(this, EventArgs.Empty); }
private void Restart_Press(object sender, KeyPressedEventArgs e) { Restart_Pressed?.Invoke(this, EventArgs.Empty); }
private void onGlobalShowKeyPressed(object sender, KeyPressedEventArgs e) { this.togglVisibility(); }
void hook_KeyPressed(object sender, KeyPressedEventArgs e) { switch (e.Key.ToString()) { case "MediaPlayPause": playerExecute("player_play_pause"); break; case "MediaNextTrack": playerExecute("player_next"); break; case "MediaPreviousTrack": playerExecute("player_previous"); break; } uint KeyAsInt = (uint)(e.Key | hook.keyToModifierKey(e.Modifier)); if (KeyAsInt == Properties.Settings.Default.hotkeyPlay) { htmlClickOn("#player_play_pause"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyNext) { htmlClickOn("#player_next"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyPrevious) { htmlClickOn("#player_previous"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyLike) { htmlClickOn("#queue_list_window .queue-item-active .smile"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyDislike) { htmlClickOn("#queue_list_window .queue-item-active .frown"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyFavorite) { htmlClickOn("#playerDetails_nowPlaying .add"); htmlClickOn("#playerDetails_nowPlaying .favorite"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyMute) { htmlClickOn("#player_volume"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyShowHide) { showHideWindow(); } else if (KeyAsInt == Properties.Settings.Default.hotkeyShuffle) { htmlClickOn("#player_shuffle"); } }
void hook_KeyPressed(object sender, KeyPressedEventArgs e) { if (!GlobalHotkeys || ChangingHotkeys) return; Program.SelectDevice(Program.NextId()); ResetDeviceList(); ShowBalloonTip(); }
void pressKeyboard_KeyReleased(object sender, KeyPressedEventArgs e) { }
void hook_KeyPressed(object sender, KeyPressedEventArgs e) { switch (e.Key.ToString()) { case "MediaPlayPause": playerExecute("player_play_pause"); break; case "MediaNextTrack": playerExecute("player_next"); break; case "MediaPreviousTrack": playerExecute("player_previous"); break; } uint KeyAsInt = (uint)(e.Key | hook.keyToModifierKey(e.Modifier)); if (KeyAsInt == Properties.Settings.Default.hotkeyPlay) { htmlClickOn("#player_play_pause"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyNext) { htmlClickOn("#player_next"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyPrevious) { htmlClickOn("#player_previous"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyLike) { LikeCurrentSong(); } else if (KeyAsInt == Properties.Settings.Default.hotkeyDislike) { DislikeCurrentSong(); } else if (KeyAsInt == Properties.Settings.Default.hotkeyFavorite) { htmlClickOn("#playerDetails_nowPlaying_options"); htmlClickOn("#jjmenu_main .jj_menu_item_favorites"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyMute) { htmlClickOn("#player_volume"); } else if (KeyAsInt == Properties.Settings.Default.hotkeyShowHide) { showHideWindow(); } else if (KeyAsInt == Properties.Settings.Default.hotkeyShuffle) { htmlClickOn("#player_shuffle"); } }
private static void HotKeyManager_KeyPressed(object sender, KeyPressedEventArgs e) { GlobalHoykeyPressed?.Invoke(_hotkeys[e.HotKey]); }
void pressKeyboard_KeyPressed(object sender, KeyPressedEventArgs e) { setPressure(e.KeyPressed.Pressure); setKey(e.KeyPressed.Text.ToLower()); // if the key is in the mapping, it should be drawn if (yMapping.ContainsKey(e.KeyPressed.Text.ToLower())) this.DrawBlotch(e.KeyPressed.Text.ToLower(), e.KeyPressed.Pressure); // f1 to bring up keyboard image shown previously. if (e.KeyPressed.Text.ToLower().Equals("f1")) showKeyboard(); if (e.KeyPressed.Text.ToLower().Equals("space")) eraseCanvas(); }
protected override void OnKeyPressed(object sender, KeyPressedEventArgs e) { // check for a number, set e.Handled to true if it's not a number // may need to handle copy-paste and other similar actions }
private void OnKeyPressed(object sender, KeyPressedEventArgs e) { Trace.Call(sender, e); #if LOG4NET _Logger.Debug("_OnKeyPressed(): e.Key: '" + e.Key + "' e.Focus: '" + e.Focus + "'"); #endif switch (e.Key) { case "ENTER": OnActivated(EventArgs.Empty); break; case "PPAGE": if (f_ChatViewManager.ActiveChat != null) { f_ChatViewManager.ActiveChat.ScrollUp(); } break; case "NPAGE": if (f_ChatViewManager.ActiveChat != null) { f_ChatViewManager.ActiveChat.ScrollDown(); } break; case "kPRV5": // CTRL + PAGE UP case "^P": f_ChatViewManager.CurrentChatNumber--; break; case "kNXT5": // CTRL + PAGE DOWN case "^N": f_ChatViewManager.CurrentChatNumber++; break; case "^W": DeleteUntilSpace(); break; case "kRIT5": JumpWord(false); break; case "kLFT5": JumpWord(true); break; case "^D": DeleteChar(); break; } }
private void KeyHookKeyEvent(object sender, KeyPressedEventArgs keyPressedEventArgs) { ToggleMainWindow(); }
void hook_KeyPressed(object sender, KeyPressedEventArgs e) { WindowState = System.Windows.WindowState.Normal; Activate(); tbInput.Focus(); tbInput.SelectAll(); }
void OnHotKeyPressed( object sender, KeyPressedEventArgs e ) { if( e.Id == _decTr ) { manager.DoAction( TransparancyManager.Action.DecTransparancy ); } else if( e.Id == _incTr ) { manager.DoAction( TransparancyManager.Action.IncTransparancy ); } else { manager.DoAction( TransparancyManager.Action.SwitchGlass ); } }
void hook_KeyPressed(object sender, KeyPressedEventArgs e) { if (!isHookEnabled) { return; } WindowState = System.Windows.WindowState.Normal; Activate(); tbInput.Focus(); tbInput.SelectAll(); }