本文整理汇总了C#中UserInfo.PromptYesNo方法的典型用法代码示例。如果您正苦于以下问题:C# UserInfo.PromptYesNo方法的具体用法?C# UserInfo.PromptYesNo怎么用?C# UserInfo.PromptYesNo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserInfo
的用法示例。
在下文中一共展示了UserInfo.PromptYesNo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public override void Add(HostKey hostkey, UserInfo userinfo)
{
int type = hostkey.type;
string host = hostkey.GetHost();
byte[] key = hostkey.key;
HostKey hk = null;
lock (pool)
{
for (int i = 0; i < pool.Count; i++)
{
hk = (HostKey)(pool[i]);
if (hk.IsMatched(host) && hk.type == type)
{
}
}
}
hk = hostkey;
pool.Add(hk);
string bar = GetKnownHostsRepositoryID();
if (bar != null)
{
bool foo = true;
FilePath goo = new FilePath(bar);
if (!goo.Exists())
{
foo = false;
if (userinfo != null)
{
foo = userinfo.PromptYesNo(bar + " does not exist.\n" + "Are you sure you want to create it?"
);
goo = goo.GetParentFile();
if (foo && goo != null && !goo.Exists())
{
foo = userinfo.PromptYesNo("The parent directory " + goo + " does not exist.\n" +
"Are you sure you want to create it?");
if (foo)
{
if (!goo.Mkdirs())
{
userinfo.ShowMessage(goo + " has not been created.");
foo = false;
}
else
{
userinfo.ShowMessage(goo + " has been succesfully created.\nPlease check its access permission."
);
}
}
}
if (goo == null)
{
foo = false;
}
}
}
if (foo)
{
try
{
Sync(bar);
}
catch (Exception e)
{
System.Console.Error.WriteLine("sync known_hosts: " + e);
}
}
}
}