private NetworkCredential GetUserCredential() { var credentials = new NetworkCredential(); var pxyCfg = Config.Instance.ProxyConfig; using (var authForm = new ProxyAuthForm(pxyCfg)) { if (authForm.ShowDialog(_provider.GetRequiredService <IUIShell>().GetMainWindowParent()) != DialogResult.OK) { _provider.LogWarning(SyncResources.ProxyUserDeclineAuth); return(null); } credentials.UserName = authForm.Login; credentials.Password = authForm.Password; pxyCfg.ProxySettings.Login = credentials.UserName; if (pxyCfg.ProxySettings.SaveAuth) { pxyCfg.ProxySettings.EncodedPassword = credentials.Password.EncryptPassword(); } } return(credentials); }
private NetworkCredential GetUserCredential() { var credentials = new NetworkCredential(); var pxyCfg = Config.Instance.ProxyConfig; using (var authForm = new ProxyAuthForm(pxyCfg)) { if (authForm.ShowDialog(_provider.GetRequiredService<IUIShell>().GetMainWindowParent()) != DialogResult.OK) { _provider.LogWarning(SyncResources.ProxyUserDeclineAuth); return null; } credentials.UserName = authForm.Login; credentials.Password = authForm.Password; pxyCfg.ProxySettings.Login = credentials.UserName; if (pxyCfg.ProxySettings.SaveAuth) pxyCfg.ProxySettings.EncodedPassword = credentials.Password.EncryptPassword(); } return credentials; }