Beispiel #1
0
        /// <summary>
        /// Handles the HotKeyPress event of the osHotKey control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void osHotKey_HotKeyPress(object sender, EventArgs e)
        {
            if (this._isWindowOpen)
            {
                return;
            }

            try
            {
                this._isWindowOpen = true;

                using (InstantAccessDialog iaf = new InstantAccessDialog())
                {
                    NativeMethods.SetForegroundWindow(iaf);
                    NativeMethods.SetFocus(iaf);
                    iaf.ShowDialog();
                }
            }
            finally
            {
                this._isWindowOpen = false;
            }
        }
        /// <summary>
        /// Handles the HotKeyPress event of the osHotKey control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void osHotKey_HotKeyPress(object sender, EventArgs e)
        {
            if(this._isWindowOpen)
                return;

            try
            {
                this._isWindowOpen = true;

                using(InstantAccessDialog iaf = new InstantAccessDialog())
                {
                    NativeMethods.SetForegroundWindow(iaf);
                    NativeMethods.SetFocus(iaf);
                    iaf.ShowDialog();
                }
            }
            finally
            {
                this._isWindowOpen = false;
            }
        }