Ejemplo n.º 1
0
        public void ShowPopup(PopUpWindow popup)
        {
            var alert = new AlertDialog.Builder(Forms.Context);
            var edit  = new EditText(Forms.Context)
            {
                Text = popup.Text
            };

            alert.SetView(edit);
            alert.SetTitle(popup.Title);
            alert.SetPositiveButton("OK", (senderAlert, args) =>
            {
                popup.OnPopupClosed(new PopUpWindowArgs
                {
                    Button = "OK",
                    Text   = edit.Text
                });
            });
            alert.SetNegativeButton("Cancel", (senderAlert, args) =>
            {
                popup.OnPopupClosed(new PopUpWindowArgs
                {
                    Button = "Cancel",
                    Text   = edit.Text
                });
            });
            alert.Show();
        }
        public void ShowPopup(PopUpWindow popup)
        {
            var alert = new UIAlertView
            {
                Title          = popup.Title,
                Message        = popup.Text,
                AlertViewStyle = UIAlertViewStyle.PlainTextInput
            };

            foreach (var b in popup.Buttons)
            {
                alert.AddButton(b);
            }

            alert.Clicked += (s, args) =>
            {
                popup.OnPopupClosed(new PopUpWindowArgs
                {
                    Button = popup.Buttons.ElementAt(Convert.ToInt32(args.ButtonIndex)),
                    Text   = alert.GetTextField(0).Text
                });
            };
            alert.Show();
        }