Exemplo n.º 1
0
 public async static void SaveGameFileAsync(Game game)
 {
     var gameJson = JsonConvert.SerializeObject(game);
     var fileName = GetGameFileName(game);
     var gameFile = await localFolder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting);
     await FileIO.WriteTextAsync(gameFile, gameJson);
 }
 public GameDetailViewModel(Game game, ObservableCollection<PlayerStat> playerStats)
 {
     this.Game = game;
     this.PlayerStats = playerStats;
     this.SelectPlayers = new RelayCommand(() => OnSelectPlayers());
     this.SaveSelectedPlayers = new RelayCommand(() => OnSaveSelectedPlayers());
     this.SaveGame = new RelayCommand(() => OnSaveGame());
     this.EditGame = new RelayCommand(() => OnEditGame());
     this.DeleteGame = new RelayCommand(() => OnDeleteGame());
     this.EmailGame = new RelayCommand(() => OnEmailGame());
     this.SortPlayersByName = new RelayCommand(() => OnSortPlayersByName());
     this.SortPlayersByNumber = new RelayCommand(() => OnSortPlayersByNumber());
 }
        public static void PopulateWithData(StatsDataSource dataSource)
        {
            var gamesGroup = new AppDataGroup("Games");
            var game1 = new Game("Baltimore Alliance", new DateTime(2012, 1, 1));
            game1.SharksScore = 59;
            game1.OpponentScore = 27;
            gamesGroup.Items.Add(game1);
            gamesGroup.Items.Add(new Game("Baltimore Stars", new DateTime(2013, 1, 2)));
            gamesGroup.Items.Add(new Game("Pikesville", new DateTime(2013, 1, 3)));
            gamesGroup.Items.Add(new Game("Ravens A", new DateTime(2013, 1, 4)));
            gamesGroup.Items.Add(new Game("6th Man Warriors", new DateTime(2013, 1, 5)));
            dataSource.AllGroups.Add(gamesGroup);

            var playersGroup = new AppDataGroup("Players");
            playersGroup.Items.Add(new Player("Tyler Clark", 0, "ms-appx:///Assets/0-tyler.jpg"));
            playersGroup.Items.Add(new Player("Mazae Blake", 1, "ms-appx:///Assets/1-mazae.jpg"));
            playersGroup.Items.Add(new Player("Justin Michelotti", 12, "ms-appx:///Assets/12-justinM.jpg"));
            dataSource.AllGroups.Add(playersGroup);
        }
Exemplo n.º 4
0
 private static string GetGameFileName(Game game)
 {
     return string.Format("game-{0}-{1}.stgame", game.Opponent, game.Date.ToString("yyyy.MM.dd"));
 }
Exemplo n.º 5
0
 public async static Task<StorageFile> GetGameFileAsync(Game game)
 {
     var fileName = GetGameFileName(game);
     var gameFile = await localFolder.GetFileAsync(fileName);
     return gameFile;
 }
Exemplo n.º 6
0
 public async static void DeleteGameFileAsync(Game game)
 {
     var fileName = GetGameFileName(game);
     var gameFile = await localFolder.GetFileAsync(fileName);
     await gameFile.DeleteAsync();
 }
Exemplo n.º 7
0
 public void OpenEditGame(Game game)
 {
     this.IsNewGame = false;
     this.Game = game;
     Navigator.NavigateTo<EditGamePage>();
 }