private void InitMetric(string metricHeaderListString, string metricTypeListString) { try { var metricHeaderList = JsonConvert.DeserializeObject <List <HeaderKeyValue> >(metricHeaderListString); var metricTypeList = JsonConvert.DeserializeObject <List <MetricTypeModel> >(metricTypeListString); var metricItemsSource = new ObservableCollection <CheckBoxTab>(); foreach (var header in metricHeaderList) { var checkBoxTab = new CheckBoxTab { Header = header, Items = new ObservableCollection <IItemTypeModel>() }; foreach (var metricType in metricTypeList) { if (metricType.CnHeader.Contains(header.CnHeader)) { metricType.IsEnabled = true; checkBoxTab.Items.Add(metricType); } } metricItemsSource.Add(checkBoxTab); } MetricItemsSource = metricItemsSource; BenchmarkView view = GetView() as BenchmarkView; if (view != null) { view.MetricTabControl.SelectedIndex = 0; } } catch (Exception ex) { ShowMessage.Show("初始化指标出错"); LogHelper.LogMessage(MethodBase.GetCurrentMethod().DeclaringType, LogHelper.LogLevel, "Failed to InitMetric", ex); } finally { if (LogHelper.LogLevel == LogLevelEnum.Debug || LogHelper.LogLevel == LogLevelEnum.Info) { LogHelper.LogMessage(MethodBase.GetCurrentMethod().DeclaringType, LogHelper.LogLevel, "InitMetric", null); } } }
private void OpenBenchmark() { BenchmarkView benchmarkView = new BenchmarkView(); benchmarkView.ShowDialog(); }