Esempio n. 1
0
        /// <summary>
        /// Shows the interface.
        /// </summary>
        private void ShowInterface()
        {
            try
            {
                Log.WriteDebugMessage("Showing interface");

                if (!Visible && ScreenCapture.LockScreenCaptureSession && !_formEnterPassphrase.Visible)
                {
                    Log.WriteDebugMessage("Screen capture session is locked. Challenging user to enter correct passphrase to unlock");
                    _formEnterPassphrase.ShowDialog(this);
                }

                // This is intentional. Do not rewrite these statements as an if/else
                // because as soon as lockScreenCaptureSession is set to false we want
                // to continue with normal functionality.
                if (!ScreenCapture.LockScreenCaptureSession)
                {
                    Settings.User.GetByKey("Passphrase", DefaultSettings.Passphrase).Value = string.Empty;
                    SaveSettings();

                    Opacity = 100;

                    SearchDates();
                    SearchScreenshots();

                    PopulateLabelList();

                    Show();

                    Visible       = true;
                    ShowInTaskbar = true;

                    // If the window is mimimized then show it when the user wants to open the window.
                    if (WindowState == FormWindowState.Minimized)
                    {
                        WindowState = FormWindowState.Normal;
                    }

                    Focus();

                    bool firstRun = Convert.ToBoolean(Settings.User.GetByKey("FirstRun", DefaultSettings.FirstRun).Value);

                    if (firstRun)
                    {
                        _formHelp.Show();
                    }

                    Log.WriteDebugMessage("Running triggers of condition type InterfaceShowing");
                    RunTriggersOfConditionType(TriggerConditionType.InterfaceShowing);
                }
            }
            catch (Exception ex)
            {
                _screenCapture.ApplicationError = true;
                Log.WriteExceptionMessage("FormMain::ShowInterface", ex);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Shows the interface.
        /// </summary>
        private void ShowInterface()
        {
            try
            {
                if (_initialVisibilitySet && Visible)
                {
                    return;
                }

                _log.WriteDebugMessage("Showing interface");

                string passphrase = _config.Settings.User.GetByKey("Passphrase", _config.Settings.DefaultSettings.Passphrase).Value.ToString();

                if (!string.IsNullOrEmpty(passphrase))
                {
                    _screenCapture.LockScreenCaptureSession = true;

                    if (!_formEnterPassphrase.Visible)
                    {
                        _formEnterPassphrase.Text = "Auto Screen Capture - Enter Passphrase (Show Interface)";
                        _formEnterPassphrase.ShowDialog(this);
                    }
                    else
                    {
                        _formEnterPassphrase.Activate();
                    }

                    if (_formEnterPassphrase.DialogResult != DialogResult.OK)
                    {
                        _log.WriteErrorMessage("Passphrase incorrect or not entered. Cannot show interface. Screen capture session has been locked. Interface is now hidden");

                        HideInterface();

                        return;
                    }

                    _screenCapture.LockScreenCaptureSession = false;
                }

                SearchDates();
                SearchScreenshots();

                PopulateLabelList();

                _initialVisibilitySet = true;
                Visible = true;

                Opacity       = 100;
                ShowInTaskbar = true;
                Show();
                Activate();

                // If the window is mimimized then show it when the user wants to open the window.
                if (WindowState == FormWindowState.Minimized)
                {
                    WindowState = FormWindowState.Normal;
                }

                _log.WriteDebugMessage("Running triggers of condition type InterfaceShowing");
                RunTriggersOfConditionType(TriggerConditionType.InterfaceShowing);
            }
            catch (Exception ex)
            {
                _screenCapture.ApplicationError = true;
                _log.WriteExceptionMessage("FormMain::ShowInterface", ex);
            }
        }