本文整理汇总了C#中Credentials.setUsername方法的典型用法代码示例。如果您正苦于以下问题:C# Credentials.setUsername方法的具体用法?C# Credentials.setUsername怎么用?C# Credentials.setUsername使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Credentials
的用法示例。
在下文中一共展示了Credentials.setUsername方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: prompt
public override void prompt(Protocol protocol, Credentials credentials,
String title, String reason,
bool enableKeychain, bool enablePublicKey, bool enableAnonymous)
{
_view = ObjectFactory.GetInstance<ILoginView>();
InitEventHandlers();
_protocol = protocol;
_credentials = credentials;
_enableKeychain = enableKeychain;
_enablePublicKey = enablePublicKey;//
_enableAnonymous = enableAnonymous;
_view.Title = Locale.localizedString(title, "Credentials");
_view.Message = Locale.localizedString(reason, "Credentials");
_view.Username = credentials.getUsername();
_view.UsernameLabel = protocol.getUsernamePlaceholder() + ":";
_view.PasswordLabel = protocol.getPasswordPlaceholder() + ":";
_view.SavePasswordState =
Preferences.instance().getBoolean("connection.login.useKeychain") &&
Preferences.instance().getBoolean("connection.login.addKeychain");
_view.DiskIcon = IconCache.Instance.IconForName(_protocol.disk(), 64);
Update();
AsyncController.AsyncDelegate d = delegate
{
if (DialogResult.Cancel == _view.ShowDialog(_browser.View))
{
throw new LoginCanceledException();
}
credentials.setSaved(_view.SavePasswordState);
credentials.setUsername(Utils.SafeString(_view.Username));
credentials.setPassword(Utils.SafeString(_view.Password));
};
_browser.Invoke(d);
}