Example #1
0
 protected override void Update(GameTime gameTime)
 {
     if (!_shownMessage)
     {
         try
         {
             if (!Guide.IsVisible)
             {
                 Guide.BeginShowMessageBox(PlayerIndex.One, ErrorTitle, ErrorMessage, ErrorButtons, 0, MessageBoxIcon.Error, result =>
                 {
                     int?choice = Guide.EndShowMessageBox(result);
                     if (choice.HasValue && choice.Value == 1)
                     {
                         _displayException = true;
                     }
                     else
                     {
                         Exit();
                     }
                 }, null);
                 _shownMessage = true;
             }
         }
         catch
         {
         }
     }
     base.Update(gameTime);
 }
        /// <summary>
        /// Displays a message box that contains the specified text, title bar caption, and response buttons.
        /// </summary>
        /// <param name="text">The message to display.</param>
        /// <param name="caption">The title of the message box.</param>
        /// <param name="buttons">The captions for message box buttons. The maximum number of buttons is two.</param>
        /// <returns>The <see cref="Task"/> object representing the asynchronous operation.</returns>
        public async Task <int> ShowAsync(string text, string caption, IEnumerable <string> buttons)
        {
#if WINDOWS_PHONE
            var taskCompletionSource = new TaskCompletionSource <int>();

            Guide.BeginShowMessageBox(caption, text, buttons, 0, MessageBoxIcon.None, ar =>
            {
                var buttonIndex = Guide.EndShowMessageBox(ar);

                Deployment.Current.Dispatcher.BeginInvoke(() => taskCompletionSource.SetResult(buttonIndex.GetValueOrDefault(-1)));
            }, null);

            return(await taskCompletionSource.Task);
#else
            var message = new MessageDialog(text, caption);

            foreach (var button in buttons)
            {
                message.Commands.Add(new UICommand(button));
            }

            var command = await message.ShowAsync();

            if (command != null)
            {
                return(message.Commands.IndexOf(command));
            }

            return(-1);
#endif
        }
 /// <summary>
 /// Shows the guide market place if this player can purchase content;
 /// otherwise shows an appropriate message.
 /// </summary>
 public static void PurchaseContent(this PlayerIndex player)
 {
     try
     {
         if (player.CanPurchaseContent())
         {
             Guide.ShowMarketplace(player);
         }
         else
         {
             Guide.BeginShowMessageBox(
                 player,
                 Resources.PurchaseFailedTitle,
                 Resources.PurchaseFailedText,
                 new string[] { Resources.PurchaseFailedButton },
                 0,
                 MessageBoxIcon.Warning,
                 r => Guide.EndShowMessageBox(r),
                 null);
         }
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine(e);
     }
 }
        private void MusicManagerPromptGameHasControl(object sender, EventArgs e)
        {
            // Show a message box to see if the user wants to turn off their music for the game's music.
            Guide.BeginShowMessageBox(
                "Use game music?",
                "Would you like to turn off your music to listen to the game's music?",
                new[] { "Yes", "No" },
                0,
                MessageBoxIcon.None,
                result =>
            {
                // Get the choice from the result
                int?choice = Guide.EndShowMessageBox(result);

                // If the user hit the yes button, stop the media player. Our music manager will
                // see that we have a song the game wants to play and that the game will now have control
                // and will automatically start playing our game song.
                if (choice.HasValue && choice.Value == 0)
                {
                    MediaPlayer.Stop();
                    enableMusic = true;
                }
                else
                {
                    enableMusic = false;
                }
            },
                null);
        }
Example #5
0
    // Token: 0x0600288A RID: 10378 RVA: 0x001533A0 File Offset: 0x001515A0
    protected static void UpdateDialogGetMBResult(IAsyncResult userResult)
    {
        AppMain.g_ao_sys_global.is_show_ui = false;
        int?num = Guide.EndShowMessageBox(userResult);

        try
        {
            if (num != null && num.Value == 0)
            {
                if (Guide.IsTrialMode)
                {
                    int num2 = 10;
                    while (Guide.IsVisible && num2 > 0)
                    {
                        num2--;
                        Thread.Sleep(100);
                    }
                    Guide.ShowMarketplace(PlayerIndex.One);
                }
                else
                {
                    new MarketplaceDetailTask
                    {
                        ContentType = (MarketplaceContentType)1
                    }.Show();
                }
            }
        }
        catch (Exception)
        {
        }
    }
Example #6
0
        /// <summary>
        /// Asynchronous handler for the game save popup messagebox.
        /// </summary>
        /// <param name="result">The popup messagebox result.</param>
        private void ShowSaveDialogEnded(IAsyncResult result)
        {
            int?res = Guide.EndShowMessageBox(result);

            if (res.HasValue)
            {
                // Store the user's progress
                if (res.Value == 0)
                {
                    if (!PhoneApplicationService.Current.State.ContainsKey(
                            "CurrentLevel"))
                    {
                        var gameplayScreen = GetGameplayScreen();

                        PhoneApplicationService.Current.State["CurrentLevel"]
                            = gameplayScreen.currentLevel.levelNumber;
                    }

                    foreach (GameScreen screen in ScreenManager.GetScreens())
                    {
                        screen.ExitScreen();
                    }

                    ScreenManager.AddScreen(new BackgroundScreen(false),
                                            null);
                    ScreenManager.AddScreen(new MainMenuScreen(), null);
                }
                // The user really quit the game, see if he has a high score
                else
                {
                    checkHighscore = true;
                }
            }
        }
Example #7
0
        /// <summary>
        /// Called after the player dismisses the dialog stating a game is unavailable.
        /// </summary>
        /// <param name="result">The messagebox selection result.</param>
        private void UnavailableGameDialogEnded(IAsyncResult result)
        {
            int?res = Guide.EndShowMessageBox(result);

            if (res == 0)
            {
                // Create a new game with the same name.
                NetworkManager.Instance.NewGameCreated += Instance_NewGameCreated;
                NetworkManager.Instance.NewGame(NetworkManager.Instance.gameName);
            }
            else
            {
                // Return to the game selection screen.
                PhoneApplicationService.Current.State.Remove(Constants.YachtStateKey);

                ExitScreen();
                Dispose();

                if (res == 1)
                {
                    ScreenManager.AddScreen(new SelectOnlineGameScreen(NetworkManager.Instance.name), null);
                }
                else
                {
                    ScreenManager.AddScreen(new MainMenuScreen(), null);
                }
            }
        }
 private void ShowName()
 {
     if (null != m_newChinese)
     {
         try {
             m_ChineseLabel.setString(m_newChinese);
             m_Word.ChineseName = m_newChinese;
         } catch (Exception e) {
             m_newChinese = m_Word.ChineseName;
             IAsyncResult ar =
                 Guide.BeginShowMessageBox("提示", "您输入的文字不能识别!", new List <String> {
                 "确定"
             }, 0, MessageBoxIcon.Alert, null, new Object());
             Guide.EndShowMessageBox(ar);
         }
     }
     if (null != m_newEnglish)
     {
         try {
             m_EnglishLabel.setString(m_newEnglish);
             m_Word.EnglishName = m_newEnglish;
         } catch (Exception e) {
             m_newEnglish = m_Word.EnglishName;
             IAsyncResult ar =
                 Guide.BeginShowMessageBox("提示", "您输入的文字不能识别!", new List <String> {
                 "确定"
             }, 0, MessageBoxIcon.Alert, null, new Object());
             Guide.EndShowMessageBox(ar);
         }
     }
 }
Example #9
0
 public static bool Update()
 {
     if (current.playerIndex >= 0)
     {
         lock (queue)
         {
             if (!Guide.IsVisible)
             {
                 try
                 {
                     mbResult = Guide.BeginShowMessageBox((PlayerIndex)current.playerIndex, current.caption, current.contents, current.options, 0, MessageBoxIcon.None, null, null);
                 }
                 catch (GuideAlreadyVisibleException)
                 {
                 }
             }
             else if (mbResult != null && mbResult.IsCompleted)
             {
                 choice   = Guide.EndShowMessageBox(mbResult);
                 mbResult = null;
                 NextMessage();
                 return(true);
             }
         }
     }
     return(false);
 }
Example #10
0
        /// <summary>
        /// Método asincrono resultante de presionar una de las opciones de la Alerta mostrada
        /// y contiene el resultado de la opción seleccionada, con la cual se podra ver la información
        /// detallada de una alerta, o cancelar la alerta.
        /// </summary>
        /// <param name="ar">Resultado ´de luego de presionar una opción del mensaje de la Alerta</param>
        private void OnMessageBoxClosed(IAsyncResult ar)
        {
            try
            {
                //Se recoge el resultado de la elección del usuario.
                int?buttonIndex = Guide.EndShowMessageBox(ar);

                switch (buttonIndex)
                {
                case 0:
                    Deployment.Current.Dispatcher.BeginInvoke(() => infoSensor(feedCapturado));
                    break;

                case 1:
                    Deployment.Current.Dispatcher.BeginInvoke(() => detenerSonido());
                    break;

                default:
                    break;
                }
            }
            finally
            {
            }
        }
Example #11
0
 private void btnShare_Click(object sender, RoutedEventArgs e)
 {
     // The station is null if there was a problem with the Internet connection.
     if (CoreViewModel.Instance.CurrentStation.NowPlaying != null)
     {
         Guide.BeginShowMessageBox("Beem", "Do you want to share the track through the Windows Phone social channels or Last.fm?",
                                   new List <string> {
             "windows phone", "last.fm"
         }, 0, MessageBoxIcon.None, (res) =>
         {
             int?result = Guide.EndShowMessageBox(res);
             if (result == 0)
             {
                 ShareLinkTask shareLink = new ShareLinkTask();
                 shareLink.LinkUri       = new Uri("http://bitly.com/BeemPlus");
                 shareLink.Message       = "Listening to " + CoreViewModel.Instance.CurrentStation.NowPlaying.FullTrackName + " with #BeemWP.";
                 shareLink.Show();
             }
             else if (result == 1)
             {
                 ScrobbleCurrentTrack();
             }
         }, null);
     }
     else
     {
         MessageBox.Show("Apparently there is no Internet connection, so we can't share your track at this time.", "Beem", MessageBoxButton.OK);
     }
 }
Example #12
0
        private void ShowMessage()
        {
            int loop = 0;

            // Check guide is not open
            while (Guide.IsVisible)
            {
                if (loop > 20) // Max 2s
                {
                    return;
                }
                loop++;

                System.Threading.Thread.Sleep(100);
            }

            Guide.BeginShowMessageBox(this.Title, this.Message,
                                      new List <string>()
            {
                this.YesText, this.NoText
            },
                                      0, MessageBoxIcon.None, (r) =>
            {
                var result = Guide.EndShowMessageBox(r);
                if (result.HasValue && result.Value == 0)
                {
                    OnYesClick();
                }
                else
                {
                    OnNoClick();
                }
            }, null);
        }
Example #13
0
 protected void ShowMessageBox(string message, string title)
 {
     if (!Guide.IsVisible)
     {
         Guide.BeginShowMessageBox(title, message, new[] { "OK" }, 0, MessageBoxIcon.Alert,
                                   asyncResult => Guide.EndShowMessageBox(asyncResult), null);
     }
 }
 /// <summary>
 /// Displays a message box that contains the specified text, title bar caption, and response buttons.
 /// </summary>
 /// <param name="text">The message to display.</param>
 /// <param name="caption">The title of the message box.</param>
 /// <param name="buttons">The captions for message box buttons. The maximum number of buttons is two.</param>
 /// <param name="selectedButton">The <see cref="T:Action{int}" /> to be called once the operation is finished.</param>
 public void Show(string text, string caption, IEnumerable <string> buttons, Action <int> selectedButton)
 {
     Guide.BeginShowMessageBox(caption, text, buttons, 0, MessageBoxIcon.None, ar =>
     {
         var buttonIndex = Guide.EndShowMessageBox(ar);
         Deployment.Current.Dispatcher.BeginInvoke(() => selectedButton(buttonIndex.HasValue ? buttonIndex.Value : -1));
     }, null);
 }
        protected void GetMBResult(IAsyncResult r)
        {
            int?b = Guide.EndShowMessageBox(r);

            Manager.Vars["showMessagePause"] = false;
            StorageSession.Release();
            Manager.GameStates.ChangeState("gametitle");
        }
 /// <summary>
 /// Checks if the user input a delete.
 /// </summary>
 /// <param name="ar"></param>
 public void DeletePushPinCallBack(IAsyncResult ar)
 {
     if (Guide.EndShowMessageBox(ar) == 0)
     {
         pushPins.Remove(ar.AsyncState as PushPin);
         tank.DeletePushPin(ar.AsyncState as PushPin);
     }
 }
Example #17
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            //if (NetworkInterface.GetIsNetworkAvailable())
            if (true)
            {
                await LoadData();
            }
            else
            {
                IAsyncResult result = Guide.BeginShowMessageBox(
                    AppResources.SplashScreen_OnNavigatedTo_No_Network,
                    AppResources.SplashScreen_OnNavigatedTo_No_network_details,
                    new string[] { "wifi", "3G/4G-LTE" },
                    0,
                    MessageBoxIcon.Error,
                    null,
                    null
                    );
                result.AsyncWaitHandle.WaitOne();

                int?choice = Guide.EndShowMessageBox(result);
                if (choice.HasValue)
                {
                    if (choice.Value == 0)
                    {
                        ConnectionSettingsTask con = new ConnectionSettingsTask();
                        con.ConnectionSettingsType = ConnectionSettingsType.WiFi;
                        con.Show();
                    }
                    else
                    {
                        ConnectionSettingsTask con = new ConnectionSettingsTask();
                        con.ConnectionSettingsType = ConnectionSettingsType.Cellular;
                        con.Show();
                    }
                }
                else
                {
                    MessageBoxResult res = MessageBox.Show(AppResources.SplashScreen_OnNavigatedTo_OfflineModeQuestion,
                                                           AppResources.SplashScreen_OnNavigatedTo_Offline_Mode,
                                                           MessageBoxButton.OKCancel);
                    if (res == MessageBoxResult.Cancel)
                    {
                        StaticMethod.Quit();
                    }
                    else if (res == MessageBoxResult.OK)
                    {
                        StaticData.isOffline = true;
                        //Navigate to MainPage
                        MessageBox.Show("Voucher World required a working internet connection", "We are sorry",
                                        MessageBoxButton.OK);
                        StaticMethod.Quit();
                        //NavigationService.Navigate(new Uri("/PageGroups/KaraokeGroup/OfflinePage.xaml", UriKind.Relative));
                    }
                }
            }
            base.OnNavigatedTo(e);
        }
Example #18
0
        /// <summary>
        /// Handler for the warning box displayed when the user tries to exit the game.
        /// </summary>
        /// <param name="result">The popup messagebox result.</param>
        private void AbortExitDialogEnded(IAsyncResult result)
        {
            int?res = Guide.EndShowMessageBox(result);

            if (res == 0)
            {
                HandleExitScreen();
            }
        }
Example #19
0
        void GetMBResult(IAsyncResult r)
        {
            int?b = Guide.EndShowMessageBox(r);

            if (b == 0)
            {
                string test = "testing";
            }
        }
Example #20
0
        //* -----------------------------------------------------------------------*
        /// <summary>メッセージボックスの表示を終了します。</summary>
        ///
        /// <param name="result">
        /// メソッドの進行状況の追跡に使用されるオブジェクト。
        /// </param>
        public int?EndShowMessageBox(IAsyncResult result)
        {
            int?res = null;

            if (isAvaliableUseGamerService)
            {
                res = Guide.EndShowMessageBox(result);
            }
            return(res);
        }
Example #21
0
        } // Draw

        /// <summary>
        /// Manages the message box exception dialog.
        /// </summary>
        private static void MessageBoxExceptionEnd(IAsyncResult result)
        {
            int? buttonPressed = Guide.EndShowMessageBox(result);
            if (buttonPressed != null && buttonPressed == 1)
                ExitApplication();
            else
            {
                exception = null;
                Time.ResumeGame();
            }
        } // MessageBoxExceptionEnd
Example #22
0
        /// <summary>
        /// Called when the Guide message box was closed.
        /// </summary>
        /// <param name="asyncResult">The async result.</param>
        private void OnMessageBoxEnd(IAsyncResult asyncResult)
        {
            int?button = Guide.EndShowMessageBox(asyncResult);

            if (button.HasValue && button.Value == 1)
            {
                _showException = true;
            }
            else
            {
                Exit();
            }
        }
Example #23
0
        /// <summary>
        /// Displays a message box that contains the specified text, title bar caption, and response buttons.
        /// </summary>
        /// <param name="text">The message to display.</param>
        /// <param name="caption">The title of the message box.</param>
        /// <param name="buttons">The captions for message box buttons. The maximum number of buttons is two.</param>
        /// <returns>The <see cref="Task"/> object representing the asynchronous operation.</returns>
#if WINDOWS_PHONE || WINDOWS_PHONE_81
        public virtual Task <int> ShowAsync(string text, string caption, IEnumerable <string> buttons)
        {
            var taskCompletionSource = new TaskCompletionSource <int>();

            Guide.BeginShowMessageBox(caption, text, buttons, 0, MessageBoxIcon.None, ar =>
            {
                var buttonIndex = Guide.EndShowMessageBox(ar);

                Deployment.Current.Dispatcher.BeginInvoke(() => taskCompletionSource.SetResult(buttonIndex.GetValueOrDefault(-1)));
            }, null);

            return(taskCompletionSource.Task);
        }
        /// <summary>
        /// A callback for either of the message boxes asking the user
        /// to select a new device, either from cancelling the device
        /// seledctor or disconnecting the device.
        /// </summary>
        /// <param name="result">The result of the prompt.</param>
        private void ReselectPromptCallback(IAsyncResult result)
        {
            int?choice = Guide.EndShowMessageBox(result);

            // get the device if the user chose the first option
            state = choice.HasValue && choice.Value == 0 ? StorageDevicePromptState.ShowSelector : StorageDevicePromptState.None;

            // fire an event for the game to know the result of the prompt
            promptEventArgs.ShowDeviceSelector = state == StorageDevicePromptState.ShowSelector;
            if (DeviceReselectPromptClosed != null)
            {
                DeviceReselectPromptClosed(this, promptEventArgs);
            }
        }
Example #25
0
        /// <summary>
        /// Prompts the user with a yes-or-no question.
        /// </summary>
        /// <param name="caption">The dialog caption.</param>
        /// <param name="message">The dialog message.</param>
        /// <returns>The user's answer.</returns>
        public static bool ShowPrompt(string caption, string message)
        {
            // HACK: WP's MessageBox.Show only allows Ok/Cancel but we need Yes/No
            //       so we have to use XNA's MessageBox, which allows much more customization
            //       But it's asynchronous, so we need to wait until the callback is called.

            int?result = 1;  // index of the button the user taps
            var evt    = new ManualResetEvent(false);

            Guide.BeginShowMessageBox(caption, message, YesNoStrings, 1, MessageBoxIcon.None,
                                      o => { result = Guide.EndShowMessageBox(o); evt.Set(); }, null);
            evt.WaitOne();
            return(result == 0);
        }
Example #26
0
        private static void ExMessage(Exception p_Exception)
        {
            IAsyncResult ar = Guide.BeginShowMessageBox("提示"
                                                        , p_Exception.Message
                                                        , new List <String>()
            {
                "确定"
            }
                                                        , 0
                                                        , Microsoft.Xna.Framework.GamerServices.MessageBoxIcon.Alert
                                                        , null, new Object());

            Guide.EndShowMessageBox(ar);
        }
 // Token: 0x0600289A RID: 10394 RVA: 0x00153BF4 File Offset: 0x00151DF4
 protected static void GetMBResult(IAsyncResult r)
 {
     try
     {
         if (Guide.EndShowMessageBox(r) == 0 && SaveState.loadState())
         {
             SaveState.beginResume = true;
         }
     }
     finally
     {
         AppMain.g_ao_sys_global.is_show_ui = false;
     }
 }
Example #28
0
        protected string ShowMessage(string message, string caption, IEnumerable <string> buttons)
        {
            var result = Guide.BeginShowMessageBox(caption, message, buttons, 0, MessageBoxIcon.None, null, null);

            result.AsyncWaitHandle.WaitOne();

            var choice = Guide.EndShowMessageBox(result);

            if (choice.HasValue)
            {
                return(buttons.ToArray()[choice.Value]);
            }

            return(null);
        }
Example #29
0
        private void OnMessageBoxAction(IAsyncResult ar)
        {
            int?selectedButton = Guide.EndShowMessageBox(ar);

            switch (selectedButton)
            {
            case 0:
                Deployment.Current.Dispatcher.BeginInvoke(
                    () => DeletePart2());
                break;

            default:
                break;
            }
        }
Example #30
0
        private static void UserPermissionCallback(IAsyncResult r)
        {
            int?dialogResult = Guide.EndShowMessageBox(r);

            if (dialogResult == null || dialogResult == 1)
            {
                mDoesUserWantCustomSoundtrack = true;
            }
            else
            {
                mDoesUserWantCustomSoundtrack = false;

                PlaySong(mSongLastRequested, true, mIsSongUsingGlobalContent);
            }
        }