private GlobalData()
        {
            recipeList.Add(_shanghaiNoodlesRecipe);
            recipeList.Add(_burger);
            recipeList.Add(_holymackeral);
            recipeList.Add(_chowmein);
            recipeList.Add(_salad);

            /* faveList.Add(_shanghaiNoodlesRecipe);
             * faveList.Add(_burger);
             * faveList.Add(_holymackeral);
             * faveList.Add(_chowmein);
             * faveList.Add(_salad);*/
            //Adds a profile page for each recipe
            for (int i = 0; i < recipeList.Count; i++)
            {
                RecipeProfilePage recipeProfilePage = new RecipeProfilePage(recipeList[i]);
                recipePageList.Add(recipeProfilePage._recipe._name, recipeProfilePage);
            }

            lookUpTerms.Add("marinade", "A marinade is a sauce, typically made of oil, vinegar, spices, and herbs, in which meat, fish, or other food is soaked before cooking in order to flavor or soften it.");
            lookUpTerms.Add("Mince", "Cut up or grind into very small pieces, typically using grinder but can be done using knife");

            accountList.Add("foodluver123");
            accountList.Add("*****@*****.**");
            accountList.Add("123456789");
            accountList.Add("1");
            accountList.Add("2");

            accountList.Add("foodisLIFE");
            accountList.Add("*****@*****.**");
            accountList.Add("123456789123456789123456789");
            accountList.Add("2");
            accountList.Add("2");
        }
Exemple #2
0
        private void foodProfileButton_Click(object sender, RoutedEventArgs e)
        {
            if (!GlobalData.Instance.recentList.Contains(recipe))
            {
                GlobalData.Instance.recentList.Add(recipe);
            }
            else if (GlobalData.Instance.recentList.Contains(recipe))
            {
                GlobalData.Instance.recentList.Remove(recipe);
                GlobalData.Instance.recentList.Add(recipe);
            }
            RecipeProfilePage profile = GlobalData.Instance.recipePageList[Title];

            //profile.backPage = RecipeProfilePage.BackPage.SEARCH;


            //Maybe set a flag? Also need to set something as current recipe
            GlobalData.Instance.currentRecipe = recipe;

            //resetting the start button to "START" since its changed to continue during navigation bak from steps
            profile._startButton.initAppearance(TransitionPageButton.Orientation.FORWARD, "START");
            //resetting current step to zero when accessed from favourites page
            profile._currentStep    = 0;
            profile._completionPage = null;

            ((MainWindow)App.Current.MainWindow).currentRecipePageButtonImageBrush.ImageSource = (BitmapImage)Application.Current.Resources["currentRecipeButtonDarkIcon"];
            ((MainWindow)App.Current.MainWindow).searchPageButtonImageBrush.ImageSource        = (BitmapImage)Application.Current.Resources["searchButtonIcon"];
            GlobalData.Instance.savedMainWindowContent        = ((MainWindow)App.Current.MainWindow).Main.Content;
            GlobalData.Instance.backPageTag                   = RecipeProfilePage.BackPage.SEARCH;
            ((MainWindow)App.Current.MainWindow).Main.Content = profile;
        }
Exemple #3
0
        private void CurrentRecipePageButton_Click(object sender, RoutedEventArgs e)
        {
            currentRecipePageButtonImageBrush.ImageSource = currentRecipeButtonDarkImage; // dark

            searchPageButtonImageBrush.ImageSource   = searchButtonImage;                 // light
            cookbookPageButtonImageBrush.ImageSource = cookbookButtonImage;
            profilePageButtonImageBrush.ImageSource  = profileButtonImage;
            if (GlobalData.Instance.currentRecipe == null)
            {
                Main.Content = currentRecipePage1;
            }
            else
            {
                // should not create new instance here
                // Main.Content = new RecipeProfilePage(GlobalData.Instance.currentRecipe);
                if (!GlobalData.Instance.currentRecipe.modified)
                {
                    Dictionary <String, RecipeProfilePage> recipes = GlobalData.Instance.recipePageList;
                    RecipeProfilePage recipeProfile = recipes[GlobalData.Instance.currentRecipe._name];
                    Main.Content = recipeProfile;
                }
                else
                {
                    for (int i = 0; i < GlobalData.Instance.modRecipeList.Count; i++)
                    {
                        if (GlobalData.Instance.currentRecipe._name == GlobalData.Instance.modRecipeList[i]._name)
                        {
                            RecipeProfilePage recipeProfile = GlobalData.Instance.modrecipePageList[i];
                            Main.Content = recipeProfile;
                            break;
                        }
                    }
                }
            }
        }
        private void foodProfileButton_Click(object sender, RoutedEventArgs e)
        {
            int i = Int32.Parse(this.Number) - 1;

            //IF recipe is not modified: Open the profile page and add it to recent page
            if (this.Modified == false)
            {
                for (int j = 0; j < _recipeList.Count; j++)
                {
                    if (this.Title == _recipeList[j]._name)
                    {
                        if (!_recentList.Contains(_recipeList[j]))
                        {
                            _recentList.Add(_recipeList[j]);
                        }
                        else if (_recentList.Contains(_recipeList[j]))
                        {
                            _recentList.Remove(_recipeList[j]);
                            _recentList.Add(_recipeList[j]);
                        }
                        RecipeProfilePage profile = _recipePageList[_recipeList[j]._name];//new RecipeProfilePage(GlobalData.Instance.recipeList[i]);
                        //profile.backPage = _backPageTag;

                        //Maybe set a flag? Also need to set something as current recipe
                        GlobalData.Instance.currentRecipe = _recipeList[j];

                        //resetting the start button to "START" since its changed to continue during navigation bak from steps
                        profile._startButton.initAppearance(TransitionPageButton.Orientation.FORWARD, "START");
                        //resetting current step to zero when accessed from favourites page
                        profile._currentStep    = 0;
                        profile._completionPage = null;

                        GlobalData.Instance.savedMainWindowContent = ((MainWindow)App.Current.MainWindow).Main.Content;
                        GlobalData.Instance.backPageTag            = RecipeProfilePage.BackPage.COOKBOOK;

                        ((MainWindow)App.Current.MainWindow).currentRecipePageButtonImageBrush.ImageSource = (BitmapImage)Application.Current.Resources["currentRecipeButtonDarkIcon"];
                        ((MainWindow)App.Current.MainWindow).cookbookPageButtonImageBrush.ImageSource      = (BitmapImage)Application.Current.Resources["cookbookButtonIcon"];
                        ((MainWindow)App.Current.MainWindow).Main.Content = profile;
                        break;
                    }
                }
            }
            //If you are a modified recipe: Dont add it to recently viewed tab
            //And Open page using page list (mod version)
            else
            {
                RecipeProfilePage modprofile = _modrecipePageList[i];//new RecipeProfilePage(GlobalData.Instance.recipeList[i]);
                //Maybe set a flag. Also need to set something as current recipe
                GlobalData.Instance.currentRecipe = _modrecipeList[i];

                GlobalData.Instance.savedMainWindowContent = ((MainWindow)App.Current.MainWindow).Main.Content;
                GlobalData.Instance.backPageTag            = RecipeProfilePage.BackPage.COOKBOOK;

                ((MainWindow)App.Current.MainWindow).currentRecipePageButtonImageBrush.ImageSource = (BitmapImage)Application.Current.Resources["currentRecipeButtonDarkIcon"];
                ((MainWindow)App.Current.MainWindow).cookbookPageButtonImageBrush.ImageSource      = (BitmapImage)Application.Current.Resources["cookbookButtonIcon"];
                ((MainWindow)App.Current.MainWindow).Main.Content = modprofile;
            }
        }
        private void Next_Click(object sender, RoutedEventArgs e)
        {
            RecipeProfilePage recipeProfile = GetRecipeProfilePage();

            recipeProfile._completionPage = this;
            recipeProfile._currentStep    = 0;
            recipeProfile._startButton.initAppearance(TransitionPageButton.Orientation.FORWARD, "COMPLETION PAGE");
            this.NavigationService.Navigate(recipeProfile);
        }
        private void Back_Click(object sender, RoutedEventArgs e)
        {
            RecipeProfilePage recipeProfile = GetRecipeProfilePage();

            recipeProfile._completionPage = null;
            recipeProfile._currentStep    = currentRecipe._steps.Count - 1;
            recipeProfile._startButton.initAppearance(TransitionPageButton.Orientation.FORWARD, "CONTINUE");

            StepByStepPage step = recipeProfile.mainStep.allSteps.ElementAt(currentRecipe._steps.Count - 1);

            this.NavigationService.Navigate(step);
        }
Exemple #7
0
        public StepByStepPage(Recipe recipe, int currentStep)
        {
            InitializeComponent();

            this.currentRecipe = recipe;
            this.currentStep   = currentStep;
            this.recipeSteps   = currentRecipe.GetSteps();

            _recipeName.Text = currentRecipe.getName();
            _stepNumber.Text = "Step " + (currentStep + 1) + " of " + recipeSteps.Count();

            if (currentStep < recipeSteps.Count)
            {
                String step = recipeSteps.ElementAt(currentStep);
            }

            if (currentStep == 0)
            {
                // need a way to make it hidden
                // TO: DO  need a clearner way to do this
                _previousStep.transitionPageButton.IsEnabled  = false;
                _previousStep.transitionPageButton.Visibility = System.Windows.Visibility.Hidden;
                _previousStep.initAppearance(TransitionPageButton.Orientation.BACK, "");
            }
            else
            {
                _previousStep.initAppearance(TransitionPageButton.Orientation.BACK, "PREVIOUS");
            }

            setStepBody(recipeSteps.ElementAt(currentStep));
            _nextStep.transitionPageButton.Click     += Next_Step_Click;
            _previousStep.transitionPageButton.Click += Prev_Step_Click;
            _backButton.transitionPageButton.Click   += Back_Button_Click;


            _backButton.initAppearance(TransitionPageButton.Orientation.BACK, "BACK");
            _nextStep.initAppearance(TransitionPageButton.Orientation.FORWARD, "NEXT");


            //setting a reference for the current step in recipeProfile everytime navigated to this step page

            recipeProfilePage = GetRecipeProfilePage();
            recipeProfilePage._startButton.initAppearance(TransitionPageButton.Orientation.FORWARD, "CONTINUE");
            if (!currentRecipe.modified)
            {
                _timer.setStepTime(currentRecipe._timerValuesForSteps.ElementAt(currentStep), currentStep + 1, currentRecipe._name);
            }
        }
        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            bool nameTaken = false;

            for (int i = 0; i < GlobalData.Instance.modRecipeList.Count; i++)
            {
                if (recipeMod._name == GlobalData.Instance.modRecipeList[i]._name)
                {
                    nameTaken = true;
                }
            }
            if (!nameTaken || recipeMod.modified)
            {
                //If the recipe is an original, then add it into the modified tab
                if (recipeMod.modified == false)
                {
                    //Need to add into ModList
                    recipeMod.modified = true;          //Flag as modified recipe
                    globalModRecipeList.Add(recipeMod); //Add it into the modified recipe list
                                                        //Also make an instance of a profile page for later access

                    /*
                     * bool nameInRecipe = false;
                     * for(int i = 0; i < GlobalData.Instance.recipeList.Count; i++)
                     * {
                     *  if(recipeMod._name == GlobalData.Instance.recipeList[i]._name)
                     *  {
                     *      nameInRecipe = true;
                     *  }
                     * }*/
                    //if (nameInRecipe)
                    //  recipeMod._name = "*" + recipeMod._name;

                    RecipeProfilePage modProfilePage = new RecipeProfilePage(recipeMod);
                    globalModPageList.Add(modProfilePage);
                }
                //If the recipe is modified, then the edits will just replace it
                else
                {
                    //I need to know the one i'm replacing
                    globalModRecipeList.RemoveAt(recipeNum);
                    globalModPageList.RemoveAt(recipeNum);

                    globalModRecipeList.Insert(recipeNum, recipeMod);
                    RecipeProfilePage modProfilePage = new RecipeProfilePage(recipeMod);
                    globalModPageList.Insert(recipeNum, modProfilePage);
                }

                //Need to reload previous page, just gonna be hard coded to favourite page rn...
                //Probably pass in previous page into this page. Or have "previous page" as a global data. and reload it when this button is pressed.
                //CookbookPage1 prevPage = new CookbookPage1();
                //((MainWindow)App.Current.MainWindow).Main.Content = prevPage;
                //this.NavigationService.Navigate(previousPage);
                GlobalData.Instance.currentRecipe    = null;
                GlobalData.Instance.goBackToPersonal = true;
                CookbookPage1 x = new CookbookPage1();
                ((MainWindow)App.Current.MainWindow).currentRecipePageButtonImageBrush.ImageSource = (BitmapImage)Application.Current.Resources["currentRecipeButtonIcon"];
                ((MainWindow)App.Current.MainWindow).cookbookPageButtonImageBrush.ImageSource      = (BitmapImage)Application.Current.Resources["cookbookButtonDarkIcon"];
                this.NavigationService.Navigate(x);
            }
            else
            {
                error1.Visibility = System.Windows.Visibility.Visible;
            }
        }