Exemplo n.º 1
0
        private void SelectCandidate_Click(object sender, RoutedEventArgs e)
        {
            Button   Sender           = (Button)sender;
            long     Id               = (long)Sender.Tag;
            Category selectedCategory = (Category)CategoryList.SelectedItem;

            if (selectedCategory.CountSelected > selectedCategory.MaxVote - 1)
            {
                new Views.ErrorWindow("Maximum number of candidates selected!!!").ShowDialog();
                return;
            }
            foreach (Candidate candidate in Candidates)
            {
                if (candidate.UniqueId == Id)
                {
                    if (candidate.Selected)
                    {
                        break;
                    }
                    VoteFor.Add(candidate);
                    candidate.Selected              = true;
                    selectedCategory.CountSelected += 1;
                }
            }
        }