private void RenameAutoCat(AutoCat ac) { if (ac == null) { return; } bool good = true; DialogResult res; string name; do { GetStringDlg dlg = new GetStringDlg(ac.Name, GlobalStrings.DlgAutoCat_RenameBoxTitle, GlobalStrings.DlgAutoCat_RenameBoxLabel, GlobalStrings.DlgAutoCat_RenameBoxButton); res = dlg.ShowDialog(); name = dlg.Value; if (string.IsNullOrEmpty(name)) { MessageBox.Show(GlobalStrings.DlgAutoCat_MustHaveName); good = false; } else if (NameExists(name)) { MessageBox.Show(GlobalStrings.DlgAutoCat_NameInUse); good = false; } } while(res == DialogResult.OK && !good); if (res == System.Windows.Forms.DialogResult.OK) { ac.Name = name; } AutoCatList.Sort(); FillAutocatList(); }
public LoginResult Login() { string ssoVar = Repository.Connection.GetP4EnvironmentVar("P4LOGINSSO"); if (ssoVar != null) { string password = "******"; // dummy value server will not prompt for a password when using SSO logger.Debug("Using SSO: {0}", ssoVar); // The client side environment variable may be set, but if // the server side trigger is not enabled do not return false // or the silent login fail will repeat without a prompt of // any kind for the user. if (Login(password)) { if (!ssoSuccess) { Disconnect(); } return(LoginResult.Success); } } P4VS.UI.HASCheckDlg hASCheckDlg = new P4VS.UI.HASCheckDlg(Repository); if (hASCheckDlg.ShowDialog() == DialogResult.OK) { // OK is returned if the dialog has been launched, // which also means HandleUrl was called. if (hASCheckDlg.Credential != null || hASCheckDlg.ExternalAuth) { return(LoginResult.Success); } else { return(LoginResult.HASTimeout); } } string caption = Resources.P4ScmProvider_LoginCaption; string msg = string.Format(Resources.P4ScmProvider_LoginPrompt, User, Port); while (true) { string password = GetStringDlg.Show(caption, msg, string.Empty, true); if (password == null) { // user canceled login, so ask for different credentials User = null; Workspace = null; Disconnect(); return(LoginResult.Fail); } bool passwordLogin = Login(password); if (passwordLogin) { return(LoginResult.Success); } else { return(LoginResult.Fail); } } }