예제 #1
0
        /// <summary>
        /// Event handler that will search the recipe list for recipe objects whose title contains the query found in the recipe search text box.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        ///


        private void Search()
        {
            string query = TextBox_ByRecipeSearch.Text.ToLower();

            RecipeBook book = RecipeBook.Instance;

            if (!query.Equals("search by recipe") || (bool)TagSearchVisibilityCheckBox.IsChecked)
            {
                List <Tag> tags = new List <Tag>();
                if ((bool)TagSearchVisibilityCheckBox.IsChecked)
                {
                    foreach (Tag t in TagListBox.SelectedItems)
                    {
                        tags.Add(t);
                    }
                }

                if (query == "search by recipe")
                {
                    query = "";
                }

                ListBox_EditRecipe.ItemsSource = book.RecipeSearchController(query, tags);
            }
            else
            {
                ListBox_EditRecipe.ItemsSource = book.Recipes;
            }
        }
예제 #2
0
        public SearchIngredient()
        {
            InitializeComponent();
            TextBoxOptions();
            RecipeBook book = RecipeBook.Instance;

            ListBox_SearchIngredient.ItemsSource = book.Recipes;
            ListBox_IngredientList.DataContext   = Pantry.Ingredients;
            ListBox_IngredientList.ItemsSource   = Pantry.Ingredients;
        }
예제 #3
0
        public SearchRecipe()
        {
            InitializeComponent();
            TextBoxOptions();

            RecipeBook book = RecipeBook.Instance;

            //ListRecipes(book.Recipes);
            TagListBox.ItemsSource         = Enum.GetValues(typeof(Tag));
            ListBox_EditRecipe.ItemsSource = book.Recipes;
            ListBox_PantryList.ItemsSource = Pantry.Ingredients;
        }
예제 #4
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            RecipeBook book = RecipeBook.Instance;

            book.SaveRecipes();
        }
예제 #5
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     Pantry.ReadIngredientsFromFile();
     RecipeBook book = RecipeBook.Instance;
 }