public void StartCollection() { this.CurrentUser = ZAMsettings.Settings.CurrentUser; foreach (MovingAverageWrapper maw in m_maCollection.Values) { maw.MovingAverage.Start(); } m_normalizedPower.Start(); refreshTimer.Enabled = true; m_collectionStartTime = DateTime.Now; this.ResetCounters(); }
/// <summary> /// Starts the data collectors and sets menu item enabled statuses accordingly. /// </summary> private async void Collection_OnStart() { if (!m_isStarted) { m_isStarted = true; // update all the menu items accordingly OnCollectionStatusChanged(); m_cancellationTokenSource = new CancellationTokenSource(); // Start a thread to wait for the PlayerState.Time to become non-zero. // This can be cancelled by selecting Stop from the menu. await WaitForRiderStartAsync(m_cancellationTokenSource.Token); bool cancelled = m_cancellationTokenSource.IsCancellationRequested; m_cancellationTokenSource = null; if (cancelled) { m_logger.LogInformation($"Collection_OnStart - Cancelled"); return; } foreach (MovingAverageWrapper maw in m_maCollection.Values) { maw.MovingAverage.Start(); } m_normalizedPower.Start(); m_collectionStart = DateTime.Now; runTimer.Enabled = true; m_summaryRefreshCount = 0; m_lastSummaryRefresh = DateTime.Now; m_lastViewerRefresh = DateTime.Now; m_logger.LogInformation($"Collection_OnStart"); } }