Пример #1
0
        /// <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>
 /// Loads the persisted info to the UI
 /// </summary>
 private void LoadConfigDetails()
 {
     try
     {
         CSPAccountCreds creds = SavedDataUtil.LoadData <CSPAccountCreds>(SavedDataUtil.GetConfigFileName());
         if (creds != null)
         {
             txtPartnerTenantId.Text  = this.GetEmptyStringifNull(creds.CSPPartnerTenantID);
             txtPCNativeAppId.Text    = this.GetEmptyStringifNull(creds.CSPPartnerCenterAppId);
             txtUsername.Text         = this.GetEmptyStringifNull(creds.CSPAdminAgentUserName);
             psPassword.Password      = this.GetEmptyStringifNull(creds.CSPAdminAgentPassword);
             txtARMNativeAppId.Text   = this.GetEmptyStringifNull(creds.CSPARMNativeAppId);
             txtCustomerTenantId.Text = this.GetEmptyStringifNull(creds.CSPCustomerTenantId);
             txtCSPAzureSubId.Text    = this.GetEmptyStringifNull(creds.CSPAzureSubscriptionId);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(UIStatusMessages.ConfigLoadFailed, ex.Message);
     }
 }