Exemple #1
0
        public void ShowPopup(CustomYesNoBox popup)
        {
            var alert = new AlertDialog.Builder(MainActivity.Instance, Resource.Style.Theme_AppCompat_Light_Dialog_Alert);

            alert.SetTitle(popup.Title);
            alert.SetMessage(popup.Text);

            var buttons = popup.Buttons;

            alert.SetPositiveButton(buttons[0], (senderAlert, args) =>
            {
                popup.OnPopupClosed(new CustomYesNoBoxClosedArgs
                {
                    Button = buttons[0]
                });
            });

            alert.SetNegativeButton(buttons[1], (senderAlert, args) =>
            {
                popup.OnPopupClosed(new CustomYesNoBoxClosedArgs
                {
                    Button = buttons[1]
                });
            });

            alert.SetCancelable(false);
            alert.Show();
        }
Exemple #2
0
        private void DisplayDisclaimer()
        {
            if (!preferenceSettings.GetDisclaimerAgreement())
            {
                string msg = "The information provided in this application is not a substitute for professional healthcare advice." + Environment.NewLine + Environment.NewLine +
                             "Ed Devs is not responsible or liable for any mishaps, reliability issues, or accuracy issues from using this app." + Environment.NewLine + Environment.NewLine +
                             "Please familiarize and verify this app before using in an actual chest compression-only CPR situation.";

                string disagree = "Disagree and quit";
                string agree    = "Agree";

                var popup = new CustomYesNoBox("Terms and Conditions", msg)
                {
                    Buttons = new List <string> {
                        agree, disagree
                    }
                };

                popup.PopupClosed += (o, closedArgs) =>
                {
                    if (closedArgs.Button == agree)
                    {
                        preferenceSettings.SetDisclaimerAgreement(true);
                    }
                    else if (closedArgs.Button == disagree)
                    {
                        //System.Environment.Exit(0);

                        // If doesn't work, hang the app with Environment.Exit()
                        IQuitAppService quitAppService = DependencyService.Get <IQuitAppService>();
                        if (quitAppService != null)
                        {
                            quitAppService.Quit();
                        }
                        else
                        {
                            System.Environment.Exit(0);
                        }
                    }
                    else
                    {
                    }
                };

                popup.Show();
            }
        }
Exemple #3
0
        public void ShowPopup(CustomYesNoBox popup)
        {
            var alert = new UIAlertView
            {
                Title   = popup.Title,
                Message = popup.Text
            };

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

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