/// <summary>
        ///     Registers all hotkeys as configured, displaying a dialog in case of hotkey conflicts with other tools.
        /// </summary>
        /// <param name="ignoreFailedRegistration">
        ///     if true, a failed hotkey registration will not be reported to the user - the
        ///     hotkey will simply not be registered
        /// </param>
        /// <returns>
        ///     Whether the hotkeys could be registered to the users content. This also applies if conflicts arise and the
        ///     user decides to ignore these (i.e. not to register the conflicting hotkey).
        /// </returns>
        public bool RegisterHotkeys(bool ignoreFailedRegistration)
        {
            var success    = true;
            var failedKeys = new StringBuilder();

            if (!RegisterWrapper(failedKeys, "CaptureRegion", "RegionHotkey",
                                 () =>
            {
                CaptureHelper.CaptureRegion(true);
            }, ignoreFailedRegistration))
            {
                success = false;
            }
            if (!RegisterWrapper(failedKeys, "CaptureWindow", "WindowHotkey", () =>
            {
                if (_coreConfiguration.CaptureWindowsInteractive)
                {
                    CaptureHelper.CaptureWindowInteractive(true);
                }
                else
                {
                    CaptureHelper.CaptureWindow(true);
                }
            }, ignoreFailedRegistration))
            {
                success = false;
            }
            if (!RegisterWrapper(failedKeys, "CaptureFullScreen", "FullscreenHotkey",
                                 () => CaptureHelper.CaptureFullscreen(true, _coreConfiguration.ScreenCaptureMode), ignoreFailedRegistration))
            {
                success = false;
            }
            if (!RegisterWrapper(failedKeys, "CaptureLastRegion", "LastregionHotkey", () => CaptureHelper.CaptureLastRegion(true), ignoreFailedRegistration))
            {
                success = false;
            }
            if (_coreConfiguration.IECapture)
            {
                if (!RegisterWrapper(failedKeys, "CaptureIE", "IEHotkey", () =>
                {
                    if (_coreConfiguration.IECapture)
                    {
                        CaptureHelper.CaptureIe(true, null);
                    }
                }, ignoreFailedRegistration))
                {
                    success = false;
                }
            }

            if (!success && !ignoreFailedRegistration)
            {
                success = HandleFailedHotkeyRegistration(failedKeys.ToString());
            }

            return(success || ignoreFailedRegistration);
        }
Exemple #2
0
 private void CaptureWindow()
 {
     if (conf.CaptureWindowsInteractive)
     {
         CaptureHelper.CaptureWindowInteractive(true);
     }
     else
     {
         CaptureHelper.CaptureWindow(true);
     }
 }
Exemple #3
0
 private void Contextmenu_capturewindow_Click(object sender, EventArgs e)
 {
     BeginInvoke((MethodInvoker) delegate { CaptureHelper.CaptureWindowInteractive(false); });
 }