Exemplo n.º 1
0
        private void Button_Click_Add(object sender, RoutedEventArgs e)
        {
            int    id      = int.Parse(IDText.Text);
            string name    = NameText.Text;
            string surname = SurnameText.Text;
            Player player  = PlayersViewModel.Players.FindByID(id);

            if (player != null && player.Name == name && player.Surname == surname)
            {
                if (Team.PlayersList.FindByID(id) == null)
                {
                    Team.PlayersList.Add(player);
                    TeamWindow.Refresh();
                    //  TeamViewModel.SaveTeamViewModel();
                    this.Close();
                }
                else
                {
                    ErrorWindow errorWindow = new ErrorWindow
                    {
                        Width = 500
                    };
                    errorWindow.ErrorContent.Text = "This player is already in this team";
                    errorWindow.Show();
                }
            }
            else
            {
                ErrorWindow errorWindow = new ErrorWindow()
                {
                    Width = 500
                };
                errorWindow.Show();
            }
        }
Exemplo n.º 2
0
 public RemovePlayerFromTeamWindow(Team team, TeamWindow teamWindow, TeamViewModel teamViewModel)
 {
     TeamViewModel = teamViewModel;
     TeamWindow    = teamWindow;
     Team          = team;
     InitializeComponent();
 }
Exemplo n.º 3
0
 public AddPlayerToTeamWindow(Team team, TeamWindow teamWindow, TeamViewModel teamViewModel, PlayersViewModel playersViewModel)
 {
     PlayersViewModel = playersViewModel;
     TeamWindow       = teamWindow;
     TeamViewModel    = teamViewModel;
     Team             = team;
     InitializeComponent();
 }
Exemplo n.º 4
0
 private void MyListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (TeamViewModel == null)
     {
         if (MyListBox.SelectedItem is Team team)
         {
             TeamWindow teamWindow = new TeamWindow(team);
             teamWindow.Show();
         }
     }
     else
     {
         if (MyListBox.SelectedItem is Team team)
         {
             TeamWindow teamWindow = new TeamWindow(team, TeamViewModel, PlayersViewModel);
             teamWindow.Show();
         }
     }
 }