/// <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() { MainView.RefreshListViews(true); SplitsView.ClearListView(); LapView.ClearListView(); // Remove all moving average collectors and ListView items MainView.ClearViewerItems(); // 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 (MainView.CountViewerItems < 3) { DurationType result; if (Enum.TryParse <DurationType>(tsmi.Tag.ToString(), true, out result)) { MainView.AddViewerItem(result, tsmi.Text); } else { throw new ApplicationException($"Bug: The menuitem tag {tsmi.Tag} for menuitem {tsmi.Text} did not match any DurationType Enums."); } } else { tsmi.Checked = false; } } } }
private void OnCollectionStatusChanged() { if (m_isStarted) { // Clear any values on the screen MainView.RefreshListViews(true); SplitsView.ClearListView(); LapView.ClearListView(); tsmiStop.Enabled = true; tsmiStart.Enabled = false; tsmi10min.Enabled = false; tsmi1min.Enabled = false; tsmi20min.Enabled = false; tsmi30min.Enabled = false; tsmi30sec.Enabled = false; tsmi5min.Enabled = false; tsmi5sec.Enabled = false; tsmi6min.Enabled = false; tsmi60min.Enabled = false; tsmi90min.Enabled = false; tsmiTimer.Enabled = false; tsmiOptions.Enabled = false; tsmiAdvanced.Enabled = false; } else { tsmiStop.Enabled = false; tsmiStart.Enabled = true; tsmi10min.Enabled = true; tsmi1min.Enabled = true; tsmi20min.Enabled = true; tsmi30min.Enabled = true; tsmi30sec.Enabled = true; tsmi5min.Enabled = true; tsmi5sec.Enabled = true; tsmi6min.Enabled = true; tsmi60min.Enabled = true; tsmi90min.Enabled = true; tsmiTimer.Enabled = true; tsmiOptions.Enabled = true; tsmiAdvanced.Enabled = true; tsmiSetupTimer.Enabled = true; tsmiStopTimer.Enabled = false; // set Timer menu sub-items if (countdownTimer.Enabled) { // Clear any values on the screen MainView.RefreshListViews(true); SplitsView.ClearListView(); LapView.ClearListView(); tsmiSetupTimer.Enabled = false; tsmiStopTimer.Enabled = true; tsmiStart.Enabled = false; tsmiOptions.Enabled = false; tsmiAdvanced.Enabled = false; } if (ZAMsettings.ZPMonitorService.IsStarted) { tsslStatus.Text = "Select Analyze->Start to begin"; } else { tsslStatus.Text = "ZPM Service Not Running"; } } }