// 计算模式改变 private void ModeChange(object parameter) { SelectionChangedEventArgs args = (SelectionChangedEventArgs)parameter; ComboBox comboBox = (ComboBox)args.Source; switch (comboBox.SelectedIndex) { case 0: GenerationCount = 2000; WTime = 100; WDis = 1; WCar = 1; break; case 1: GenerationCount = 2000; WTime = 1; WDis = 1; WCar = 100; break; case 2: AlgoParamSetDlg dlg = new AlgoParamSetDlg(); AlgoParamSetDlgViewMode viewMode = new AlgoParamSetDlgViewMode() { GenerationCount = this.GenerationCount, WTime = this.WTime, WDis = this.WDis, WCar = this.WCar }; dlg.DataContext = viewMode; dlg.ShowDialog(); if (!viewMode.IsCancel) { Record.Segments.Clear(); GenerationCount = viewMode.GenerationCount; WTime = viewMode.WTime; WDis = viewMode.WDis; WCar = viewMode.WCar; } break; } }
// 设置算法参数 private void SetAlgoParam(object obj) { AlgoParamSetDlg dlg = new AlgoParamSetDlg(); AlgoParamSetDlgViewMode viewMode = new AlgoParamSetDlgViewMode() { GenerationCount = this.GenerationCount, WTime = this.WTime, WDis = this.WDis, WCar = this.WCar }; dlg.DataContext = viewMode; dlg.ShowDialog(); if (!viewMode.IsCancel) { Record.Segments.Clear(); GenerationCount = viewMode.GenerationCount; WTime = viewMode.WTime; WDis = viewMode.WDis; WCar = viewMode.WCar; } }