Exemple #1
0
            public Screen(ConfirmationPopUp proxy, string title, string description, TimeSpan?timeout = null, MenuScreen underlyingMenuScreen = null)
            {
                this.proxy = proxy;
                this.underlyingMenuScreen = underlyingMenuScreen;

                underlyingMenuScreen?.DisableInput();

                Game.UI.LoadLayoutToElement(MenuUIManager.MenuRoot, Game.ResourceCache, "UI/PopUpConfirmationLayout.xml");
                this.popUpWindow    = (Window)MenuUIManager.MenuRoot.GetChild("PopUpConfirmationWindow");
                popUpWindow.Visible = true;
                popUpWindow.BringToFront();

                using (var titleElem = (Text)popUpWindow.GetChild("Title", true)) {
                    titleElem.Value = title;
                }

                using (var descriptionElem = (Text)popUpWindow.GetChild("Description", true)) {
                    descriptionElem.Value = description;
                }

                confirmButton           = (Button)popUpWindow.GetChild("ConfirmButton", true);
                confirmButton.Released += Button_Released;

                cancelButton           = (Button)popUpWindow.GetChild("CancelButton", true);
                cancelButton.Released += Button_Released;

                taskSource = new TaskCompletionSource <bool>();

                if (timeout != null)
                {
                    timeoutCancel = new CancellationTokenSource();
                    Task.Delay(timeout.Value, timeoutCancel.Token).ContinueWith(TimeOutExpired, TaskContinuationOptions.NotOnCanceled);
                }
            }
Exemple #2
0
            public Screen(ErrorPopUp proxy, string title, string description, MenuScreen underlyingMenuScreen)
            {
                this.proxy = proxy;
                this.underlyingMenuScreen = underlyingMenuScreen;

                underlyingMenuScreen?.DisableInput();

                Game.UI.LoadLayoutToElement(MenuUIManager.MenuRoot, Game.ResourceCache, "UI/PopUpErrorLayout.xml");

                this.window    = (Window)MenuUIManager.MenuRoot.GetChild("PopUpErrorWindow");
                window.Visible = true;
                window.BringToFront();

                using (var titleElem = (Text)window.GetChild("Title", true))
                {
                    titleElem.Value = title;
                }

                using (var descriptionElem = (Text)window.GetChild("Description", true))
                {
                    descriptionElem.Value = description;
                }

                closeButton           = (Button)window.GetChild("CloseButton", true);
                closeButton.Released += CloseButtonReleased;

                taskSource = new TaskCompletionSource <bool>();
            }