Example #1
0
    //Outdated but still exists within project
    public void ShowYesOrNoBox(System.Action act, string message)
    {
        System.Action action            = () => act();
        GameObject    newSelectionPanel = (GameObject)Instantiate(selectionPrefab, Vector3.zero, Quaternion.identity, null);

        newSelectionPanel.transform.SetParent(mainCanvas, false);
        SelectionPopup sp = newSelectionPanel.GetComponent <SelectionPopup> ();

        sp.action  = action;
        sp.message = message;
    }
        private bool RemovePopup()
        {
            if (_popup != null && Application.Current.MainPage is MasterDetailPage current)
            {
                var cnt = ((ContentPage)((NavigationPage)current.Detail).CurrentPage).Content;
                if (cnt is Grid grd)
                {
                    grd.Children.Remove(_popup);
                }

                _popup.Click -= OnClicked;
                _popup        = null;

                return(true);
            }

            return(false);
        }
        public void DisplayPopup(string title, string content, DelegateCommand <PopupResultEventArgs> command = null)
        {
            _command = command;
            _popup   = new SelectionPopup();

            _popup.Title   = title;
            _popup.Message = content;

            _popup.Click += OnClicked;

            if (Application.Current.MainPage is MasterDetailPage current)
            {
                var cnt = ((ContentPage)((NavigationPage)current.Detail).CurrentPage).Content;
                if (cnt is Grid grd)
                {
                    grd.Children.Add(_popup, 0, 0);
                    Grid.SetRowSpan(_popup, 3);
                }
            }
        }