示例#1
0
        /// <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 { }
        }
示例#2
0
        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;
            }
        }
示例#3
0
 private void onKeyPressed(Keys key)
 {
     if (this.shortcutSettingMode)
     {
         BalloonTooltip.Show($"Press desired key combination{Environment.NewLine}{(ActionKey)key}", this.iconLock);
     }
 }
示例#4
0
        /// <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);
        }
示例#5
0
        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();
        }
示例#6
0
 private void onSetShortcutClick(object sender, EventArgs e)
 {
     this.inputBlocker.Enabled = false;
     this.shortcutSettingMode  = true;
     BalloonTooltip.Show($"Press desired key combination...", this.iconLock);
 }
示例#7
0
 private void onScreenTurnedOff()
 {
     BalloonTooltip.Show("..zzZ", this.iconScreen);
     BalloonTooltip.Activate();
 }
示例#8
0
 private void onScreenOffRequested()
 {
     BalloonTooltip.Show("Turning off the screen...", this.iconScreen);
 }