Exemple #1
0
        private void ActivateKeepAlive()
        {
            var message = string.Empty;

            if (rdoDeactivateAfter.Checked)
            {
                var minutes  = numDeactivateTimer.Value;
                var interval = (double)minutes * 60 * 1000;

                _deactivateTimer.Interval = interval;
                _deactivateTimer.Start();

                var aliveUntil = DateTime.Now.AddMilliseconds(interval);
                message = string.Format("KeepAlive active until {0}", aliveUntil.ToString("HH:mm:ss"));
            }
            else if (rdoDeactivateAt.Checked)
            {
                var time     = timePicker.Value < DateTime.Now ? timePicker.Value.AddDays(1) : timePicker.Value;
                var timeSpan = time - DateTime.Now;

                _deactivateTimer.Interval = timeSpan.TotalMilliseconds;
                _deactivateTimer.Start();

                message = string.Format("KeepAlive active until {0}", time.ToString("HH:mm:ss"));
            }
            else
            {
                message = "KeepAlive active indefinitely";
            }

            notifyIcon.ShowBalloonTip(10000, _balloonTitle, message, ToolTipIcon.Info);
            SetFormVisibility(false);
            KeepAliveController.Activate();
            _updateRefreshTimer.Start();
        }
Exemple #2
0
 private void _updateRefreshTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     KeepAliveController.Activate();
 }