当前位置: 首页>>代码示例>>C#>>正文


C# InputDialog.Display方法代码示例

本文整理汇总了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;
                }
            });
        }
开发者ID:nchejara,项目名称:azure-mobile-services,代码行数:29,代码来源:ZumoTestCommon.cs

示例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
        }
开发者ID:RecursosOnline,项目名称:azure-mobile-services,代码行数:28,代码来源:ZumoTestCommon.cs


注:本文中的InputDialog.Display方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。