private void addRedCardsHome_Click(object sender, RoutedEventArgs e) { var addEventWindow = new AddEvent(matchTime, homeLineup, homeExchanges); var addEvent = addEventWindow.ShowDialog(); if (addEvent == true) { match.HomeRedCards.Add(addEventWindow.Result); homeRedCards = new ObservableCollection <Event>(match.HomeRedCards); homeRedCardsList.ItemsSource = homeRedCards; Player activePlayer = ServiceLocator.Instance.PlayerService.GetBy(addEventWindow.Result.PlayerId); activePlayer.RedCards.Add(match.Id); } }
private void addYellowCardsAway_Click(object sender, RoutedEventArgs e) { var addEventWindow = new AddEvent(matchTime, visitorLineup, visitorExchanges); var addEvent = addEventWindow.ShowDialog(); if (addEvent == true) { match.VisitorYellowCards.Add(addEventWindow.Result); visitorYellowCards = new ObservableCollection <Event>(match.VisitorYellowCards); visitorYellowCardsList.ItemsSource = visitorYellowCards; Player activePlayer = ServiceLocator.Instance.PlayerService.GetBy(addEventWindow.Result.PlayerId); activePlayer.YellowCards.Add(match.Id); } }
private void addAssistAway_Click(object sender, RoutedEventArgs e) { List <MatchMinute> minutes = match.VisitorGoals.Select(g => g.TimeOfEvent).ToList(); var addEventWindow = new AddEvent(minutes, visitorLineup, visitorExchanges); var addEvent = addEventWindow.ShowDialog(); if (addEvent == true) { match.VisitorAssists.Add(addEventWindow.Result); visitorAssists = new ObservableCollection <Event>(match.VisitorAssists); visitorAssistsList.ItemsSource = visitorAssists; Player activePlayer = ServiceLocator.Instance.PlayerService.GetBy(addEventWindow.Result.PlayerId); activePlayer.Assists.Add(match.Id); } }
private void addGoalHome_Click(object sender, RoutedEventArgs e) { var addEventWindow = new AddEvent(matchTime, homeLineup, homeExchanges); var addEvent = addEventWindow.ShowDialog(); if (addEvent == true) { match.HomeGoals.Add(addEventWindow.Result); homeGoals = new ObservableCollection <Event>(match.HomeGoals); homeScore++; homeTeamScoreBlock.DataContext = homeScore; homeGoalsList.ItemsSource = homeGoals; Player activePlayer = ServiceLocator.Instance.PlayerService.GetBy(addEventWindow.Result.PlayerId); activePlayer.Goals.Add(match.Id); } }