/// <summary> /// Shows the tooltip /// </summary> private void showToolTip(bool blockingState) { try { if (blockingState != this.inputBlocker.BlockInput) { return; } this.trayIcon.Visible = true; if (blockingState) { BalloonTooltip.Show( $"Your keyboard and mouse is locked.{Environment.NewLine}Press \"{this.inputBlocker.UnblockingKey}\" to unlock.", this.iconLock, $"Hold \"{this.inputBlocker.UnblockingKey}\" to turn off the screen.", 5000); } else { BalloonTooltip.Hide(); } } catch { } }
private void onKeyReleased(Keys key) { if (!this.shortcutSettingMode) { return; } if (key.GetUnmodifiedKey() == Keys.None) { return; } try { BalloonTooltip.Hide(); this.shortcutSettingMode = false; if (MessageBox.Show($"Do you wish to set this shortcut? {(ActionKey)key}", "Set shortcut", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } this.setActionKey(key); AppConfigHelper.Set("LockKey", key); } finally { this.inputBlocker.Enabled = true; } }
private void onKeyPressed(Keys key) { if (this.shortcutSettingMode) { BalloonTooltip.Show($"Press desired key combination{Environment.NewLine}{(ActionKey)key}", this.iconLock); } }
/// <summary> /// Handles the exception /// </summary> public static void HandleException(Exception ex, bool debugOnly = true) { #if !DEBUG if (debugOnly) { return; } #endif BalloonTooltip.Show(Assembly.GetEntryAssembly().GetName().Name + " - Error", null, ex.ToString(), 5000); }
protected override void onTrayIconClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left) { return; } var isRunning = this.isSqlRunning(); try { BalloonTooltip.Show(isRunning ? "Stopping the SQL Server..." : "Starting the SQL Server...", this.toolTipIcon, () => this.switchSqlServer(!isRunning)); } catch { } this.updateLook(); }
private void onSetShortcutClick(object sender, EventArgs e) { this.inputBlocker.Enabled = false; this.shortcutSettingMode = true; BalloonTooltip.Show($"Press desired key combination...", this.iconLock); }
private void onScreenTurnedOff() { BalloonTooltip.Show("..zzZ", this.iconScreen); BalloonTooltip.Activate(); }
private void onScreenOffRequested() { BalloonTooltip.Show("Turning off the screen...", this.iconScreen); }