/// <summary> /// Adds a penalty to the match recording /// </summary> /// <param name="p">Penalty to record</param> public void AddPenalty(Penalty p) { AlliancePenalties.Add(p); }
private void PenaltyBtn_Click(object sender, RoutedEventArgs e) { int clickedTime = Time.CountedSeconds(); PenaltyOverlay penOverlay = new PenaltyOverlay(); penOverlay.Owner = System.Windows.Window.GetWindow(this); bool? result = penOverlay.ShowDialog(); if (result == true) // Nullable<bool> { Penalty p = new Penalty(clickedTime, penOverlay.Reasoning, Color, SelectedTeam); Record.AlliancePenalties.Add(p); ListBoxItem lbi = new ListBoxItem(); lbi.Content = p.UIForm; lbi.Foreground = new SolidColorBrush(MALFUNCTIONING_RED); lbi.FontWeight = FontWeights.SemiBold; lbi.ToolTip = "Penalty: " + p.Reasoning; lbi.Tag = p; GoalsList.Items.Add(lbi); } }