private void Prepare(LockKeys key, bool islock) { string msg = string.Empty; if (key != LockKeys.Insert) { msg = key.ToString() + (islock ? " is on" : " is off"); } else { msg = islock ? "Overtype Mode" : "Insert Mode"; } lockKeysControl.txt.Text = msg; }
private void Prepare(LockKeys key, bool islock) { string msg; if (key != LockKeys.Insert) { msg = string.Format(islock ? Properties.Strings.LockKeysFlyoutHelper_KeyIsOn : Properties.Strings.LockKeysFlyoutHelper_KeyIsOff, key.ToString()); lockKeysControl.LockGlyph.Glyph = islock ? CommonGlyphs.Lock : CommonGlyphs.Unlock; } else { msg = islock ? Properties.Strings.LockKeysFlyoutHelper_OvertypeMode : Properties.Strings.LockKeysFlyoutHelper_InsertMode; lockKeysControl.LockGlyph.Glyph = string.Empty; } lockKeysControl.txt.Text = msg; }
public static bool CheckLock(LockKeys key) { return(((ushort)GetKeyState(lockCodes[(int)key]) & 0xffff) != 0); }
private void Prepare(LockKeys key, bool islock) { var msg = key.ToString() + (islock ? " is on." : " is off."); lockKeysControl.txt.Text = msg; }
private void CheckModifierKeys() { if (messageToShow != null || (IsTalking() && talkingAlert) || talkingImage == null) { return; } ModifierKeys curModifier = watchModifiers?(Keyboard.Modifiers & ( ModifierKeys.Control | ModifierKeys.Shift | ModifierKeys.Alt )):0; LockKeys curLocks = 0; if (Keyboard.GetKeyStates(Key.CapsLock) == KeyStates.Toggled) { curLocks |= LockKeys.CAPS; } if (Keyboard.GetKeyStates(Key.NumLock) == KeyStates.Toggled) { curLocks |= LockKeys.NUMLOCK; } if (curModifier == lastModifiers && (curModifier == 0 || curLocks == lastLockKeys)) { lastLockKeys = curLocks; return; } lastModifiers = curModifier; lastLockKeys = curLocks; List<string> messages = new List<string>(); if ((curModifier & ModifierKeys.Shift) != 0) { messages.Add("Shift"); } if ((curModifier & ModifierKeys.Control) != 0) { messages.Add("Control"); } if ((curModifier & ModifierKeys.Alt) != 0) { messages.Add("Alt"); } if(messages.Count <= 0) { CloseBalloon(); return; } if((curLocks & LockKeys.CAPS) != 0) { messages.Add("CAPS"); } if ((curLocks & LockKeys.NUMLOCK) != 0) { messages.Add("NumLock"); } messageToShow = () => OpenBalloon(string.Join("\n", messages)); }