System.Timers.Timer.Stop()

Here are the examples of the csharp api System.Timers.Timer.Stop() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1032 Examples 7

19 Source : MyProgressMonitor.cs
with Apache License 2.0
from 214175590

public override void end()
        {
            timer.Stop();
            timer.Dispose();
            //string note = ("Done in " + elapsed + " seconds!");

            transferEnd(id);
        }

19 Source : ProcessResult.cs
with MIT License
from abanu-org

private void ElapsedEventHandler(object sender, ElapsedEventArgs e)
        {
            Timer.Stop();
            Console.WriteLine("Timeout");
            Environment.Exit(1);
        }

19 Source : ProcessResult.cs
with MIT License
from abanu-org

public void Dispose()
        {
            try
            {
                if (Timer != null)
                    Timer.Stop();

                Process?.Dispose();

                if (Timer != null)
                {
                    var t = Timer;
                    Timer = null;
                    t.Dispose();
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                Process = null;
            }
        }

19 Source : CreateRealTime3DUniformMeshChart.xaml.cs
with MIT License
from ABTSoftware

private void OnStop()
        {
            if (_timer != null)
            {
                _timer.Stop();
                StartButton.IsEnabled = true;
                PauseButton.IsEnabled = false;
            }
        }

19 Source : EEGExampleViewModel.cs
with MIT License
from ABTSoftware

private void Stop()
        {
            if (IsRunning)
            {
                _timer.Stop();
                IsRunning = false;
            }
        }

19 Source : RealTimeCursors.xaml.cs
with MIT License
from ABTSoftware

private void OnExampleUnloaded(object sender, RoutedEventArgs e)
        {
            _timerNewDataUpdate?.Stop();
        }

19 Source : RealtimeFifoChartView.xaml.cs
with MIT License
from ABTSoftware

private void PauseButton_Click(object sender, RoutedEventArgs e)
        {
            _timerNewDataUpdate?.Stop();

            StartButton.IsChecked = false;
            PauseButton.IsChecked = true;
            ResetButton.IsChecked = false;

            IsFifoCheckBox.IsEnabled = false;
        }

19 Source : NoLockTimer.cs
with MIT License
from ABTSoftware

public void Stop()
        {
            _timer.Stop();
        }

19 Source : UpdateScatterPointsViewModel.cs
with MIT License
from ABTSoftware

public void OnStopExample()
        {
            if (_timer != null)
            {
                lock (_timer)
                {
                    _timer.Stop();
                    _timer = null;
                }
            }

            if (Victims != null) Victims.Clear();
            if (Defenders != null) Defenders.Clear();
        }

19 Source : OscilloscopeViewModel.cs
with MIT License
from ABTSoftware

public void OnExampleExit()
        {
            lock (this)
            {
                if (_timer != null)
                {
                    _timer.Stop();
                    _timer.Elapsed -= OnTick;
                    _timer = null;
                }

                // Null to clear memory 
                _xVisibleRange = null;
                _yVisibleRange = null;

                ChartData = null;
            }
        }

19 Source : SpectrumAnalyzerExampleViewModel.cs
with MIT License
from ABTSoftware

public void OnExampleExit()
        {
            if (_updateTimer != null)
            {
                _updateTimer.Stop();
            }
        }

19 Source : RealTimePerformanceDemoView.xaml.cs
with MIT License
from ABTSoftware

private void Pause()
        {
            if (_running)
            {
                EnableInteractivity(true);
                _running = false;
                _timer.Stop();
                _timer.Elapsed -= OnTick;
                _timer = null;
            }

            sciChart.InvalidateElement();
        }

19 Source : ECGMonitorViewModel.cs
with MIT License
from ABTSoftware

public void OnExampleExit()
        {
            if (_timer != null)
            {
                _timer.Stop();
                _timer.Elapsed -= TimerElapsed;
                _timer = null;
            }
        }

19 Source : TimerRunner.cs
with MIT License
from ABTSoftware

public virtual void Run()
        {
            timer = new Timer();
            timer.Interval = 10; // 100Hz
            //timer.Interval = 1; // 100Hz

            ElapsedEventHandler tickHandler = null;
            tickHandler = (s, e) =>
                {
                    _testCallback();

                    lock (this)
                    {
                        if (_stopped) return;
                        if (_stopWatch.ElapsedMilliseconds > _duration.TotalMilliseconds)
                        {
                            _stopWatch.Stop();
                            _stopped = true;
                            timer.Elapsed -= tickHandler;
                            timer.Stop();
                            double fps = _frameCount/_stopWatch.Elapsed.TotalSeconds;
                            Application.Current.Dispatcher.BeginInvoke(new Action(() => _completedCallback(fps)));
                        }
                    }
                };

            timer.Elapsed += tickHandler;
            _stopWatch = Stopwatch.StartNew();
            timer.Start();
        }

19 Source : TimerRunner.cs
with MIT License
from ABTSoftware

public virtual void Dispose()
        {
            if (timer != null)
            {
                timer.Stop();
                timer = null;
            }
        }

19 Source : UserManager.cs
with Apache License 2.0
from ac87

public void SignOut()
        {
            if (_credential != null)
            {
                if (_tokenRefreshTimer != null)
                    _tokenRefreshTimer.Stop();

                _credential.RevokeTokenAsync(CancellationToken.None).Wait();

                foreach (string file in Directory.EnumerateFiles(Utils.GetDataStoreFolder()))
                {
                    if (file.Contains("-user"))
                    {
                        File.Delete(file);
                        return;
                    }
                }
            }

            _credential = null;
        }

19 Source : PropertyManager.cs
with GNU Affero General Public License v3.0
from ACEmulator

public static void ResyncVariables()
        {
            _workerThread.Stop();

            DoWork(null, null);

            _workerThread.Start();
        }

19 Source : PropertyManager.cs
with GNU Affero General Public License v3.0
from ACEmulator

public static void StopUpdating()
        {
            if (_workerThread != null)
                _workerThread.Stop();
        }

19 Source : WaitForTrigger.cs
with GNU General Public License v3.0
from Adam-Wilkinson

private void RemoveTrigger()
        {
            if (!isWaiting)
            {
                return;
            }

            isWaiting = false;
            resetTimer.Stop();
            triggerFlowInput.FlowInput.Activated -= TriggerFlowOut;
        }

19 Source : VideoPlayerRenderer.cs
with MIT License
from adamfisher

private void RegisterEvents()
        {
            // CurrentTime Setup
            _currentPositionTimer = new Timer(1000);
            _currentPositionTimer.Elapsed += (source, eventArgs) =>
            {
                if (_currentPositionTimer.Enabled && Control.Player != null)
                    Element.SetValue(VideoPlayer.CurrentTimePropertyKey, TimeSpan.FromMilliseconds(Control.CurrentPosition));
            };

            // Prepared
            Control.Prepared += OnPrepared;

            // Time Elapsed
            Control.TimeElapsed += (sender, args) => Element.OnTimeElapsed(CreateVideoPlayerEventArgs());

            // Completion
            Control.Completion += (sender, args) =>
            {
                _currentPositionTimer.Stop();
                Element.OnCompleted(CreateVideoPlayerEventArgs());
            };

            // Error
            Control.Error += (sender, args) =>
            {
                _currentPositionTimer.Stop();
                Element.OnFailed(CreateVideoPlayerErrorEventArgs(args.What));
            };

            // Play
            Control.Started += (sender, args) =>
            {
                _currentPositionTimer.Start();
                Element.OnPlaying(CreateVideoPlayerEventArgs());
            };

            // Paused
            Control.Paused += (sender, args) =>
            {
                _currentPositionTimer.Stop();
                Element.OnPaused(CreateVideoPlayerEventArgs());
            };

            // Stopped
            Control.Stopped += (sender, args) =>
            {
                _currentPositionTimer.Stop();
                Element.OnPaused(CreateVideoPlayerEventArgs());
            };
        }

19 Source : VideoView.cs
with MIT License
from adamfisher

private void OnError(object sender, MediaPlayer.ErrorEventArgs errorEventArgs)
        {
            _timer?.Stop();
            Status = MediaPlayerStatus.Error;
        }

19 Source : VideoView.cs
with MIT License
from adamfisher

private void OnCompletion(object sender, EventArgs e)
        {
            _timer?.Stop();
            Status = MediaPlayerStatus.PlaybackCompleted;
        }

19 Source : VideoView.cs
with MIT License
from adamfisher

public override void StopPlayback()
        {
            _timer?.Stop();
            base.StopPlayback();
            Status = MediaPlayerStatus.Idle;
            Stopped.RaiseEvent(this);
        }

19 Source : VideoView.cs
with MIT License
from adamfisher

public override void Pause()
        {
            _timer?.Stop();
            base.Pause();
            Status = MediaPlayerStatus.Paused;
            Paused.RaiseEvent(this);
        }

19 Source : RateLimitedSender.cs
with MIT License
from Aircoookie

private static void OnWaitPeriodOver(Object sender, ElapsedEventArgs e)
        {
            timer.Stop();
            if (!alreadySent)
            {
                target?.SendAPICall(toSend);
                alreadySent = true;
                timer.Start();
            }
        }

19 Source : TypeDelayTextBox.cs
with MIT License
from AkiniKites

private void OnTextChanged(object sender, EventArgs args)
        {
            if (EnableTypingEvent)
            {
                _timer.Enabled = true;
                _timer.Stop();
                _timer.Start();
            }
        }

19 Source : TypeDelayTextBox.cs
with MIT License
from AkiniKites

private void _timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            _timer.Stop();
            OnTypingFinished();
        }

19 Source : Noticer.cs
with MIT License
from AlaricGilbert

private void PreciousTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (Delta <= 10 && Delta >= -40)
            {
                PreciousTimer.Stop();
                Callback(this);
            }
        }

19 Source : Noticer.cs
with MIT License
from AlaricGilbert

public void Stop() => MainTimer.Stop();

19 Source : Noticer.cs
with MIT License
from AlaricGilbert

private void CheckTime(object sender, ElapsedEventArgs e)
        {
            if (Delta < 0)
                throw new Exception();
            if (Delta < 1500)
            {
                PreciousTimer.Start();
                MainTimer.Stop();
            }
        }

19 Source : MainView.cs
with GNU Affero General Public License v3.0
from alexander-pick

private void autoUpdateCheck_CheckedChanged(object sender, EventArgs e)
    {
      if (autoUpdateCheck.Checked)
      {
        status.Text = "Bot Mode";

        viewInventoryButton.Enabled = false;
        loginButton.Enabled = false;
        updateDatabaseButton.Enabled = false;
        updatePriceButton.Enabled = false;
        wantlistEditButton.Enabled = false;
        checkDisplayPriceButton.Enabled = false;
        checkWants.Enabled = false;

        runtimeIntervall.Enabled = false;

        logBox.AppendText("Timing MKM Update job every " + Convert.ToInt32(runtimeIntervall.Text) +
                          " minutes." + Environment.NewLine);

        timer.Elapsed += updatePriceEvent;

        timer.Start();
      }
      else
      {
        runtimeIntervall.Enabled = true;

        logBox.AppendText("Stopping MKM Update job." + Environment.NewLine);

        timer.Stop();

        status.Text = "Manual Mode";

        viewInventoryButton.Enabled = true;
        loginButton.Enabled = true;
        updateDatabaseButton.Enabled = true;
        updatePriceButton.Enabled = true;
        wantlistEditButton.Enabled = true;
        checkDisplayPriceButton.Enabled = true;
        checkWants.Enabled = true;
      }
    }

19 Source : NATSTransporter.cs
with MIT License
from alexandredenes

public void Stop()
        {
            _heartbeat.Stop();
            _molDiscoverySubscription.Unsubscribe();
            _molInfoSubscription.Unsubscribe();
            _molTargetedInfoSubscription.Unsubscribe();
            _molRequestSubscription.Unsubscribe();
            _molResponseSubscription.Unsubscribe();
            foreach(IAsyncSubscription subscription in _molRequestServiceSubscriptions)
            {
                subscription.Unsubscribe();
            }

            _conn.Close();
            _logger.LogInformation("NATS Transporter stoped");

        }

19 Source : PieceManager.cs
with MIT License
from aljazsim

public void Dispose()
        {
            this.CheckIfObjectIsDisposed();

            if (this.timer != null)
            {
                this.timer.Stop();
                this.timer.Enabled = false;
                this.timer.Dispose();
                this.timer = null;
            }
        }

19 Source : Tracker.cs
with MIT License
from aljazsim

public void StopTracking()
        {
            this.CheckIfObjectIsDisposed();

            Debug.WriteLine($"stopping tracking {this.TrackerUri} for torrent {this.TorrentInfoHash}");

            if (this.timer != null)
            {
                this.timer.Stop();
                this.timer.Enabled = false;
                this.timer.Dispose();
                this.timer = null;
            }

            this.OnStop();
        }

19 Source : OverlayBase`1.cs
with GNU General Public License v2.0
from AmanoTooko

public void Stop()
    {
      this.timer.Stop();
      this.xivWindowTimer.Stop();
    }

19 Source : OverlayBase`1.cs
with GNU General Public License v2.0
from AmanoTooko

public virtual void Dispose()
    {
      try
      {
        if (this.timer != null)
          this.timer.Stop();
        if (this.xivWindowTimer != null)
          this.xivWindowTimer.Stop();
        if (this.Overlay != null)
        {
          this.Overlay.Close();
          this.Overlay.Dispose();
        }

      }
      catch (Exception ex)
      {
        this.Log(LogLevel.Error, "清除: {0}", (object) ex);
      }
    }

19 Source : ServerHelper.cs
with MIT License
from AmazingDM

public static void UpdateInterval()
            {
                Timer.Stop();

                if (!ValueIsEnabled(Global.Settings.DetectionTick))
                    return;

                Timer.Interval = Global.Settings.DetectionTick * 1000;
                Task.Run(TestAllDelay);
                Timer.Start();
            }

19 Source : DelayedNotification.cs
with GNU General Public License v3.0
from AndreiFedarets

public void SetValue(T value)
        {
            lock (_lock)
            {
                _timer.Stop();
                _currentValue = value;
                _timer.Start();
            }
        }

19 Source : DockerMonitor.cs
with GNU General Public License v3.0
from Angelinsky7

public void Stop() {
            if (m_Timer != null) {
                m_Timer.Stop();
                m_Timer.Elapsed -= M_Timer_Elapsed;
                m_Timer.Dispose();
                m_Timer = null;
            }
            CleanNotifiers();
            LogMessage("Monitor stopped");
        }

19 Source : IconAnimation.cs
with GNU General Public License v3.0
from Angelinsky7

public void Stop() {
            if (m_Timer != null) {
                m_Timer.Stop();
                m_Timer.Elapsed -= M_Timer_ElapsedReversed;
                m_Timer.Elapsed -= M_Timer_Elapsed;
                m_Timer.Dispose();
                m_Timer = null;
            }
        }

19 Source : ServiceMonitor.cs
with GNU General Public License v3.0
from Angelinsky7

public void Release() {
            if (m_ServiceMonitor != null) {
                m_ServiceMonitor.Dispose();
                m_ServiceMonitor = null;
            }

            if (m_Timer != null) {
                m_Timer.Stop();
                m_Timer.Dispose();
                m_Timer = null;
            }
        }

19 Source : UpdateMonitor.cs
with GNU General Public License v3.0
from Angelinsky7

private void StopPolling() {
            if (m_Timer != null) {
                m_Timer.Elapsed -= M_Timer_Elapsed;
                m_Timer.Stop();
                m_Timer.Dispose();
                m_Timer = null;
            }
        }

19 Source : RequestBot.cs
with GNU Lesser General Public License v3.0
from angturil

public static void Clear()
            {                
                foreach (var ev in events) ev.timeq.Stop();
            }

19 Source : ClipBoardHook.cs
with Apache License 2.0
from AnkiUniversal

private void ClipBoardChangedHandle()
        {
            if (getCopyValue && System.Windows.Clipboard.ContainsText())
            {
                timeOutTimer.Stop();
                getCopyValue = false;
                var selectedText = System.Windows.Clipboard.GetText();
                ClipboardCopyFinished?.Invoke(selectedText, null);
            }
        }

19 Source : ChatLogWorker.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

public void End()
        {
            if (this.worker != null)
            {
                this.worker.Stop();
                this.worker.Dispose();
                this.worker = null;
            }

            this.Write();
            this.Close();
        }

19 Source : Settings.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

public void DeInit()
        {
            if (this.polonTimer != null)
            {
                this.polonTimer.Stop();
                this.polonTimer.Dispose();
                this.polonTimer = null;
            }
        }

19 Source : ChatLogWorker.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

public void Begin()
        {
            lock (this.LogBuffer)
            {
                this.LogBuffer.Clear();
            }

            if (this.worker != null)
            {
                this.worker.Stop();
                this.worker.Dispose();
                this.worker = null;
            }

            this.worker = new System.Timers.Timer(FlushInterval.TotalMilliseconds)
            {
                AutoReset = true,
            };

            this.worker.Elapsed += (x, y) => this.Write();
            this.worker.Start();
        }

19 Source : PluginMainWorker.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

public void End()
        {
            this.isOver = true;

            // Workerを開放する
            this.refreshSpellOverlaysWorker?.Stop();
            this.refreshTickerOverlaysWorker?.Stop();
            this.detectLogsWorker?.Abort();
            this.syncHotbarWorker?.Abort();

            this.refreshSpellOverlaysWorker = null;
            this.refreshTickerOverlaysWorker = null;
            this.detectLogsWorker = null;
            this.syncHotbarWorker = null;

            this.backgroudWorker?.Stop();
            this.backgroudWorker?.Dispose();
            this.backgroudWorker = null;

            // ログバッファを開放する
            if (this.LogBuffer != null)
            {
                this.LogBuffer.Dispose();
                this.LogBuffer = null;
            }

            // Windowを閉じる
            SpellsController.Instance.ClosePanels();
            TickersController.Instance.CloseTelops();
            SpellsController.Instance.ExecuteClosePanels();
            TickersController.Instance.ExecuteCloseTelops();

            // 設定を保存する
            Settings.Default.Save();
            SpellPanelTable.Instance.Save();
            SpellTable.Instance.Save();
            TickerTable.Instance.Save();
            TagTable.Instance.Save();

            // サウンドコントローラを停止する
            SoundController.Instance.End();

            // テーブルコンパイラを停止する
            TableCompiler.Instance.End();
            TableCompiler.Free();

            // FFXIVのスキャンを停止する
            XIVPluginHelper.Instance.End();
            XIVPluginHelper.Free();
        }

19 Source : TargetInfoModel.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

public static void GetFFLogsInfoFromTextCommand(
            string characterName,
            string serverName)
        {
            try
            {
                TextCommandTTLTimer.Stop();
                IsAvailableParseTotalTextCommand = true;

                if (string.IsNullOrEmpty(characterName) ||
                    string.IsNullOrEmpty(serverName))
                {
                    var player = CombatantsManager.Instance.Player;

                    if (string.IsNullOrEmpty(characterName))
                    {
                        characterName = player.Name;
                    }

                    if (string.IsNullOrEmpty(serverName))
                    {
                        serverName = player.WorldName;
                    }
                }

                var ti = CultureInfo.CurrentCulture.TextInfo;
                characterName = ti.ToreplacedleCase(characterName);
                serverName = ti.ToreplacedleCase(serverName);

                Task.Run(async () =>
                {
                    await TextCommandParseTotal.GetParseAsync(
                        characterName,
                        serverName,
                        Settings.Instance.FFLogs.ServerRegion,
                        null);
                });
            }
            finally
            {
                TextCommandTTLTimer.Interval = Settings.Instance.FFLogs.FromCommandTTL * 1000d;
                TextCommandTTLTimer.Start();
            }
        }

19 Source : VideoCapture.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

public void FinishRecording()
        {
            this.StopRecordingSubscriber?.Stop();

            lock (this)
            {
                if (!Config.Instance.IsRecording)
                {
                    return;
                }
            }

            if (!Config.Instance.IsEnabledRecording)
            {
                return;
            }

            if (!Config.Instance.UseObsRpc)
            {
                this.Input.Keyboard.ModifiedKeyStroke(
                    Config.Instance.StopRecordingShortcut.GetModifiers(),
                    Config.Instance.StopRecordingShortcut.GetKeys());
            }
            else
            {
                this.SendToggleRecording();
            }

            var contentName = !string.IsNullOrEmpty(this.contentName) ?
                this.contentName :
                ActGlobals.oFormActMain.CurrentZone;

            if (!string.IsNullOrEmpty(Config.Instance.VideoSaveDictory) &&
                Directory.Exists(Config.Instance.VideoSaveDictory))
            {
                Task.Run(async () =>
                {
                    var now = DateTime.Now;

                    var prefix = Config.Instance.VideFilePrefix.Trim();
                    prefix = string.IsNullOrEmpty(prefix) ?
                        string.Empty :
                        $"{prefix} ";

                    var deathCountText = this.deathCount > 1 ?
                        $" death{this.deathCount - 1}" :
                        string.Empty;

                    var f = $"{prefix}{this.startTime:yyyy-MM-dd HH-mm} {contentName} try{this.TryCount:00} {VideoDurationPlaceholder}{deathCountText}.ext";

                    await Task.Delay(TimeSpan.FromSeconds(8));

                    var files = Directory.GetFiles(
                        Config.Instance.VideoSaveDictory,
                        "*.*");

                    var original = files
                        .OrderByDescending(x => File.GetLastWriteTime(x))
                        .FirstOrDefault();

                    if (!string.IsNullOrEmpty(original))
                    {
                        var timestamp = File.GetLastWriteTime(original);
                        if (timestamp >= now.AddSeconds(-10))
                        {
                            var ext = Path.GetExtension(original);
                            f = f.Replace(".ext", ext);

                            var dest = Path.Combine(
                                Path.GetDirectoryName(original),
                                f);

                            using (var tf = TagLib.File.Create(original))
                            {
                                dest = dest.Replace(
                                    VideoDurationPlaceholder,
                                    $"{tf.Properties.Duration.TotalSeconds:N0}s");

                                tf.Tag.replacedle = Path.GetFileNameWithoutExtension(dest);
                                tf.Tag.Subreplacedle = $"{prefix} - {contentName}";
                                tf.Tag.Album = $"FFXIV - {contentName}";
                                tf.Tag.AlbumArtists = new[] { "FFXIV", this.playerName }.Where(x => !string.IsNullOrEmpty(x)).ToArray();
                                tf.Tag.Genres = new[] { "Game" };
                                tf.Tag.Comment =
                                    $"{prefix} - {contentName}\n" +
                                    $"{this.startTime:yyyy-MM-dd HH:mm} try{this.TryCount}{deathCountText}";
                                tf.Save();
                            }

                            File.Move(
                                original,
                                dest);

                            XIVLogPlugin.Instance.EnqueueLogLine(
                                "00",
                                $"[XIVLog] The video was saved. {Path.GetFileName(dest)}");
                        }
                    }
                });
            }

            WPFHelper.InvokeAsync(() =>
            {
                lock (this)
                {
                    Config.Instance.IsRecording = false;
                }
            });
        }

See More Examples