예제 #1
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Form.Load"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            // not primary display and only display on primary?
            if (!m_isPrimaryMonitor &&
                Settings.Instance.DisplayMode == DisplayMode.OnlyOnPrimaryMonitor)
            {
                m_pnlLayout.Visible = false;
            }
            else
            {
                TimeUpdater.Tick += OnTimeUpdater_Tick;
                UpdateValues();
            }

            // base
            base.OnLoad(e);

            // is primary monitor? attach to the timer
            if (m_isPrimaryMonitor)
            {
                TimeUpdater.SynchronizingObject = this;
                TimeUpdater.Start();

                // track user activities
                m_userActivities = new UserActivityMonitor(this, UserActivities.All)
                {
                    Active = true
                };
            }
        }
예제 #2
0
        /// <summary>
        /// Exits the screensaver if not in preview mode.
        /// </summary>
        private void ExitScreensaver()
        {
            if (!m_isPreviewMode)
            {
                TimeUpdater.Stop();

                if (m_userActivities != null)
                {
                    m_userActivities.Dispose();
                    m_userActivities = null;
                }

                Program.CloseForms();
            }
        }