/// <summary>
        /// Load and initialize the moving average collection wrapper collection based upon the current menu item checked settings.
        ///
        /// This is called on form load and also when menu items change.
        /// </summary>
        private void LoadMovingAverageCollection()
        {
            // empty the MovingAverageWrapper dictionary
            m_maCollection.Clear();

            // Clear the ListView
            lvViewer.Items.Clear();

            //m_labelHelpers.ForEach(helper => helper.ClearLabels(true));
            //tsslOverall.Text = "";

            // Loop through the menu items within the Collect menu.
            // If an item is checked, we want to create a collector for it.
            // The collector duration is determined by a match between the menu item's tag and the DurationType Enum.
            // Up to 3 items can be shown.
            // The label on the UI gets the same text as the menu item.
            foreach (ToolStripItem mi in tsmiAnalyze.DropDownItems)
            {
                ToolStripMenuItem tsmi = mi as ToolStripMenuItem;
                if (tsmi == null)
                {
                    continue;
                }

                if (tsmi.Checked)
                {
                    if (m_maCollection.Count < 3)
                    {
                        DurationType result;
                        if (Enum.TryParse <DurationType>(tsmi.Tag.ToString(), true, out result))
                        {
                            MovingAverage ma = new MovingAverage(m_zpMonitorService, m_loggerFactory, result, false);

                            ma.MovingAverageChangedEvent    += MovingAverageChangedEventHandler;
                            ma.MovingAverageMaxChangedEvent += MovingAverageMaxChangedEventHandler;

                            // Initialize and add item to ListView
                            ViewerListViewItem lvi = new ViewerListViewItem(new ViewerItem(tsmi.Text));
                            this.lvViewer.Items.Add(lvi);

                            Collector collector = ZAMsettings.Settings.Collectors[tsmi.Text];

                            m_maCollection.Add(result, new MovingAverageWrapper(ma, lvi, collector));

                            // Here we assign the row's id text (5 sec, 1 min, etc) and associate the matching Collector.
                            // All of this makes it easy to update the display as the MovingAverage events fire.
                            //m_labelHelpers[labelSet].MovingAvg.Text = tsmi.Text;
                            //m_labelHelpers[labelSet].Collector = ZAMsettings.Settings.Collectors[tsmi.Text];

                            if (m_maCollection.Count >= 3) // only allow up to 3 collectors
                            {
                                break;
                            }
                        }
                        else
                        {
                            throw new ApplicationException($"Bug: The menuitem tag {tsmi.Tag} for menuitem {tsmi.Text} did not match any DurationType Enums.");
                        }
                    }
                    else
                    {
                        tsmi.Checked = false;
                    }
                }
            }
        }
 public MovingAverageWrapper(MovingAverage movingAverage, ViewerListViewItem viewerListViewItem, Collector collector)
 {
     MovingAverage      = movingAverage;
     ViewerListViewItem = viewerListViewItem;
     Collector          = collector;
 }