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


C# AlertDialog.Builder.SetOnDismissListener方法代码示例

本文整理汇总了C#中Android.App.AlertDialog.Builder.SetOnDismissListener方法的典型用法代码示例。如果您正苦于以下问题:C# AlertDialog.Builder.SetOnDismissListener方法的具体用法?C# AlertDialog.Builder.SetOnDismissListener怎么用?C# AlertDialog.Builder.SetOnDismissListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.App.AlertDialog.Builder的用法示例。


在下文中一共展示了AlertDialog.Builder.SetOnDismissListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            //as we expect this to happen only rarely (having a foreground service running when unlocked),
            //we don't try to handle this better
            //But at least explain to the user what happened!
            ((NotificationManager)GetSystemService(Context.NotificationService)).CancelAll();
            AlertDialog.Builder b = new AlertDialog.Builder(this);
            b.SetMessage(Resource.String.killed_by_os);
            b.SetPositiveButton(Android.Resource.String.Ok, delegate
            {
                Intent i = new Intent(this, typeof(FileSelectActivity));
                i.AddFlags(ActivityFlags.ClearTask | ActivityFlags.NewTask);
                StartActivity(i);

            });
            b.SetNegativeButton(Resource.String.cancel, delegate { });
            b.SetTitle(GetString(AppNames.AppNameResource));
            b.SetOnDismissListener(this);
            var dialog = b.Create();
            dialog.Show();
        }
开发者ID:pythe,项目名称:wristpass,代码行数:22,代码来源:AppKilledInfo.cs

示例2: CreateDialog

        private static AlertDialogInfo CreateDialog(
            string content,
            string title,
            string okText = null,
            string cancelText = null,
            Action<bool> afterHideCallbackWithResponse = null)
        {
            var tcs = new TaskCompletionSource<bool>();

            var builder = new AlertDialog.Builder(ActivityBase.CurrentActivity);
            builder.SetMessage(content);
            builder.SetTitle(title);

            AlertDialog dialog = null;

            builder.SetPositiveButton(okText ?? "OK", (d, index) =>
            {
                tcs.TrySetResult(true);

                // ReSharper disable AccessToModifiedClosure
                if (dialog != null)
                {
                    dialog.Dismiss();
                    dialog.Dispose();
                }

                if (afterHideCallbackWithResponse != null)
                {
                    afterHideCallbackWithResponse(true);
                }
                // ReSharper restore AccessToModifiedClosure
            });

            if (cancelText != null)
            {
                builder.SetNegativeButton(cancelText, (d, index) =>
                {
                    tcs.TrySetResult(false);

                    // ReSharper disable AccessToModifiedClosure
                    if (dialog != null)
                    {
                        dialog.Dismiss();
                        dialog.Dispose();
                    }

                    if (afterHideCallbackWithResponse != null)
                    {
                        afterHideCallbackWithResponse(false);
                    }
                    // ReSharper restore AccessToModifiedClosure
                });
            }

            builder.SetOnDismissListener(new OnDismissListener(() =>
            {
                tcs.TrySetResult(false);

                if (afterHideCallbackWithResponse != null)
                {
                    afterHideCallbackWithResponse(false);
                }
            }));

            dialog = builder.Create();

            return new AlertDialogInfo
            {
                Dialog = dialog,
                Tcs = tcs
            };
        }
开发者ID:NulledLabs,项目名称:mvvmlight,代码行数:72,代码来源:DialogService.cs


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