예제 #1
0
        private void btnStop_Click(object sender, EventArgs e)
        {
            IntervalTimer.Stop();

            foreach (Control ctrl in Controls)
            {
                ctrl.Enabled = true;
            }
        }
예제 #2
0
        public void Close()
        {
            _timer.Stop();


            lock (this)
            {
                _pluggedPorts.Clear();
                _unpluggedPorts.Clear();
            }
        }
예제 #3
0
        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);
            }
        }
예제 #5
0
        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();
            }
        }
예제 #6
0
 public void Disable()
 => timer.Stop();
예제 #7
0
 public void Stop()
 {
     _intervalTimer.Stop();
 }