Example #1
0
 private void HandleBtnView_Click(object sender, RoutedEventArgs e)
 {
     var teamEdit = new TeamEdit(fileHandler);
     teamEdit.SetTeam(team);
     teamEdit.SetPlayers(players);
     teamEdit.ShowTeam();
     teamView.Hide();
     ModalDisplay.ShowModal(teamEdit, teamView);
     if (teamEdit.GetButtonAction().Equals(ButtonAction.DONE))
     {
         team = teamEdit.GetTeam();
         team.SetTeamID(teamID);
         fileHandler.UpdateTeam(team);
         SetTeamDetail(teamID);
     }
     teamView.ShowDialog();
 }
 private void ShowEditDialog(int teamID)
 {
     var teamEdit = new TeamEdit(fileHandler);
     var team = fileHandler.GetTeam(teamID);
     teamEdit.SetTeam(team);
     var playerIDs = team.GetPlayerIDs();
     var teamPlayers = new Dictionary<int, Player>();
     foreach (var playerID in playerIDs)
     {
         teamPlayers.Add(playerID, fileHandler.GetPlayers()[playerID]);
     }
     teamEdit.SetPlayers(teamPlayers);
     teamEdit.ShowTeam();
     ModalDisplay.ShowModal(teamEdit, modalSelect);
     if (teamEdit.GetButtonAction().Equals(ButtonAction.DONE))
     {
         var newTeam = teamEdit.GetTeam();
         newTeam.SetTeamID(teamID);
         fileHandler.UpdateTeam(newTeam);
         modalSelect.DisplayTeams(fileHandler.GetTeams());
     }
 }