Exemplo n.º 1
0
 public NewTeamPage()
 {
     DataContext = this;
     InitializeComponent();
     _newPlayerWindow        = new NewPlayerWindow(true);
     listOfPlayers           = new List <Player>();
     playersList.ItemsSource = _newPlayerWindow.tempPlayersList;
     ToggleCreateTeamButton();
     ToggleNewPlayerButton();
     listOfPlayersUnChecked            = new List <Player>();
     saveTeamArenaNameButton.IsEnabled = false;
     showCreatedTeam.Text = $"";
 }
        private void addPlayer_Click(object sender, RoutedEventArgs e)
        {
            var newPlayerWindow       = new NewPlayerWindow(false, selectedTeam);
            var newPlayerWindowResult = newPlayerWindow.ShowDialog();

            if (selectedTeam.PlayerIds.Count() > 24)
            {
                removePlayer.IsEnabled = true;
            }
            if (selectedTeam.PlayerIds.Count() >= 30)
            {
                addPlayer.IsEnabled = false;
            }

            ServiceLocator.Instance.TeamService.Save();
            ServiceLocator.Instance.PlayerService.Save();
            playersList.Items.Refresh();
        }
Exemplo n.º 3
0
        private void NewPlayerButton_Click(object sender, RoutedEventArgs e)
        {
            if (team == null)
            {
                team = new Team(new GeneralName(TeamName), new GeneralName(ArenaName));
            }

            var  newPlayerWindow       = new NewPlayerWindow(true, team);
            bool?newPlayerWindowResult = newPlayerWindow.ShowDialog();

            if (newPlayerWindowResult == true)
            {
                listOfPlayers = newPlayerWindow.tempPlayersList;
            }
            playersList.ItemsSource = new ObservableCollection <Player>(listOfPlayers);
            ToggleCreateTeamButton();
            NewPlayerButton.IsEnabled = false;
        }