Beispiel #1
0
        private void Contextmenu_captureiefromlist_Click(object sender, EventArgs e)
        {
            if (!_coreConfiguration.IECapture)
            {
                Log.Info().WriteLine("IE Capture is disabled.");
                return;
            }
            var clickedItem = (ToolStripMenuItem)sender;
            var tabData     = (KeyValuePair <IInteropWindow, int>)clickedItem.Tag;

            BeginInvoke((MethodInvoker) delegate
            {
                var ieWindowToCapture = tabData.Key;
                if (ieWindowToCapture != null && ieWindowToCapture.IsMinimized())
                {
                    ieWindowToCapture.Restore();
                }
                try
                {
                    IeCaptureHelper.ActivateIeTab(ieWindowToCapture, tabData.Value);
                }
                catch (Exception exception)
                {
                    Log.Error().WriteLine(exception);
                }
                try
                {
                    CaptureHelper.CaptureIe(false, ieWindowToCapture);
                }
                catch (Exception exception)
                {
                    Log.Error().WriteLine(exception);
                }
            });
        }
Beispiel #2
0
 private void CaptureIE()
 {
     if (_coreConfiguration.IECapture)
     {
         CaptureHelper.CaptureIe(true, null);
     }
 }
Beispiel #3
0
        /// <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);
        }