Exemplo n.º 1
0
 private void Settings_Load(object sender, EventArgs e)
 {
     LoadIngredients(meatPath, meatType);
     LoadIngredients(veggiePath, veggieType);
     LoadIngredients(fruitPath, fruitType);
     LoadIngredients(miscItemPath, miscType);
     EntryMeatNewMasterIngredient.Focus();
 }
Exemplo n.º 2
0
        /************************GENERIC METHODS***************************/
        //Add new Ingredient
        private void AddNewIngredient(string filePath, int type)
        {
            //add new ingredient to teh file
            StreamWriter outputFile;

            outputFile = File.AppendText(filePath);

            switch (type)
            {
            //Meat
            case 1:
                outputFile.WriteLine(EntryMeatNewMasterIngredient.Text);
                outputFile.Close();
                LstMasterMeatIngredients.Items.Clear();
                LoadIngredients(filePath, type);
                EntryMeatNewMasterIngredient.Clear();
                EntryMeatNewMasterIngredient.Focus();
                break;

            //Veggie
            case 2:
                outputFile.WriteLine(EntryNewVeggie.Text);
                outputFile.Close();
                LstMasterVeggieIngredients.Items.Clear();
                LoadIngredients(filePath, type);
                EntryNewVeggie.Clear();
                EntryNewVeggie.Focus();
                break;

            //Fruit
            case 3:
                outputFile.WriteLine(EntryFruit.Text);
                outputFile.Close();
                LstMasterFruit.Items.Clear();
                LoadIngredients(filePath, type);
                EntryFruit.Clear();
                EntryFruit.Focus();
                break;

            //Misc Item
            case 4:
                outputFile.WriteLine(EntryMiscellaneous.Text);
                outputFile.Close();
                LstMasterMiscellaneous.Items.Clear();
                LoadIngredients(filePath, type);
                EntryMiscellaneous.Clear();
                EntryMiscellaneous.Focus();
                break;

            default:
                MessageBox.Show("There is something wrong with the AddNewIngredient method.");
                break;
            }
        }