예제 #1
0
        private void dispatcherTimer_Tick(object sender, EventArgs e)
        {
            DateTime now         = DateTime.Now;
            double   secondAngle = 6.0 * now.Second;

            if (secondAngle != rotateSecond.Angle)
            {
                rotateSecond.Angle = secondAngle;
            }

            double minuteAngle = 6.0 * (now.Minute + (now.Second / 60.0));

            if (minuteAngle != rotateMinute.Angle)
            {
                rotateMinute.Angle = minuteAngle;
            }

            double hourAngle = 30.0 * ((now.Hour % 12) + (now.Minute / 60.0));

            if (hourAngle != rotateHour.Angle)
            {
                rotateHour.Angle = hourAngle;
            }

            txtTime.Text = now.ToString("T");

            if (DisableScreensaver)
            {
                ScreenSaver.ResetIdleTimer(DisableScreensaver);
            }
        }
 private void DisableScreenSaver()
 {
     if (m_Mp3Player.State == NETSoundPlayer.PlayingState.playing)
     {
         if (_screenSaverTimerCount++ % 100 == 0)
         {
             ScreenSaver.ResetIdleTimer();
         }
     }
 }
예제 #3
0
        //private void AnalogClock_Load(object sender, System.EventArgs e)
        //{
        //	_dateTime=DateTime.Now;
        //          this.BackColor = Settings.ClockBackground;
        //          this.AnalogClock_Resize(sender,e);
        //}

        private void timer1_Tick(object sender, System.EventArgs e)
        {
            this._dateTime = DateTime.Now;
            this.BackColor = Settings.ClockBackground;
            this.Refresh();

            if (Settings.SuspendScreenSaver)
            {
                ScreenSaver.ResetIdleTimer();
            }
        }