Exemplo n.º 1
0
        public RecipeDetailPage(SecureRecipe selectedRecipe)
        {
            InitializeComponent();

            var viewModel = new RecipeDetailViewModel(selectedRecipe, Navigation);

            BindingContext = viewModel;
        }
Exemplo n.º 2
0
        public EditRecipePage(SecureRecipe recipe)
        {
            InitializeComponent();

            _viewModel = new EditRecipeViewModel(recipe, Navigation);

            mealPicker.SelectedIndex       = mealPicker.Items.IndexOf(recipe.MealType);
            difficultyPicker.SelectedIndex = difficultyPicker.Items.IndexOf(recipe.Difficulty);

            BindingContext = _viewModel;
        }
Exemplo n.º 3
0
        public EditRecipeViewModel(INavigation nav)
        {
            _nav = nav;

            Recipe           = new SecureRecipe();
            RecipeName       = "";
            PreparationTime  = "";
            CookTime         = "";
            NumberOfServings = 0;
            WillMakeAgain    = false;
            Difficulty       = Foodie.Difficulty.Easy;
            MealType         = Foodie.MealType.Breakfast;
            Ingredients      = "";
            IsRecommended    = false;
            ImageName        = GenerateImageName();
        }
Exemplo n.º 4
0
        public EditRecipeViewModel(SecureRecipe recipe, INavigation nav) : this(nav)
        {
            Recipe       = recipe;
            _isNewRecipe = false;

            RecipeName       = Recipe.RecipeName;
            PreparationTime  = Recipe.PreparationTime;
            CookTime         = Recipe.CookTime;
            NumberOfServings = Recipe.NumberOfServings;
            WillMakeAgain    = Recipe.WillMakeAgain;
            Difficulty       = Recipe.Difficulty;
            MealType         = Recipe.MealType;
            Ingredients      = Recipe.Ingredients;
            Directions       = Recipe.Directions;
            IsRecommended    = Recipe.IsRecommended;
            ImageName        = Recipe.ImageName;
        }
        public RecipeDetailViewModel(SecureRecipe recipe, INavigation nav)
        {
            _nav = nav;

            Recipe = recipe;
            PopulateViewModelProps();

            // Subscribe to the recipe updated message
            MessagingCenter.Subscribe <EditRecipeViewModel>(this, RecipeSavedMessage, async(obj) =>
            {
                var dataSvc     = DependencyService.Get <IAzureService>();
                var recipeTable = await dataSvc.GetTable <SecureRecipe>();

                Recipe = await recipeTable.GetSingle(this.Recipe.Id);

                PopulateViewModelProps();
            });
        }