System.Timers.Timer.Start()

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

1088 Examples 7

19 Source : Net40.cs
with MIT License
from 2881099

public static Task Delay(TimeSpan timeout)
        {
            var tcs = new TaskCompletionSource<object>();
            var timer = new System.Timers.Timer(timeout.TotalMilliseconds) { AutoReset = false };
            timer.Elapsed += delegate { timer.Dispose(); tcs.SetResult(null); };
            timer.Start();
            return tcs.Task;
        }

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

public override void init(int op, String src, String dest, long max)
        {
            this.max = max;
            elapsed = 0;
            timer = new System.Timers.Timer(1000);
            timer.Start();
            timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
        }

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

private void OnStart()
        {
            if (!IsLoaded) return;

            string whatData = (string)DataCombo.SelectedItem;
            int w = 0, h = 0;
            if (whatData == "3D Sinc 10 x 10") w = h = 10;
            if (whatData == "3D Sinc 50 x 50") w = h = 50;
            if (whatData == "3D Sinc 100 x 100") w = h = 100;
            if (whatData == "3D Sinc 500 x 500") w = h = 500;
            if (whatData == "3D Sinc 1k x 1k") w = h = 1000;

            lock (_syncRoot)
            {
                OnStop();
            }

            var dataSeries = new UniformGridDataSeries3D<double>(w, h)
            {
                StartX = 0, 
                StartZ = 0, 
                StepX = 10 / (w - 1d), 
                StepZ = 10 / (h - 1d),
                SeriesName = "Realtime Surface Mesh",
            };

            var frontBuffer = dataSeries.InternalArray;
            var backBuffer = new GridData<double>(w, h).InternalArray;

            int frames = 0;            
            _timer = new Timer();
            _timer.Interval = 20;
            _timer.Elapsed += (s, arg) =>
            {
                lock (_syncRoot)
                {
                    double wc = w*0.5, hc = h*0.5;
                    double freq = Math.Sin(frames++*0.1)*0.1 + 0.1;

                    // Each set of dataSeries[i,j] schedules a redraw when the next Render event fires. Therefore, we suspend updates so that we can update the chart once
                    // Data generation (Sin, Sqrt below) is expensive. We parallelize it by using Parallel.For for the outer loop
                    //  Equivalent of "for (int j = 0; j < h; j++)"
                    // This will result in more CPU usage, but we wish to demo the performance of the actual rendering, not the slowness of generating test data! :)
                    Parallel.For(0, h, i =>
                    {
                        var buf = frontBuffer;
                        for (int j = 0; j < w; j++)
                        {
                            // 3D Sinc function from http://www.mathworks.com/matlabcentral/cody/problems/1305-creation-of-2d-sinc-surface
                            // sin(pi*R*freq)/(pi*R*freq)
                            // R is distance from centre

                            double radius = Math.Sqrt((wc - i)*(wc - i) + (hc - j)*(hc - j));
                            var d = Math.PI*radius*freq;
                            var value = Math.Sin(d)/d;
                            buf[i][j] = double.IsNaN(value) ? 1.0 : value;
                        }
                    });

                    using (dataSeries.SuspendUpdates(false, true))
                    {
                        dataSeries.CopyFrom(frontBuffer);
                        var temp = backBuffer;
                        backBuffer = frontBuffer;
                        frontBuffer = temp;
                    }
                }
            };
            SurfaceMesh.DataSeries = dataSeries;
            _timer.Start();
            StartButton.IsEnabled = false;
            PauseButton.IsEnabled = true;
        }

19 Source : EEGExampleViewModel.cs
with MIT License
from ABTSoftware

private void Start()
        {
            if (_channelViewModels == null || _channelViewModels.Count == 0)
            {
                Reset();
            }

            if (!IsRunning)
            {
                IsRunning = true;
                IsReset = false;

                _timer = new Timer(_timerInterval);
                _timer.Elapsed += OnTick;
                _timer.AutoReset = true;
                _timer.Start();
            }
        }

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

private void OnExampleLoaded(object sender, RoutedEventArgs e)
        {
            ClearDataSeries();

            _timerNewDataUpdate.Start();
        }

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

private void StartButton_Click(object sender, RoutedEventArgs e)
        {
            StartButton.IsChecked = true;
            PauseButton.IsChecked = false;
            ResetButton.IsChecked = false;

            IsFifoCheckBox.IsEnabled = false;

            // Start a timer to create new data and append on each tick
            _timerNewDataUpdate.Start();
        }

19 Source : UpdateScatterPointsViewModel.cs
with MIT License
from ABTSoftware

private void OnRunExample()
        {
            OnStopExample();

            _simulation = new World(_pointCount);
            _simulation.Populate();

            Victims = _seriesPool.Get();
            Defenders = _seriesPool.Get();

            // We can append on a background thread. the simulation is computationally expensive
            // so we move this to another thread. 
            _timer = new Timer(1000.0 / 60.0);
            _timer.Elapsed += OnTimerElapsed;
            _timer.Start();     
        }

19 Source : SpectrumAnalyzerExampleViewModel.cs
with MIT License
from ABTSoftware

public void OnExampleEnter()
        {
            if (_updateTimer != null)
            {
                _updateTimer.Start();
            }
        }

19 Source : NoLockTimer.cs
with MIT License
from ABTSoftware

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

19 Source : ECGMonitorViewModel.cs
with MIT License
from ABTSoftware

public void OnExampleEnter()
        {
            _timer = new Timer(TimerInterval) { AutoReset = true };
            _timer.Elapsed += TimerElapsed;
            _timer.Start();
        }

19 Source : OscilloscopeViewModel.cs
with MIT License
from ABTSoftware

public void OnExampleEnter()
        {
            ChartData = new XyDataSeries<double, double>();
            SelectedDataSource = "Fourier Series";
            IsCursorSelected = true;

            _timer = new Timer(TimerIntervalMs) { AutoReset = true };
            _timer.Elapsed += OnTick;
            _timer.Start();
        }

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

private void Start()
        {
            if (!_running)
            {
                EnableInteractivity(false);
                _running = true;
                _stopWatch.Start();
                _timer = new Timer(TimerInterval);
                _timer.Elapsed += OnTick;
                _timer.AutoReset = true;
                _timer.Start();
            }

            sciChart.InvalidateElement();
        }

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 : UserManager.cs
with Apache License 2.0
from ac87

private void StartRefreshTimer()
        {
            if (_tokenRefreshTimer == null)
                CreateRefreshTimer();
            _tokenRefreshTimer.Start();
        }

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

public static void Initialize(bool loadDefaultValues = true)
        {
            if (loadDefaultValues)
                DefaultPropertyManager.LoadDefaultProperties();

            LoadPropertiesFromDB();

            if (Program.IsRunningInContainer && !GetString("content_folder").Equals("/ace/Content"))
                ModifyString("content_folder", "/ace/Content");

            _workerThread = new Timer(300000);
            _workerThread.Elapsed += DoWork;
            _workerThread.AutoReset = true;
            _workerThread.Start();
        }

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 : WaitForTrigger.cs
with GNU General Public License v3.0
from Adam-Wilkinson

public void Evaluate()
        {
            if (isWaiting)
            {
                return;
            }

            triggerFlowInput.FlowInput.Activated += TriggerFlowOut;
            isWaiting = true;
            if ((bool)hasTimeout["display"])
            {
                resetTimer.Interval = TimeoutTime.GetInput<double>() * 1000;
                resetTimer.Start();
            }
        }

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

public override void Start()
        {
            base.Start();
            Status = MediaPlayerStatus.Playing;
            Started.RaiseEvent(this);

            if (TimeElapsedInterval > 0)
                _timer?.Start();
        }

19 Source : SearchAutomation.cs
with MIT License
from ADeltaX

public static void PreExecute()
        {
            //Launch an immediate search
            Execute();

            var periodTimeSpan = TimeSpan.FromSeconds(60);
            _timerUpdates = new Timer();
            _timerUpdates.Interval = periodTimeSpan.TotalMilliseconds;
            _timerUpdates.Elapsed += (s, e) => {
                Console.WriteLine("Standard period-triggered scan");
                Execute();
            };
            _timerUpdates.Start();
        }

19 Source : SsdpClient.cs
with MIT License
from aguang-xyz

public void StartDiscovery()
        {
            lock (this)
            {
                if (!_searchTimer.Enabled)
                {
                    _searchTimer.Elapsed += SearchAndWaitForReplies;
                    _searchTimer.Start();
                }

                if (!_checkTimer.Enabled)
                {
                    _checkTimer.Elapsed += CheckNotifications;
                    _checkTimer.Start();
                }

                if (!_healthCheckTimer.Enabled)
                {
                    _healthCheckTimer.Elapsed += HealthCheck;
                    _healthCheckTimer.Start();
                }
            }
        }

19 Source : RateLimitedSender.cs
with MIT License
from Aircoookie

public static void SendAPICall(WLEDDevice t, string call)
        {
            if (timer.Enabled)
            {
                //Save to send once waiting period over
                target = t;
                toSend = call;
                alreadySent = false;
                return;
            }
            timer.Start();
            t?.SendAPICall(call);
            alreadySent = true;
        }

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 : Program.cs
with Apache License 2.0
from AKruimink

private static void Main()
        {
            s_autoCloseTimer = new Timer(20000); // 20 seconds
            s_autoCloseTimer.Elapsed += OnAutoCloseTimer;
            s_autoCloseTimer.Start();

            Console.ReadKey();
        }

19 Source : App.xaml.cs
with Apache License 2.0
from AKruimink

protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            _autoCloseTimer = new Timer(20000); // 20 seconds
            _autoCloseTimer.Elapsed += OnAutoCloseTimer;
            _autoCloseTimer.Start();

            var window = new MainWindow();
            window.Show();
        }

19 Source : Noticer.cs
with MIT License
from AlaricGilbert

public void Start(NoticerElapsedCallback callback)
        {
            if (Delta < 0)
                throw new ArgumentOutOfRangeException("Target time should be after the current time.");
            Callback = callback;
            MainTimer = new Timer(1000);
            MainTimer.Elapsed += CheckTime;
            PreciousTimer = new Timer(20);
            PreciousTimer.Elapsed += PreciousTimer_Elapsed;
            MainTimer.Start();
        }

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 : MoleculerService.cs
with MIT License
from alexandredenes

private void OnStarted()
        {
            _logger.LogInformation("MoleculerService starting");

            _transporter.HeartbeatReceived += _transporter_HeartbeatReceived;
            _transporter.RequestReceived += _transporter_RequestReceived;
            _transporter.DiscoverReceived += _transporter_DiscoverReceived;
            _transporter.InfoReceived += _transporter_InfoReceived;


            _transporter.Start(_serviceInfo);

            _logger.LogInformation("MoleculerService started");

            _heartbeat = new System.Timers.Timer(HEARTBEAT_PERIOD);
            _heartbeat.Elapsed += _heartbeat_Elapsed;
            _heartbeat.Start();

            DiscoverMessage discoverMessage = DiscoverMessage.Parse(_serviceInfo);
            _transporter.Publish("MOL.DISCOVER", discoverMessage);
        }

19 Source : NATSTransporter.cs
with MIT License
from alexandredenes

private void BeginHeartBeatingListener()
        {
            EventHandler<MsgHandlerEventArgs> handler = (sender, args) =>
            {
                if(HeartbeatReceived == null)
                {
                    _logger.LogError("No HeatbeatEventHandler defined");
                }
                else
                {
                    HeartbeatReceived("MOL.HEARTBEAT", null);
                }
            };
            _molHeartbeatSubscription = _conn.SubscribeAsync("MOL.HEARTBEAT", handler);

            _heartbeat = new Timer(4000);
            _heartbeat.Elapsed += _heartbeat_Elapsed;
            _heartbeat.Start();
        }

19 Source : Counter.cs
with Apache License 2.0
from AlexWan

public void Start()
        {
            var process = Process.GetCurrentProcess();

            _cpuCounter = ProcessCpuCounter.GetPerfCounterForProcessId(process.Id);
            _ramCounter = ProcessCpuCounter.GetPerfCounterForProcessId(process.Id, "Working Set - Private");

            System.Timers.Timer t = new System.Timers.Timer(1000);
            t.Elapsed += new ElapsedEventHandler(TimerElapsed);
            t.Start();
        }

19 Source : ProcessManager.cs
with Apache License 2.0
from AlexWan

public void Start()
        {
            RamAll = new Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory / 1048576;

            _cpuCounter = new PerformanceCounter();
            _cpuCounter.CategoryName = "Processor";
            _cpuCounter.CounterName = "% Processor Time";
            _cpuCounter.InstanceName = "_Total";
            _ramCounter = new PerformanceCounter("Memory", "Available MBytes");

            System.Timers.Timer t = new System.Timers.Timer(1000);
            t.Elapsed += new ElapsedEventHandler(TimerElapsed);
            t.Start();
        }

19 Source : Program.cs
with MIT License
from aljazsim

public static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            TorrentInfo.TryLoad(@".\..\..\Test\TorrentClientTest.Data\TorrentFile.torrent", out torrent);

            torrentClient = new TorrentClient.TorrentClient(4000, @".\Test"); // listening port, base torrent data directory
            torrentClient.DownloadSpeedLimit = 100 * 1024; // 100 KB/s
            torrentClient.UploadSpeedLimit = 200 * 1024; // 200 KB/s
            torrentClient.TorrentHashing += TorrentClient_TorrentHashing;
            torrentClient.TorrentLeeching += TorrentClient_TorrentLeeching;
            torrentClient.TorrentSeeding += TorrentClient_TorrentSeeding;
            torrentClient.TorrentStarted += TorrentClient_TorrentStarted;
            torrentClient.TorrentStopped += TorrentClient_TorrentStopped;
            torrentClient.Start(); // start torrent client
            torrentClient.Start(torrent); // start torrent file

            // setup checkout timer
            var timer = new System.Timers.Timer();
            timer.Interval = 10000;
            timer.Elapsed += Timer_Elapsed;
            timer.Enabled = true;
            timer.Start();

            Thread.Sleep(10000000);
        }

19 Source : Tracker.cs
with MIT License
from aljazsim

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

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

            this.OnStart();

            this.timer = new System.Timers.Timer();
            this.timer.Interval = TimeSpan.FromSeconds(1).TotalMilliseconds;
            this.timer.Elapsed += this.Timer_Elapsed;
            this.timer.Enabled = true;
            this.timer.Start();
        }

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

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

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 : ToastTimer.cs
with MIT License
from andrius-k

public void Start()
        {
            _timer.Elapsed += Timer_Elapsed;
            _timer.Start();
        }

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

public void Start() {
            Stop();

            m_Timer = new Timer() {
                Interval = m_Speed
            };
            if (Reverse) {
                m_Tick = m_Icons.Count - 1;
                m_Timer.Elapsed += M_Timer_ElapsedReversed;
            } else {
                m_Tick = 0;
                m_Timer.Elapsed += M_Timer_Elapsed;
            }
            m_Timer.Start();
        }

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

private void Poll() {
            m_Timer = new Timer(500);
            m_Timer.Elapsed += M_Timer_Elapsed;
            m_Timer.Start();
        }

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

private void StartPolling() {
            StopPolling();

            m_Timer = new System.Timers.Timer() {
                Interval = POLLING_INTERVAL,
            };
            m_Timer.Elapsed += M_Timer_Elapsed;
            m_Timer.Start();
        }

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

public void Start() {
            m_Timer = new Timer() {
                Interval = m_PollingInterval,
                AutoReset = true,
                Enabled = false
            };
            m_FirstConnection = true;
            m_Timer.Elapsed += M_Timer_Elapsed;
            m_Timer.Start();
            LogMessage("Monitor started");
        }

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

public void CopyFromActiveProgram()
        {
            getCopyValue = true;
            System.Windows.Forms.SendKeys.SendWait("^c");
            timeOutTimer.Start();
        }

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

public void Start(
            Func<bool> isBusyCallback = null)
        {
            lock (LockObject)
            {
                if (this.isStarted)
                {
                    return;
                }

                this.isStarted = true;

                if (this.LazyTimer.Value.Enabled)
                {
                    return;
                }

                ServicePointManager.DefaultConnectionLimit = 32;
                ServicePointManager.SecurityProtocol &= ~SecurityProtocolType.Tls;
                ServicePointManager.SecurityProtocol &= ~SecurityProtocolType.Tls11;
                ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;

                if (isBusyCallback != null)
                {
                    this.isBusyCallback = isBusyCallback;
                }

                Task.Run(async () =>
                {
                    if (this.LazyTimer.Value.Enabled)
                    {
                        return;
                    }

                    while (!ActGlobals.oFormActMain.InitActDone)
                    {
                        await Task.Delay(300);
                    }

                    await Task.Delay(TimeSpan.FromMinutes(1));

                    this.LazyTimer.Value.Start();
                    RefreshAccountList();
                });
            }
        }

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

public async void Begin()
        {
            this.isOver = false;

            // ログバッファを生成する
            this.LogBuffer = new LogBuffer();

            // FFXIVのスキャンを開始する
            // FFXIVプラグインへのアクセスを開始する
            await Task.Run(() => XIVPluginHelper.Instance.Start(
                Settings.Default.LogPollSleepInterval,
                Settings.Default.FFXIVLocale));

            await Task.Run(() =>
            {
                // テーブルコンパイラを開始する
                TableCompiler.Instance.Begin();

                // サウンドコントローラを開始する
                SoundController.Instance.Begin();
            });

            // Overlayの更新スレッドを開始する
            this.BeginOverlaysThread();

            // ログ監視タイマを開始する
            this.detectLogsWorker = new ThreadWorker(
                () => this.DetectLogsCore(),
                0,
                nameof(this.detectLogsWorker));

            // ホットバー同期タイマを開始する
            this.syncHotbarWorker = new ThreadWorker(
                () => this.SyncHotbarCore(),
                SyncHotbarInterval,
                nameof(this.syncHotbarWorker),
                ThreadPriority.BelowNormal);

            // Backgroudスレッドを開始する
            this.backgroudWorker = new System.Timers.Timer();
            this.backgroudWorker.AutoReset = true;
            this.backgroudWorker.Interval = 5000;
            this.backgroudWorker.Elapsed += (s, e) =>
            {
                this.BackgroundCore();
            };

            this.detectLogsWorker.Run();
            this.syncHotbarWorker.Run();
            this.backgroudWorker.Start();
        }

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

private static void SyncSpeak(
            string tts,
            AdvancedNoticeConfig config,
            bool sync = false,
            int priority = 0)
        {
            if (string.IsNullOrEmpty(tts))
            {
                return;
            }

            if (!sync)
            {
                SpeakCore(tts, config);
                return;
            }

            if (!PlayBridge.Instance.IsSyncAvailable)
            {
                var period = Settings.Default.UILocale == Locales.JA ? "、" : ",";
                if (tts.EndsWith(period))
                {
                    tts += period;
                }
            }

            lock (SyncList)
            {
                var interval = Settings.Default.WaitingTimeToSyncTTS / 4d;

                SyncList.Add(new SyncTTS(SyncList.Count, priority, tts, config));
                SyncListTimestamp = DateTime.Now;
                SyncListCount = SyncList.Count;

                SyncSpeakTimer.Interval = interval;

                if (!SyncSpeakTimer.Enabled)
                {
                    SyncSpeakTimer.Start();
                }
            }
        }

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 StartRecording()
        {
            lock (this)
            {
                if (Config.Instance.IsRecording)
                {
                    return;
                }
            }

            this.TryCount++;
            this.startTime = DateTime.Now;

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

            WPFHelper.InvokeAsync(async () =>
            {
                if (Config.Instance.IsEnabledRecording)
                {
                    lock (this)
                    {
                        Config.Instance.IsRecording = true;
                    }
                }

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

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

                this.playerName = CombatantsManager.Instance.Player.Name;

                if (Config.Instance.IsShowreplacedleCard)
                {
                    replacedleCardView.ShowreplacedleCard(
                        contentName,
                        this.TryCount,
                        this.startTime);
                }
            });

            if (Config.Instance.StopRecordingAfterCombatMinutes > 0)
            {
                lock (this)
                {
                    if (this.StopRecordingSubscriber == null)
                    {
                        var interval = Config.Instance.StopRecordingSubscribeInterval;
                        if (interval <= 0)
                        {
                            interval = 10;
                        }

                        this.StopRecordingSubscriber = new System.Timers.Timer(interval * 1000);
                        this.StopRecordingSubscriber.Elapsed += (_, __) => this.DetectStopRecording();
                    }

                    this.endCombatDateTime = DateTime.Now;
                    this.StopRecordingSubscriber.Start();
                }
            }
        }

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

public void Run()
        {
            this.isAbort = false;

            this.timer = new Timer();
            this.timer.Interval = this.Interval;
            this.timer.Elapsed += this.Elapsed;
            this.timer.Start();

            Logger.Trace($"TimerWorker - {this.Name} start.");
        }

See More Examples