//for mango public static void CreateApplicationTile() { var appTile = ShellTile.ActiveTiles.First(); if (appTile != null) { string tileText = ""; var items = IsolatedStorageOperations.GetHighScores().OrderByDescending(p => p.Score); if (items.Count() == 0) { tileText += "-----"; } else { var item = items.FirstOrDefault(); tileText = item.Initials + " - " + item.Score.ToString(); } var standardTile = new StandardTileData { Title = "Snap 21", BackgroundImage = new Uri("tilefront.png", UriKind.Relative), Count = null,// any number can go here, leaving this null shows NO number BackTitle = tileText, BackBackgroundImage = new Uri("tileicon.png", UriKind.Relative), BackContent = "High Score" }; appTile.Update(standardTile); } }
private void clearButton_Click(object sender, RoutedEventArgs e) { MessageBoxResult m = MessageBox.Show("Are you sure you want to delete the high scores?", "Confirm", MessageBoxButton.OKCancel); if (m == MessageBoxResult.OK) { IsolatedStorageOperations.DeleteXML(); listBox.ItemsSource = null; messageText.Text = "There are no high scores yet."; clearButton.Visibility = Visibility.Collapsed; } }
public HighScorePage() { InitializeComponent(); var v = (Visibility)Resources["PhoneLightThemeVisibility"]; if (v == Visibility.Visible) { backgroundimage.Source = (ImageSource) new ImageSourceConverter().ConvertFromString("images/highscores_light.png"); } //IsolatedStorageOperations.DeleteXML(); // IsolatedStorageOperations.InitializeHighScores(); // IsolatedStorageOperations.WriteHighScores(); try { var items = IsolatedStorageOperations.GetHighScores().OrderByDescending(p => p.Score); if (items.Count() == 0) { messageText.Text = "There are no high scores yet."; clearButton.Visibility = Visibility.Collapsed; } if (items.Count() <= 10) { listBox.ItemsSource = items; } if (items.Count() > 10) { listBox.ItemsSource = items.Take(10); } } catch { MessageBox.Show("Error Loading High Scores!"); } }