Beispiel #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);
            }
        }
Beispiel #2
0
 /// <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);
     }
 }
 /// <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);
     }
 }
        /// <summary>
        /// Persist the inputs provided on the UI
        /// </summary>
        private void PersistConfigDetails()
        {
            try
            {
                this.creds = new CSPAccountCreds()
                {
                    CSPPartnerTenantID     = string.IsNullOrWhiteSpace(txtPartnerTenantId.Text) ? string.Empty : txtPartnerTenantId.Text.Trim(),
                    CSPPartnerCenterAppId  = string.IsNullOrWhiteSpace(txtPCNativeAppId.Text) ? string.Empty : txtPCNativeAppId.Text.Trim(),
                    CSPAdminAgentUserName  = string.IsNullOrWhiteSpace(txtUsername.Text) ? string.Empty : txtUsername.Text.Trim(),
                    CSPAdminAgentPassword  = psPassword.Password,
                    CSPARMNativeAppId      = string.IsNullOrWhiteSpace(txtARMNativeAppId.Text) ? string.Empty : txtARMNativeAppId.Text.Trim(),
                    CSPCustomerTenantId    = string.IsNullOrWhiteSpace(txtCustomerTenantId.Text) ? string.Empty : txtCustomerTenantId.Text.Trim(),
                    CSPAzureSubscriptionId = string.IsNullOrWhiteSpace(txtCSPAzureSubId.Text) ? string.Empty : txtCSPAzureSubId.Text.Trim()
                };

                SavedDataUtil.SaveData <CSPAccountCreds>(this.creds, SavedDataUtil.GetConfigandOptionsDirName(), SavedDataUtil.GetConfigFileName());
            }
            catch (Exception ex)
            {
                MessageBox.Show(UIStatusMessages.ConfigSaveFailed, ex.Message);
            }
        }