Example #1
0
        public Form2(LeyHontCalculator _LHC)
        {
            PoliticalParties = new List <PoliticalPartieVisualComponentResult>();

            LHC = _LHC;
            InitializeComponent();

            pos         = 120;
            line_height = 40;

            foreach (PoliticalParty p in LHC.PoliticalParties)
            {
                PoliticalPartieVisualComponentResult Partie = new PoliticalPartieVisualComponentResult(pos, p.PartyName, p.NumberOfSeats);
                PoliticalParties.Add(Partie);
                pos += line_height;

                if (Height < pos)
                {
                    Height += line_height;
                    Show();
                }
            }

            lResultsSummary.Text = LHC.GetGeneralComments();

            SetControls();
        }
Example #2
0
        private void GetResults_Click(object sender, EventArgs e)
        {
            string Error;

            Error = CheckResults();

            if (Error == "")
            {
                if (LHC is null)
                {
                    LHC = new LeyHontCalculator(seats, threshold, census, blanks, invalid);
                    foreach (PoliticalPartieVisualComponent p in PoliticalParties.Where(p => p.Initialized == true))
                    {
                        LHC.AddPoliticalParty(p._PartiName(), p._NumberOfVotes());
                    }
                    LHC.PartiesHaveBeenAdded();
                    LHC.GetResults();

                    form2 = new Form2(LHC);
                }
                // Show the result after having done the calculations.
                if (form2 is null)
                {
                    form2 = new Form2(LHC);
                }

                form2.Show();
            }
            else
            {
                MessageBox.Show(Error);
            }
        }