예제 #1
0
파일: Application.cs 프로젝트: rc183/igf
 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);
 }
예제 #2
0
        private void onSessionCreation(IAsyncResult res)
        {
            NetworkSession createdSession = null;

            try
            {
                createdSession = NetworkSession.EndCreate(res);
            }
            catch
            {
                createdSession = null;
            }

            if (createdSession == null)
            {
                if (!Guide.IsVisible)
                {
                    Guide.BeginShowMessageBox(PlayerIndex.One, "Error Creating Multiplayer Game", "An error occurred during the creation of the multiplayer session.", new string[] { "OK" }, 0, MessageBoxIcon.Error, null, null);
                }
                GLibXNASampleGame.Instance.SetScreen("MainMenu");
                return;
            }

            GLibXNASampleGame.Instance.SessionManagement.JoinSession(createdSession);
            GLibXNASampleGame.Instance.NetworkTransmitter.Session = createdSession;
            GLibXNASampleGame.Instance.SetScreen("NetworkLobby");
        }
예제 #3
0
        private void checkAvailableSpace()
        {
            using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForDomain())
            {
                if (isoStore.AvailableFreeSpace < SPACE_MINIMUM)
                {
//                    Debug.WriteLine("WARN: Less than 1mb available. Free space: " + (isoStore.AvailableFreeSpace / 1000) + "kb");

                    storageCheckResult = Guide.BeginShowMessageBox(InputManager.PlayerIndex,
                                                                   "Error",
                                                                   "The configured storage device does not have enough free space.\n\nShape Shop requires at least 1MB of available space to save your progress.",
                                                                   new List <String>()
                    {
                        "Exit Shape Shop"
                    },
                                                                   0,
                                                                   MessageBoxIcon.Alert,
                                                                   null,
                                                                   null);
                    state = StorageState.ReadyCheckAvailableSpace;
                }
                else
                {
                    state = StorageState.ReadyFirstPass;
                }
            }
        }
예제 #4
0
        void geoWatcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e)
        {
            currentState = e.Status;

            switch (e.Status)
            {
            case GeoPositionStatus.Disabled:
                if (geoWatcher.Permission == GeoPositionPermission.Denied)
                {
                    string[] strings = { "ok" };
                    Guide.BeginShowMessageBox("Info", "Please turn on geo-location service in the settings tab.", strings, 0, 0, ExitGame, null);
                }
                else
                if (geoWatcher.Permission == GeoPositionPermission.Granted)
                {
                    string[] strings = { "ok" };
                    Guide.BeginShowMessageBox("Error", "Your device doesn't support geo-location service.", strings, 0, 0, ExitGame, null);
                }
                break;

            case GeoPositionStatus.Ready:
                CurrentGeoCoord = geoWatcher.Position;
                break;
            }
        }
예제 #5
0
 void Session_GameStarted(object sender, GameStartedEventArgs e)
 {
     if (!Guide.IsVisible)
     {
         Guide.BeginShowMessageBox("Multiplayer!", "You joined a network session that just started! Our sample ends here. Go wherever you want with your code now!", new string[] { "Great!" }, 0, MessageBoxIcon.None, toMPScreen, null);
     }
 }
예제 #6
0
        public async void Sync()
        {
            string errorString = null;



            try
            {
                await App.MobileService.SyncContext.PushAsync();
            }
            catch (MobileServicePushFailedException ex)
            {
                errorString = "Push failed because of sync errors: " +
                              ex.PushResult.Errors.Count + " errors, message: " + ex.Message;
            }
            catch (Exception ex)
            {
                errorString = "Push failed: " + ex.Message +
                              "\n\nIf you are still in an offline scenario, " +
                              "you can try your Push again when connected with your Mobile Serice.";
            }

            if (errorString != null)
            {
                Guide.BeginShowMessageBox(
                    "Azure Error",
                    errorString,
                    new string[] { "OK" },
                    0,
                    MessageBoxIcon.Error,
                    null, null);
            }
        }
예제 #7
0
 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);
         }
     }
 }
예제 #8
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);
     }
 }
예제 #9
0
        // Token: 0x06000067 RID: 103 RVA: 0x0000C050 File Offset: 0x0000A250
        public void LoadLeaderboardEntries()
        {
            SignedInGamer signedInGamer = Gamer.SignedInGamers[PlayerIndex.One];
            int           num           = ObjectSystem.globalVariables[114];

            try
            {
                LeaderboardIdentity leaderboardId;
                if (num == 0)
                {
                    leaderboardId = LeaderboardIdentity.Create(LeaderboardKey.BestScoreLifeTime, num);
                }
                else
                {
                    leaderboardId = LeaderboardIdentity.Create(LeaderboardKey.BestTimeLifeTime, num + 1);
                }
                GlobalAppDefinitions.gameMode = 7;
                LeaderboardReader.BeginRead(leaderboardId, signedInGamer, 100, new AsyncCallback(this.LeaderboardReadCallback), signedInGamer);
            }
            catch (GameUpdateRequiredException e)
            {
                this.ReadNullLeaderboardEntries();
                this.HandleGameUpdateRequired(e);
            }
            catch (Exception)
            {
                this.ReadNullLeaderboardEntries();
                Guide.BeginShowMessageBox("Xbox LIVE", EngineCallbacks.liveErrorMessage[(int)GlobalAppDefinitions.gameLanguage], new string[]
                {
                    "OK"
                }, 0, MessageBoxIcon.Alert, new AsyncCallback(EngineCallbacks.LiveErrorMessage), 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>
        /// <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
        }
예제 #11
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);
        }
        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);
        }
예제 #13
0
        private async void HandleCCTerminalNotInstalled()
        {
            // We suggest showing the user an error with a easy way
            // to download the app by showing a message dialog similar
            // to the one below.
            IAsyncResult result = Guide.BeginShowMessageBox(
                "App Not Installed",
                "You'll need to install Credit Card Terminal before you can use this feature. " +
                "Click Install below to begin the installation process.",
                new string[] { "Install", "Close" },
                0, // Set the command that will be invoked by default
                Microsoft.Xna.Framework.GamerServices.MessageBoxIcon.Alert,
                null,
                null);

            // Make message box synchronous
            result.AsyncWaitHandle.WaitOne();

            int?choice = Microsoft.Xna.Framework.GamerServices.Guide.EndShowMessageBox(result);

            if (choice.HasValue)
            {
                if (choice.Value == 0)
                {
                    // User clicks on the Install button
                    // Open the windows store link to Credit Card Terminal
                    await Launcher.LaunchUriAsync(new Uri(ChargeRequest.CCTERMINAL_WP8_STORE_LINK));
                }
            }
        }
예제 #14
0
        private void Login()
        {
            var status = window.GetChild <TextBlock>("status");

            if (status != null)
            {
                status.Enabled = true;
            }
            var name = Player.Name;
            var key  = Player.ApiKey;

            Player = null;
            api.Login(name, key, new Action <PlayerResponse, Exception>(
                          (p, e) =>
            {
                Thread.Sleep(1000);
                if (e == null && p.Ok)
                {
                    Player = p.Player;
                }
                else
                {
                    DeleteSave();
                    Guide.BeginShowMessageBox("Error", "Failed to login: "******"Ok" }, 0, MessageBoxIcon.Error, null, null);
                }
                if (status != null)
                {
                    status.Enabled = false;
                }
                UpdateButtons();
            }));
        }
예제 #15
0
        protected override void Update(GameTime gameTime)
        {
            try
            {
                if (!shownMessage)
                {
                    if (!Guide.IsVisible)
                    {
                        Guide.BeginShowMessageBox(
                            PlayerIndex.One,
                            ErrorTitle,
                            ErrorMessage,
                            ErrorButtons,
                            0,
                            MessageBoxIcon.Error,
                            result => Exit(),
                            null);
                        shownMessage = true;
                    }
                }
            }
            catch { }

            base.Update(gameTime);
        }
예제 #16
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);
 }
예제 #17
0
 /// <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);
     }
 }
예제 #18
0
        public async void deleteSecretAzure(string rowkey)
        {
            TableOperation retrieveOperation = TableOperation.Retrieve <SendData>("secret", rowkey);

            try
            // Execute the operation.
            {
                TableResult retrievedResult = await table.ExecuteAsync(retrieveOperation);

                // Assign the result to a CustomerEntity.
                SendData deleteEntity = (SendData)retrievedResult.Result;

                // Create the Delete TableOperation.
                if (deleteEntity != null)
                {
                    TableOperation deleteOperation = TableOperation.Delete(deleteEntity);

                    // Execute the operation.
                    await table.ExecuteAsync(deleteOperation);
                }
            }
            catch (Exception)
            {
                Guide.BeginShowMessageBox(
                    "Azure Error",
                    "Cannot delete from azure please check internet connection",
                    new string[] { "OK" }, 0,
                    MessageBoxIcon.Alert, null, null);
            }
        }
예제 #19
0
        void ChangeDetected(object sender, NetworkNotificationEventArgs e)
        {
            string change = string.Empty;

            switch (e.NotificationType)
            {
            case NetworkNotificationType.InterfaceConnected:
                change = "Connected to ";
                ChatModel.AzureConnected = true;
                break;

            case NetworkNotificationType.InterfaceDisconnected:
                change = "Disconnected from ";
                ChatModel.AzureConnected = false;
                break;

            case NetworkNotificationType.CharacteristicUpdate:
                change = "Characteristics changed for ";
                break;

            default:
                change = "Unknown change with ";
                break;
            }

            string changeInformation = String.Format(" {0} {1} {2} ({3})",
                                                     DateTime.Now.ToString(), change, e.NetworkInterface.InterfaceName,
                                                     e.NetworkInterface.InterfaceType.ToString());

            Guide.BeginShowMessageBox("Network", changeInformation, new string[] { "Yes", "NO" }, 0, MessageBoxIcon.Warning, null, null);
        }
예제 #20
0
 public static void Show(string title, string text, IEnumerable <string> buttons, int focusButton, MessageBoxIcon icon, AsyncCallback callback)
 {
     if (Guide.IsVisible)
     {
         return;
     }
     Guide.BeginShowMessageBox(title, text, buttons, focusButton, icon, callback, null);
 }
 /// <summary>
 /// Triggered when the btnXNAMessage control is clicked. Displays an asynchronous XNA message box to the user which poses a question
 /// and provides two button with custom responses.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnXNAMessage_Click(object sender, RoutedEventArgs e)
 {
     Guide.BeginShowMessageBox("Migration - Displaying Alerts", "Star Trek or Star Wars?",
                               new List <string> {
         "Star Trek", "Star Wars"
     }, 0, MessageBoxIcon.None,
                               new AsyncCallback(OnXNAMessageClose), null);
 }
예제 #22
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);
 }
예제 #24
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);
        }
예제 #25
0
        /// <summary>
        /// Respond to "Quit Game" Item Selection
        /// </summary>
        /// <param name="playerIndex"></param>
        protected override void OnCancel(PlayerIndex playerIndex)
        {
            AudioManager.StopSounds();

            // Give the user a chance to save his current progress
            Guide.BeginShowMessageBox("Save Game", "Do you want to save your progress?",
                                      new String[] { "Yes", "No" }, 0, MessageBoxIcon.Warning,
                                      ShowSaveDialogEnded, null);
        }
예제 #26
0
        private void btn_analiz_Click(object sender, RoutedEventArgs e)
        {
            string analiz = IsimAnalizi(txt_isim.Text);

            if (analiz != "")
            {
                Guide.BeginShowMessageBox(StringBuyult(txt_isim.Text.Trim()), char.ToUpper(analiz[0]) + analiz.Substring(1), new string[] { "Kapat" }, 0, MessageBoxIcon.None, new AsyncCallback(Paylas), null);
            }
        }
예제 #27
0
        public virtual void MessageBox(string title, string text, MessageBoxIcon icon)
        {
#if WINDOWS
            Game.Freezed = true;
            List <string> buttons = new List <string>();
            buttons.Add("OK");
            Guide.BeginShowMessageBox(PlayerIndex.One, title, text, buttons, 0, icon, new AsyncCallback(message_done), null);
#endif
        }
예제 #28
0
 private void DeleteSelected_Click(object sender, RoutedEventArgs e)
 {
     Guide.BeginShowMessageBox(
         "Please confirm",
         "Are you sure you want to delete this Item?",
         new string[] { "Yes", "No" }, 0,
         MessageBoxIcon.Warning,
         new AsyncCallback(OnMessageBoxAction),
         null);
 }
예제 #29
0
 // helper method for showing guide messages
 private static void ShowMessageBox(PlayerIndex?player, string title, string text, IEnumerable <string> buttons, AsyncCallback callback)
 {
     if (player.HasValue)
     {
         Guide.BeginShowMessageBox(player.Value, title, text, buttons, 0, MessageBoxIcon.None, callback, null);
     }
     else
     {
         Guide.BeginShowMessageBox(title, text, buttons, 0, MessageBoxIcon.None, callback, null);
     }
 }
예제 #30
0
        /// <summary>
        /// Handler called once the server reports a specific game is unavailable.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void GameUnavailable(object sender, EventArgs e)
        {
            while (Guide.IsVisible)
            {
            }
            ;

            Guide.BeginShowMessageBox("The game " + NetworkManager.Instance.gameName + " is unavailable",
                                      "Do you want to create a new game with same name, or join another game?",
                                      new[] { "Create", "Join" }, 0, MessageBoxIcon.None, UnavailableGameDialogEnded, null);
        }