/// <summary> /// Stops the data collectors and sets menu item enabled statuses accordingly. /// </summary> private void Collection_OnStop() { if (m_isStarted) { if (m_cancellationTokenSource == null) { foreach (MovingAverageWrapper maw in m_maCollection.Values) { maw.MovingAverage.Stop(); } m_normalizedPower.Stop(); runTimer.Enabled = false; } else { // Cancel the waiting thread m_cancellationTokenSource.Cancel(); } m_isStarted = false; OnCollectionStatusChanged(); m_logger.LogInformation($"Collection_OnStop"); } }
public void StopCollection() { foreach (MovingAverageWrapper maw in m_maCollection.Values) { maw.MovingAverage.Stop(); } m_normalizedPower.Stop(); refreshTimer.Enabled = false; m_collectionDuration = DateTime.Now - m_collectionStartTime; }