// ================================================================================================ #endregion public OptConfigViewModel() { applyButton = new OptConfigDelegateCommand(ApplyButtonMethod, IsAvailableApplyButton); }
// =============================================================================================== #endregion public OptConfigBAViewModel() { // ------------------------------------------------------------ // SelectBaseAirfoil Button related ============================ airfoilSelectionMethod = new Action(AirfoilSelectionMethod); isSelectable = new Func <bool>(IsAirfoilSelectable); airfoilSelection = new OptConfigDelegateCommand(airfoilSelectionMethod, isSelectable); updatePreviewWindows = new OptConfigDelegateCommand(UpdatePreview, () => true); // // Read Loaded Airfoil if (AirfoilOptimizationResource.Instance.BasisAirfoils == null) { ImportedAirfoil = Models.ImportedAirfoilGroupManager.GetNewInstance(); } else { ImportedAirfoil = Models.ImportedAirfoilGroupManager.GetNewInstance(); ImportedAirfoil.AirfoilGroup = new System.Collections.Generic.List <Airfoil.AirfoilManager>(AirfoilOptimizationResource.Instance.BasisAirfoils.AirfoilGroup); ImportedAirfoil.NumberOfAirfoils = AirfoilOptimizationResource.Instance.BasisAirfoils.NumberOfAirfoils; ImportedAirfoil.NumberOfBasisAirfoils = AirfoilOptimizationResource.Instance.BasisAirfoils.NumberOfAirfoils; } // Assign EventHandler assignEventHandler(); if (ImportedAirfoil.NumberOfAirfoils == 0) { NumberOfBasisAirfoils = 1; // AirfoilSelection ComboBox related ==================================================================== LoadedAirfoils = new System.Collections.ObjectModel.ObservableCollection <AirfoilSelectorViewModel>(); // // Airfoil Specification DataGrid related ============================================================================= // // Airfoil Preview related =============================================== coordinateList = new System.Collections.ObjectModel.ObservableCollection <System.Windows.Point>(); // // Models ==================================================== // } else { NumberOfLoadedAirfoils = ImportedAirfoil.NumberOfAirfoils; NumberOfBasisAirfoils = ImportedAirfoil.NumberOfBasisAirfoils; // AirfoilSelection ComboBox related ==================================================================== LoadedAirfoils = new System.Collections.ObjectModel.ObservableCollection <AirfoilSelectorViewModel>(); for (int i = 0; i < ImportedAirfoil.NumberOfAirfoils; i++) { // Get Airfoil Name String label; if (ImportedAirfoil.AirfoilGroup[i].AirfoilName != null) { label = ImportedAirfoil.AirfoilGroup[i].AirfoilName; } else { label = "Airfoil" + (NumberOfLoadedAirfoils).ToString(); } LoadedAirfoils.Add(new AirfoilSelectorViewModel(ImportedAirfoil.AirfoilGroup[i], label)); } SelectedAirfoil = LoadedAirfoils[0]; // // Airfoil Preview related =============================================== CoordinateList = General.AirfoilPreview.GetPreviewPointList(SelectedAirfoil.SelectedAirfoil, PreviewWindowHeight, PreviewWindowWidth); // } // ------------------------------------------------------------ // Substitute Initial Value. AirfoilSelectionStatus = numberOfLoadedAirfoils.ToString() + " airfoil is loaded." + " " + (numberOfBAirfoils - numberOfLoadedAirfoils).ToString() + " airfoils left are required."; }