/// <summary> /// Loads the Option values onto the UI controls /// </summary> /// <param name="isLoadDefaults">Whether to load from defaults or from file, loads from defaults if true</param> private void LoadOptionsValues(bool isLoadDefaults) { try { if (!isLoadDefaults) { this.optionSelection = SavedDataUtil.LoadData <TASMOptionsSelection>(SavedDataUtil.GetOptionsFileName()); } if (this.optionSelection == null || isLoadDefaults) { this.optionSelection = new TASMOptionsSelection(true); } this.LoadListBox(this.lstInputVMSpecs, this.optionSelection.VMSpecsInputSequence); this.LoadListBox(this.lstInputOverrideSpecs, this.optionSelection.OverrideVMSpecsInputSequence); this.LoadListBox(this.lstWindowsKeywords, this.optionSelection.WindowsKeywordsList); this.LoadListBox(this.lstLinuxKeywords, this.optionSelection.LinuxKeywordsList); this.LoadListBox(this.lstIncludeSKUSeries, this.optionSelection.AzureVMSKUSeriesIncluded); this.LoadListBox(this.lstExcludeSKUSeries, this.optionSelection.AzureVMSKUSeriesExcluded); this.LoadComboBox(this.cboVMSpecsSkipLines, OptionsConstants.VMSpecsSkipLines, this.optionSelection.VMSpecsSkipLines); this.LoadComboBox(this.cboOverrideSpecsSkipLines, OptionsConstants.InputOverrideSkipLines, this.optionSelection.InputOverrideSkipLines); this.LoadComboBox(this.cboMappingCoefCores, OptionsConstants.MappingCoefficientsCores, this.optionSelection.MappingCoefficientCoresSelection); this.LoadComboBox(this.cboMappingCoefMemory, OptionsConstants.MappingCoefficientsMemory, this.optionSelection.MappingCoefficientMemorySelection); this.LoadComboBox(this.cboOSDiskHDDSize, OptionsConstants.OSDiskHDDSizeList, this.optionSelection.OSDiskHDDSelection); this.LoadComboBox(this.cboOSDiskSSDSize, OptionsConstants.OSDiskSSDSizeList, this.optionSelection.OSDiskSSDSelection); this.LoadComboBox(this.cboMemoryGBMB, OptionsConstants.MemoryGBMBList, this.optionSelection.MemoryGBMBSelection); this.LoadComboBox(this.cboHoursinaMonth, OptionsConstants.HoursinaMonthList, this.optionSelection.HoursinaMonthSelection); } catch (Exception ex) { MessageBox.Show(UIStatusMessages.OptionsLoadFailed, ex.Message); } }
/// <summary> /// Persist inputs provided on the UI /// </summary> private void PersistOptions() { try { this.optionSelection.VMSpecsSkipLines = int.Parse(cboVMSpecsSkipLines.SelectedValue.ToString()); this.optionSelection.InputOverrideSkipLines = int.Parse(cboOverrideSpecsSkipLines.SelectedValue.ToString()); this.optionSelection.MappingCoefficientCoresSelection = double.Parse(cboMappingCoefCores.SelectedValue.ToString()); this.optionSelection.MappingCoefficientMemorySelection = double.Parse(cboMappingCoefMemory.SelectedValue.ToString()); this.optionSelection.OSDiskHDDSelection = cboOSDiskHDDSize.SelectedValue.ToString(); this.optionSelection.OSDiskSSDSelection = cboOSDiskSSDSize.SelectedValue.ToString(); this.optionSelection.MemoryGBMBSelection = cboMemoryGBMB.SelectedValue.ToString(); this.optionSelection.HoursinaMonthSelection = int.Parse(cboHoursinaMonth.SelectedValue.ToString()); SavedDataUtil.SaveData(this.optionSelection, SavedDataUtil.GetConfigandOptionsDirName(), SavedDataUtil.GetOptionsFileName()); } catch (Exception ex) { MessageBox.Show(UIStatusMessages.OptionsSaveFailed, ex.Message); } }