Пример #1
0
        public void ShowWaitDialog_Samll(string msg, bool isCanCancel = false, bool isOutSideTouch = false)
        {
            if (dialog_Show == null)
            {
                InitShowDialog();
            }
            if (dialog_Show.IsShowing)
            {
                dialog_Show.FindViewById <TextView>(Resource.Id.tv_hint).Text = msg;
            }
            else
            {
                var v = LayoutInflater.From(this).Inflate(Resource.Layout.Dialog_WaitProgress_Small, null);
                v.FindViewById <TextView>(Resource.Id.tv_hint).Text = msg;
                dialog_Show.SetContentView(v);
            }
            dialog_Show.SetCancelable(isCanCancel);
            dialog_Show.SetCanceledOnTouchOutside(isOutSideTouch);
            var window = dialog_Show.Window;

            if (window != null)
            {
                var attr = window.Attributes;
                if (attr != null)
                {
                    attr.Height       = 160;
                    attr.Width        = 160;
                    attr.Gravity      = GravityFlags.Center;
                    window.Attributes = (attr);
                }
            }
            dialog_Show.Show();
        }
Пример #2
0
            void OnActionSheetRequested(Page sender, ActionSheetArguments arguments)
            {
                // Verify that the page making the request is part of this activity
                if (!PageIsInThisContext(sender))
                {
                    return;
                }

                var builder = new AlertDialog.Builder(Activity);

                builder.SetTitle(arguments.Title);
                string[] items = arguments.Buttons.ToArray();
                builder.SetItems(items, (o, args) => arguments.Result.TrySetResult(items[args.Which]));

                if (arguments.Cancel != null)
                {
                    builder.SetPositiveButton(arguments.Cancel, (o, args) => arguments.Result.TrySetResult(arguments.Cancel));
                }

                if (arguments.Destruction != null)
                {
                    builder.SetNegativeButton(arguments.Destruction, (o, args) => arguments.Result.TrySetResult(arguments.Destruction));
                }

                AlertDialog dialog = builder.Create();

                builder.Dispose();
                //to match current functionality of renderer we set cancelable on outside
                //and return null
                dialog.SetCanceledOnTouchOutside(true);
                dialog.CancelEvent += (o, e) => arguments.SetResult(null);
                dialog.Show();
            }
Пример #3
0
 public void SetCanceledOnTouchOutside(bool canceledOnTouchOutSide)
 {
     if (_useAppCompat)
     {
         _appcompatAlertDialog.SetCanceledOnTouchOutside(canceledOnTouchOutSide);
     }
     else
     {
         _legacyAlertDialog.SetCanceledOnTouchOutside(canceledOnTouchOutSide);
     }
 }