コード例 #1
0
ファイル: Form1.cs プロジェクト: TheRedCoderGit/CBus
        private void noonMain_SelectedIndexChanged(object sender, EventArgs e)
        {
            noonSide1.Visible      = false;
            noonSide2.Visible      = false;
            noonSide1Label.Visible = false;
            noonSide2Label.Visible = false;
            noonSide1.Items.Clear();
            NoonMeal m = (NoonMeal)noonMain.SelectedItem;

            if (m.hasSubtype1)
            {
                noonSide1.Visible      = true;
                noonSide1Label.Visible = true;
                noonSide1Label.Text    = m.subtype1Name;
                foreach (string side in m.subtypes1)
                {
                    noonSide1.Items.Add(side);
                }
                noonSide1.SelectedIndex = 0;
            }
            else
            {
                noonSide1.Visible      = false;
                noonSide1Label.Visible = false;
            }
            noonSide2.Items.Clear();
            if (m.hasSubtype2)
            {
                noonSide2.Visible      = true;
                noonSide2Label.Visible = true;
                noonSide2Label.Text    = m.subtype2Name;
                foreach (string side in m.subtypes2)
                {
                    noonSide2.Items.Add(side);
                }
                noonSide2.SelectedIndex = 0;
            }
            else
            {
                noonSide2.Visible      = false;
                noonSide2Label.Visible = false;
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: TheRedCoderGit/CBus
        private void noonFoodSource_SelectedIndexChanged(object sender, EventArgs e)
        {
            noonDrink.Visible       = false;
            noonDrinkLabel.Visible  = false;
            noonSide1.Visible       = false;
            noonSide2.Visible       = false;
            noonSide1Label.Visible  = false;
            noonSide2Label.Visible  = false;
            noonSalad1.Visible      = false;
            noonSalad2.Visible      = false;
            noonSalad1Label.Visible = false;
            noonSalad2Label.Visible = false;
            noonMain.Visible        = false;
            noonMainLabel.Visible   = false;
            if (noonFoodSource.SelectedIndex != 0)
            {
                noonDrink.Items.Clear();
                NoonFoodSource fs = (NoonFoodSource)noonFoodSource.SelectedItem;
                foreach (string drink in fs.drinks)
                {
                    noonDrink.Items.Add(drink);
                }
                if (fs.drinks.ToArray().Length > 0)
                {
                    noonDrink.Visible       = true;
                    noonDrinkLabel.Visible  = true;
                    noonDrink.SelectedIndex = 0;
                }

                noonMain.Items.Clear();
                foreach (NoonMeal meal in fs.meals)
                {
                    noonMain.Items.Add(meal);
                }
                if (fs.meals.ToArray().Length > 0)
                {
                    noonMain.Visible       = true;
                    noonMainLabel.Visible  = true;
                    noonMain.SelectedIndex = 0;

                    noonSide1.Items.Clear();
                    NoonMeal m = (NoonMeal)noonMain.SelectedItem;
                    if (m.hasSubtype1)
                    {
                        noonSide1.Visible      = true;
                        noonSide1Label.Visible = true;
                        noonSide1Label.Text    = m.subtype1Name;
                        foreach (string side in m.subtypes1)
                        {
                            noonSide1.Items.Add(side);
                        }
                        noonSide1.SelectedIndex = 0;
                    }
                    else
                    {
                        noonSide1.Visible      = false;
                        noonSide1Label.Visible = false;
                    }
                    noonSide2.Items.Clear();
                    if (m.hasSubtype2)
                    {
                        noonSide2.Visible      = true;
                        noonSide2Label.Visible = true;
                        noonSide2Label.Text    = m.subtype2Name;
                        foreach (string side in m.subtypes2)
                        {
                            noonSide2.Items.Add(side);
                        }
                        noonSide2.SelectedIndex = 0;
                    }
                    else
                    {
                        noonSide2.Visible      = false;
                        noonSide2Label.Visible = false;
                    }
                }

                noonSalad1.Items.Clear();
                foreach (string salad in fs.salads)
                {
                    noonSalad1.Items.Add(salad);
                }
                if (fs.salads.ToArray().Length > 0)
                {
                    noonSalad1.Visible       = true;
                    noonSalad1Label.Visible  = true;
                    noonSalad1.SelectedIndex = 0;

                    if (fs.salads.ToArray().Length > 1)
                    {
                        foreach (string salad in fs.salads)
                        {
                            if (!salad.Equals(noonSalad1.SelectedItem))
                            {
                                noonSalad2.Items.Add(salad);
                            }
                        }
                        noonSalad2.Visible       = true;
                        noonSalad2Label.Visible  = true;
                        noonSalad2.SelectedIndex = 0;

                        noonSalad1.Items.Remove(noonSalad2.SelectedItem);
                    }
                }
            }
        }