Esempio n. 1
0
 protected override void CreateKey(string key)
 {
     var teams = new List<TeamToSaveToDatabase>();
     var firstTeam = new TeamToSaveToDatabase(FIRST_TEAM_ID, new List<TeamMember>());
     teams.Add(firstTeam);
     IsolatedStorageSettings.ApplicationSettings.Add(TEAMS_KEY, teams);
 }
Esempio n. 2
0
        public void SaveTeam(TeamToSaveToDatabase team)
        {
            List<TeamToSaveToDatabase> teams = GetTeams();
            var unmodifiedTeams = teams.Where(t => t.TeamId != team.TeamId).ToList();
            unmodifiedTeams.Add(team);

            IsolatedStorageSettings.ApplicationSettings[TEAMS_KEY] = unmodifiedTeams;
            IsolatedStorageSettings.ApplicationSettings.Save();
        }
Esempio n. 3
0
        public Team(TeamToSaveToDatabase teamFromDatabase)
        {
            _heroRepository = new HeroRepository();

            TeamId = teamFromDatabase.TeamId;
            TeamMembers = TeamMemberMapper.Map(teamFromDatabase.TeamMembers);

            var heroes = TeamMembers.Select(h => h.ThisHero);
            CurrentHealth = heroes.Sum(h => h.HitPoints);
            TotalHealth = heroes.Sum(h => h.HitPoints);
        }
Esempio n. 4
0
 public void SaveTeam(Team team)
 {
     var teamMemberForDatabase = TeamMemberMapper.Map(team.TeamMembers);
     var teamForDatabase = new TeamToSaveToDatabase(team.TeamId, teamMemberForDatabase);
     SaveTeam(teamForDatabase);
 }