void OnExitMinimizedState(object sender, ExitMinimizedStateEventArgs e)
 {
     if (e.MinimizedSeconds != 0)
     {
         if (
             (e.MinimizedSeconds > __PasswordOptionsPresenter.View.Options.IdleTimeOut) &&
             __PasswordOptionsPresenter.View.Options.EnableIdleTimeout
             )
         {
             EventBroker.Instance.PublishEvent <LoginEventArgs>(this, new LoginEventArgs());
         }
     }
 }
Esempio n. 2
0
        private void DelayExitMinimized()
        {
            long minimizedTickCount = DateTime.Now.Ticks - _minimizedTicks;
            long minimizedSeconds   = minimizedTickCount / TimeSpan.TicksPerSecond;

            ExitMinimizedStateEventArgs args = new ExitMinimizedStateEventArgs(minimizedSeconds);

            // This must be done in a thread -- otherwise, the login box is displayed for the Storage Server Manager UI
            Thread thread = new Thread(() =>
            {
                Thread.Sleep(500);
                EventBroker.Instance.PublishEvent <ExitMinimizedStateEventArgs>(this, args);
            });

            thread.IsBackground = true;
            thread.Start();
        }
Esempio n. 3
0
        internal void ShowFromTaskBar()
        {
            _localStateChange = true;
            ExitMinimizedStateEventArgs args = null;

            if (WindowState == FormWindowState.Minimized)
            {
                long minimizedTickCount = DateTime.Now.Ticks - _minimizedTicks;
                long minimizedSeconds   = minimizedTickCount / TimeSpan.TicksPerSecond;
                args = new ExitMinimizedStateEventArgs(minimizedSeconds);
            }

            try
            {
                this.Visible = true;

                ShowInTaskbar = true;
                if (_userWindowState != FormWindowState.Minimized)
                {
                    WindowState = _userWindowState;
                }
                else
                {
                    WindowState = FormWindowState.Maximized;
                }

                this.Activate( );
                EventBroker.Instance.PublishEvent <BackgroundProcessEventAgs>(this, new BackgroundProcessEventAgs(false));
            }
            finally
            {
                _localStateChange = false;
                if (args != null)
                {
                    EventBroker.Instance.PublishEvent <ExitMinimizedStateEventArgs>(this, args);
                }
            }
        }