Exemple #1
0
        private void comboBoxPartyType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if(comboBoxPartyType.SelectedIndex==0)
            {
                currentParty = birthdayParty;
                currentParty.FancyDecorations = checkBoxFancy.Checked;
                currentParty.NumberOfPeople = (int) numericUpDownNumPeople.Value;
                birthdayParty.CakeWriting = textBoxCakeWriting.Text;
                labelTooLong.Visible = birthdayParty.CakeWritingTooLong;

                checkBoxHealthy.Enabled = false;
                textBoxCakeWriting.Enabled = true;
            }
            else
            {
                currentParty = dinnerParty;
                currentParty.FancyDecorations = checkBoxFancy.Checked;
                currentParty.NumberOfPeople = (int)numericUpDownNumPeople.Value;
                dinnerParty.HealthyOption = checkBoxHealthy.Checked;

                checkBoxHealthy.Enabled = true;
                textBoxCakeWriting.Enabled = false;
                labelTooLong.Visible = false;
            }

            DisplayPartyCost();
        }
Exemple #2
0
        public Form1()
        {
            InitializeComponent();

            birthdayParty = new BirthdayParty((int)numericUpDownNumPeople.Value, checkBoxHealthy.Checked, "");
            dinnerParty = new DinnerParty((int)numericUpDownNumPeople.Value, checkBoxHealthy.Checked, checkBoxFancy.Checked);

            currentParty = birthdayParty;
            comboBoxPartyType.SelectedIndex = 0;
            DisplayPartyCost();
        }