private void saveToHighScoresButton_Click(object sender, RoutedEventArgs e) { highScores.Add(new HighScore() { Initials = initialsTextBox.Text.ToUpper(), Score = thescore }); //add the high score IsolatedStorageOperations.AddToHighScores(highScores); //create an application tile now so the most updated high score is shown TileOperations.CreateApplicationTile(); //also save the users initials so when they come back next time they dont have to enter them // var settings = IsolatedStorageSettings.ApplicationSettings; if (settings.Contains("LastInitials")) { settings["LastInitials"] = initialsTextBox.Text.ToUpper(); } else { settings.Add("LastInitials", initialsTextBox.Text.ToUpper()); } settings.Save(); // //Navigate to the high score page. (Application.Current.RootVisual as PhoneApplicationFrame).Source = new Uri("/HighScorePage.xaml", UriKind.Relative); }
public GameRecapControl(int score, NavigationService n) { InitializeComponent(); nav = n; thescore = score; yourScoreText.Text = score.ToString(); highScores = IsolatedStorageOperations.GetHighScores(); if (highScores.Count != 0 && highScores.Count <= 10) { if (highScores.Min(p => p.Score) > score) { saveToHighScoresButton.Visibility = Visibility.Collapsed; } } //find out who last initials saved are var settings = IsolatedStorageSettings.ApplicationSettings; if (settings.Contains("LastInitials")) { initialsTextBox.Text = settings["LastInitials"].ToString(); } }