示例#1
0
 public void LoadOptions(Post p)
 {
     foreach (Post.Candidate c in p.cand)
     {
         PostButton pb = new PostButton();
         pb.Height      = height;
         pb.Width       = width;
         pb.Margin      = new Thickness(margin);
         pb.Content     = c.Name;
         pb.CandidateID = c.CandidateID;
         pb.Click      += SelectCandidate;
         CandidateWrapPanel.Children.Add(pb);
         Console.WriteLine("loaded " + c.Name);
     }
 }
示例#2
0
        private void SelectCandidate(object sender, RoutedEventArgs e)
        {
            PostButton postbutton = (PostButton)sender;

            selectedCandidate = postbutton.CandidateID;
            foreach (PostButton pb in CandidateWrapPanel.Children)
            {
                pb.Background = MainWindow.PrimaryBrush;
            }
            postbutton.Background = MainWindow.HighlightBrush;
            //foreach (Post.Candidate.Demographic d in MainWindow.post[PostID].cand[(int)selectedCandidate].demo)
            //{
            //    MessageBox.Show(d.Name);
            //}
            //MessageBox.Show((postbutton.CandidateID + PostID).ToString());
        }