示例#1
0
        private void scoreOnlineFail(object sender, ScoreEventArgs e)
        {
            submitPending = false;

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                MessageBoxResult m = MessageBox.Show("The score was unable to submit. Would you like to try again?", "Connection problem", MessageBoxButton.OKCancel);
                if (m == MessageBoxResult.OK)
                {
                    SubmitBtn_Click((object)SubmitBtn, new RoutedEventArgs());
                }
                else
                {
                    scoreOnlineSuccess(sender, e);
                }
            });
        }
示例#2
0
        public void ScoreOnlineHandler(object sender, ScoreEventArgs e)
        {
            XDocument resultXML = XDocument.Parse(e.result);
            var scoresRaw = from score in resultXML.Descendants("player")
                select new
                {
                    PlayerName = score.Attribute("username").Value,
                    ScoreChild = score.Descendants("score")
                };

            List<ScoreResult> scoreList = new List<ScoreResult>();
            foreach(var score in scoresRaw)
            {
                foreach (var pointData in score.ScoreChild)
                {
                    ScoreResult scoreObj = new ScoreResult(Convert.ToInt32(pointData.Attribute("score").Value),
                        score.PlayerName.ToString(), null);

                    String countryIso = pointData.Attribute("data").Value;
                    if (countryIso != null)
                    {
                        Country scoreCountry = (from country in Country.CountryList
                                                where country.Iso == countryIso
                                                select country).FirstOrDefault();

                        if (scoreCountry != null)
                            scoreObj.PlayerCountry = scoreCountry;
                    }

                    scoreList.Add(scoreObj);
                }
            }

            // Uruchomienie metody dodającej pozycję rankingowe przez ten sam wątek
            Deployment.Current.Dispatcher.BeginInvoke(()=>
            {
                AddLadderPlayers(HighscoreOnlineList, scoreList);
                OnlineProgressBar.Visibility = Visibility.Collapsed;
            });
        }
示例#3
0
        private void scoreOnlineSuccess(object sender, ScoreEventArgs e)
        {
            submitPending = false;

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
            });
        }