public Form1(string webhook) { InitializeComponent(); _webhook = webhook; _startTime = DateTime.Now; ded_date.Text = _startTime.ToString("M/d HH:mm:ss"); _powerNotify = MonitorUtils.RegisterNotification(Handle); }
private void elapsed_timer_Tick(object sender, EventArgs e) { if (_countdown > 0) { _countdown--; kamewait_time.Text = _countdown.ToString("D"); } else { if (!_monitorOff) { _monitorOn = true; kamewait.Visible = false; MonitorUtils.SleepMode(Handle); } _monitorOff = true; _endTime = DateTime.Now; var sub = _endTime - _startTime; elapsed_time.Text = sub.ToString("d'.'hh':'mm':'ss"); } }
protected override void OnClosed(EventArgs e) { MonitorUtils.UnregisterNotification(_powerNotify); base.OnClosed(e); }