Esempio n. 1
0
        /// <summary>
        /// this method adds an entry to the list view.
        /// </summary>
        /// <param name="e">Sport score entry</param>
        private void AddToListView(SportsScore e)
        {
            var item = new ListViewItem(e.Date);

            item.SubItems.Add(e.VisitorTeam);
            item.SubItems.Add(e.VisitorScore.ToString());
            item.SubItems.Add(e.HomeTeam);
            item.SubItems.Add(e.HomeScore.ToString());
            listView.Items.Add(item);
        }
Esempio n. 2
0
 /// <summary>
 /// add button click listener
 /// </summary>
 /// <param name="sender">control object</param>
 /// <param name="e">event</param>
 private void BtnAdd_Click(object sender, EventArgs e)
 {
     ClearError();
     if (VisitorTeamIsValid(out var visitorTeam) & VisitorScoreIsValid(out var visitorScore) &
         HomeTeamIsValid(out var homeTeam) & HomeScoreIsValid(out var homeScore))
     {
         var newEntry = new SportsScore(list.Count + 1, dateTimePicker.Value.ToShortDateString(), visitorTeam,
                                        visitorScore, homeTeam, homeScore);
         list.Add(newEntry);
         AddToListView(newEntry);
         ClearTextFields();
         SetBinary();
     }
 }