示例#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;
            }
        }