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 View Source File : DockerMonitor.cs
License : GNU General Public License v3.0
Project Creator : 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 View Source File : ChatLogWorker.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : 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 View Source File : VideoView.cs
License : MIT License
Project Creator : adamfisher

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

19 View Source File : OverlayBase`1.cs
License : GNU General Public License v2.0
Project Creator : AmanoTooko

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

19 View Source File : TypeDelayTextBox.cs
License : MIT License
Project Creator : AkiniKites

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

19 View Source File : WaitForTrigger.cs
License : GNU General Public License v3.0
Project Creator : Adam-Wilkinson

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

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

19 View Source File : RequestBot.cs
License : GNU Lesser General Public License v3.0
Project Creator : angturil

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

19 View Source File : SpectrumAnalyzerExampleViewModel.cs
License : MIT License
Project Creator : ABTSoftware

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

19 View Source File : VideoCapture.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : 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;
                }
            });
        }

19 View Source File : ECGMonitorViewModel.cs
License : MIT License
Project Creator : ABTSoftware

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

19 View Source File : PieceManager.cs
License : MIT License
Project Creator : aljazsim

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

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

19 View Source File : Noticer.cs
License : MIT License
Project Creator : AlaricGilbert

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

19 View Source File : PropertyManager.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator

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

            DoWork(null, null);

            _workerThread.Start();
        }

19 View Source File : ServerHelper.cs
License : MIT License
Project Creator : 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 View Source File : UpdateScatterPointsViewModel.cs
License : MIT License
Project Creator : ABTSoftware

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

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

19 View Source File : ServiceMonitor.cs
License : GNU General Public License v3.0
Project Creator : 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 View Source File : VideoView.cs
License : MIT License
Project Creator : adamfisher

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

19 View Source File : ChatLogWorker.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : anoyetta

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

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

19 View Source File : EEGExampleViewModel.cs
License : MIT License
Project Creator : ABTSoftware

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

19 View Source File : TargetInfoModel.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : 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 View Source File : RateLimitedSender.cs
License : MIT License
Project Creator : Aircoookie

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

19 View Source File : TypeDelayTextBox.cs
License : MIT License
Project Creator : AkiniKites

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

19 View Source File : RealTimeCursors.xaml.cs
License : MIT License
Project Creator : ABTSoftware

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

19 View Source File : Noticer.cs
License : MIT License
Project Creator : AlaricGilbert

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

19 View Source File : TimerRunner.cs
License : MIT License
Project Creator : 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 View Source File : NATSTransporter.cs
License : MIT License
Project Creator : 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 View Source File : Noticer.cs
License : MIT License
Project Creator : AlaricGilbert

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

19 View Source File : UserManager.cs
License : Apache License 2.0
Project Creator : 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 View Source File : Tracker.cs
License : MIT License
Project Creator : 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 View Source File : NoLockTimer.cs
License : MIT License
Project Creator : ABTSoftware

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

19 View Source File : OverlayBase`1.cs
License : GNU General Public License v2.0
Project Creator : 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 View Source File : PropertyManager.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator

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

19 View Source File : DelayedNotification.cs
License : GNU General Public License v3.0
Project Creator : AndreiFedarets

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

19 View Source File : CreateRealTime3DUniformMeshChart.xaml.cs
License : MIT License
Project Creator : ABTSoftware

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

19 View Source File : IconAnimation.cs
License : GNU General Public License v3.0
Project Creator : 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 View Source File : VideoPlayerRenderer.cs
License : MIT License
Project Creator : 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 View Source File : UpdateMonitor.cs
License : GNU General Public License v3.0
Project Creator : Angelinsky7

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

19 View Source File : OscilloscopeViewModel.cs
License : MIT License
Project Creator : 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 View Source File : ClipBoardHook.cs
License : Apache License 2.0
Project Creator : 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 View Source File : VideoView.cs
License : MIT License
Project Creator : adamfisher

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

19 View Source File : Settings.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : anoyetta

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

19 View Source File : ProcessResult.cs
License : MIT License
Project Creator : abanu-org

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

19 View Source File : PluginMainWorker.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : 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 View Source File : VideoView.cs
License : MIT License
Project Creator : adamfisher

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

19 View Source File : RealTimePerformanceDemoView.xaml.cs
License : MIT License
Project Creator : ABTSoftware

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

            sciChart.InvalidateElement();
        }

19 View Source File : MyProgressMonitor.cs
License : Apache License 2.0
Project Creator : 214175590

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

            transferEnd(id);
        }

19 View Source File : ProcessResult.cs
License : MIT License
Project Creator : 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 View Source File : RealtimeFifoChartView.xaml.cs
License : MIT License
Project Creator : ABTSoftware

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

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

            IsFifoCheckBox.IsEnabled = false;
        }

19 View Source File : TimerRunner.cs
License : MIT License
Project Creator : ABTSoftware

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

19 View Source File : MainView.cs
License : GNU Affero General Public License v3.0
Project Creator : 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;
      }
    }

See More Examples