本文整理汇总了C#中InputDialog.Display方法的典型用法代码示例。如果您正苦于以下问题:C# InputDialog.Display方法的具体用法?C# InputDialog.Display怎么用?C# InputDialog.Display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputDialog
的用法示例。
在下文中一共展示了InputDialog.Display方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateYesNoTest
public static ZumoTest CreateYesNoTest(string question, bool expectedAnswer, int delayBeforeDialogMilliseconds = 0)
{
string testName = string.Format(CultureInfo.InvariantCulture, "Validation: {0} (expected {1})", question, expectedAnswer ? "Yes" : "No");
return new ZumoTest(testName, async delegate(ZumoTest test)
{
if (delayBeforeDialogMilliseconds > 0)
{
await Util.TaskDelay(delayBeforeDialogMilliseconds);
}
#if !WINDOWS_PHONE
InputDialog dialog = new InputDialog("Question", question, "No", "Yes");
await dialog.Display();
bool answerWasYes = !dialog.Cancelled;
#else
bool answerWasYes = await InputDialog.DisplayYesNo(question);
#endif
if (expectedAnswer != answerWasYes)
{
test.AddLog("Test failed. The answer to <<{0}>> was {1}, it should have been {2}",
question, answerWasYes ? "Yes" : "No", expectedAnswer ? "Yes" : "No");
return false;
}
else
{
return true;
}
});
}
示例2: CreateTestWithSingleAlert
public static ZumoTest CreateTestWithSingleAlert(string alert)
{
#if !WINDOWS_PHONE
return new ZumoTest("Simple alert", async delegate(ZumoTest test)
{
InputDialog dialog = new InputDialog("Information", alert, "OK");
if (ZumoTestGlobals.ShowAlerts)
{
await dialog.Display();
}
return true;
})
{
CanRunUnattended = false
};
#else
return new ZumoTest("Alert: " + alert, delegate(ZumoTest test)
{
MessageBox.Show(alert);
TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
tcs.SetResult(true);
return tcs.Task;
})
{
CanRunUnattended = false
};
#endif
}