public Credentials prompt(Host bookmark, string title, string reason, LoginOptions options) { Credentials credentials = new VaultCredentials(); credentials.setSaved(options.save()); AsyncDelegate d = delegate { View = ObjectFactory.GetInstance <IPasswordPromptView>(); View.Title = title; View.Reason = reason; View.OkButtonText = LocaleFactory.localizedString("Continue", "Credentials"); View.IconView = IconCache.Instance.IconForName(options.icon(), 64); View.SavePassword = options.save(); View.ValidateInput += ValidateInputEventHandler; if (DialogResult.Cancel == View.ShowDialog(_browser.View)) { throw new LoginCanceledException(); } credentials.setPassword(View.InputText); credentials.setSaved(View.SavePassword); }; _browser.Invoke(d); return(credentials); }
public Credentials prompt(Host bookmark, String username, String title, String reason, LoginOptions options) { View = ObjectFactory.GetInstance <ILoginView>(); var credentials = new Credentials().withSaved(options.save()).withUsername(username); InitEventHandlers(bookmark, credentials, options); View.Title = LocaleFactory.localizedString(title, "Credentials"); View.Message = LocaleFactory.localizedString(reason, "Credentials"); View.Username = username; View.SavePasswordState = options.save(); View.DiskIcon = IconCache.Instance.IconForName(options.icon(), 64); InitPrivateKeys(); Update(credentials, options); AsyncDelegate d = delegate { if (DialogResult.Cancel == View.ShowDialog(_browser.View)) { throw new LoginCanceledException(); } }; _browser.Invoke(d); return(credentials); }