Beispiel #1
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);
            }
        }