Пример #1
0
        /// <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");
            }
        }
Пример #2
0
        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;
        }