/// <summary> /// Return (or create and return) an AWBProfile for the account used for log uploading /// </summary> /// <returns>The Profile. Throw an error or return null if the user declines to create a profile?</returns> public static AWBProfile GetProfileForLogUploading(IWin32Window owner) { int idOfUploadAccount = GetIDOfUploadAccount(); AWBProfile retval; AWBLogUploadProfilesForm profiles; if (idOfUploadAccount == -1) { if (MessageBox.Show("Please select or add a Profile to use for log uploading", "Log uploading", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { profiles = new AWBLogUploadProfilesForm(); profiles.ShowDialog(owner); retval = GetProfileForLogUploading(owner); } else { throw new System.Configuration.ConfigurationErrorsException("Log upload profile: User cancelled"); } } else { retval = GetProfile(idOfUploadAccount); } if (string.IsNullOrEmpty(retval.Password) && string.IsNullOrEmpty(TempPassword)) { UserPassword password = new UserPassword(); password.SetText = "Enter password for " + retval.Username; if (password.ShowDialog() == DialogResult.OK) { retval.Password = TempPassword = password.GetPassword; } } else if (!string.IsNullOrEmpty(TempPassword)) { retval.Password = TempPassword; } return(retval); }
/// <summary> /// Return (or create and return) an AWBProfile for the account used for log uploading /// </summary> /// <returns>The Profile. Throw an error or return null if the user declines to create a profile?</returns> public static AWBProfile GetProfileForLogUploading(IWin32Window owner) { int idOfUploadAccount = GetIDOfUploadAccount(); AWBProfile retval; if (idOfUploadAccount == -1) { if (MessageBox.Show("Please select or add a Profile to use for log uploading", "Log uploading", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { AWBLogUploadProfilesForm profiles = new AWBLogUploadProfilesForm(); profiles.ShowDialog(owner); retval = GetProfileForLogUploading(owner); } else throw new System.Configuration.ConfigurationErrorsException("Log upload profile: User cancelled"); } else retval = GetProfile(idOfUploadAccount); if (string.IsNullOrEmpty(retval.Password) && string.IsNullOrEmpty(TempPassword)) { UserPassword password = new UserPassword {Username = retval.Username}; if (password.ShowDialog() == DialogResult.OK) { retval.Password = TempPassword = password.GetPassword; } } else if (!string.IsNullOrEmpty(TempPassword)) retval.Password = TempPassword; return retval; }