/// <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); } }