private void SetupResultTable(Dictionary <string, int> Results) { /*Label Name, Preference; * AVote roundResult = new AVote(new ArrayList(), new ArrayList()); * foreach (KeyValuePair<string, int> Result in this.Results) * { * Name = new Label(); * Preference = new Label(); * Name.Text = Result.Key; * * Preference.Text = (Result.Value > 0? Result.Value.ToString() : "P"); * * Name.Font = new Font("Modern No. 20", 12); * Preference.Font = Name.Font; * Name.Margin = new Padding(0); * Preference.Margin = new Padding(0); * Name.Size = new Size(this.NameLabelPanel.Width / Results.Count, this.NameLabelPanel.Height); * Preference.Size = new Size(this.PreferenceLabelPanel.Width / Results.Count, this.PreferenceLabelPanel.Height); * this.NameLabelPanel.Controls.Add(Name); * this.PreferenceLabelPanel.Controls.Add(Preference); * }*/ List <string> Candidates = new List <string>(); List <int> Preferences = new List <int>(); AVote roundResult = new AVote(new ArrayList(), new ArrayList()); foreach (KeyValuePair <string, int> Result in Results) { Candidates.Add(Result.Key); roundResult.candidateList.Add(Result.Key + ""); //Add candidate Preferences.Add(Result.Value); roundResult.voteCandidate.Add(Result.Value + ""); //Add vote } this.TablePanel.Controls.Add(this.Table = new VotingInfoTable(Candidates, Preferences, true)); this.dataResult.Add(roundResult); }
public VoteCandidate(List <string> Candidates, List <AVote> Ballots, AddVoteSystem AddVoteForm) { InitializeComponent(); this.Candidates = Candidates; this.Ballots = Ballots; this.AddVoteForm = AddVoteForm; this.TablePanel.Controls.Add(this.Table = new VotingInfoTable(Candidates, null, false)); }