private void btnStop_Click(object sender, EventArgs e) { IntervalTimer.Stop(); foreach (Control ctrl in Controls) { ctrl.Enabled = true; } }
public void Close() { _timer.Stop(); lock (this) { _pluggedPorts.Clear(); _unpluggedPorts.Clear(); } }
public void IntervalTimerTest() { bool done = false; int counter = 0; new SingleTimer(() => done = true, I * C, true); IntervalTimer IT = new IntervalTimer(() => counter++, I, true); Task.Run(() => { while (!done) { ; } IT.Stop(); }).Wait(); Assert.AreEqual(C, counter); }
private void cbAutoOnOff_CheckedChanged(object sender, EventArgs e) { if (cbAutoOnOff.Checked) { if (cbAutoOnDoOnce.Checked) { AutomaticProcedure(); } EnableDisableControls(false); int frequency = ((int)numericHours.Value * 60000 * 60) + ((int)numericMinutes.Value * 60000); IntervalTimer.Interval = frequency; IntervalTimer.Start(); } else { IntervalTimer.Stop(); EnableDisableControls(true); } }
private void ConnectionDisconnected() { log.Warning("Connection is disconnected. Stopping all timers"); if (pingTimer != null) { pingTimer.Stop(); pingTimer = null; } if (connection != null) { connection.Close(); connection = null; } OnDisconnect(); // Go back to main url if we get disconnected serverUrl = mainUrl; if (shouldRetainConnection) { ConnectAgainLater(); } }
public void Disable() => timer.Stop();
public void Stop() { _intervalTimer.Stop(); }