Пример #1
0
        public DisplaySelectedRecipePage(SweetsRecipe selected)
        {
            InitializeComponent();

            _model = new DisplaySelectedRecipePageViewModel(selected);

            BindingContext = _model;
        }
        public DisplaySelectedRecipePageViewModel(SweetsRecipe selected)
        {
            Selected = selected;

            RecipeName         = Selected.RecipeName;
            RecipeDescriptions = Selected.RecipeDescriptions;
            Ingredients        = Selected.Ingredients;
        }
        private async void ListView_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            SweetsRecipe selected = (SweetsRecipe)_mainPageViewModel.SelectedBaseRecipe;

            if (selected != null)
            {
                await Navigation.PushAsync(new DisplaySelectedRecipePage(selected));
            }
        }
        public bool AddRecipeCommand()
        {
            if (CheckEntryFields())
            {
                SweetsRecipe recipe = new SweetsRecipe
                {
                    RecipeName         = RecipeName,
                    RecipeDescriptions = RecipeDescriptions,
                    Ingredients        = Ingredients
                };

                _daoInstance.AddRecipe(recipe);
                Application.Current.MainPage.Navigation.PopAsync();
                return(true);
            }

            return(false);
        }
        private IBaseRecipe Recipe2()
        {
            IBaseRecipe recipe1 = new SweetsRecipe
            {
                RecipeName         = "Calitate cu dulceata",
                RecipeDescriptions = "Cand ai chef de clatite..."
            };

            BaseIngredient ingredient1 = new BaseIngredient
            {
                Name     = "Dulceata de visine",
                Quantity = "un borcan"
            };

            BaseIngredient ingredient2 = new BaseIngredient
            {
                Name     = "Faina",
                Quantity = "un pahar"
            };

            BaseIngredient ingredient3 = new BaseIngredient
            {
                Name     = "Apa minerala",
                Quantity = "un sfert de pahar"
            };

            List <BaseIngredient> baseIngredients1 =
                new List <BaseIngredient>()
            {
                ingredient1, ingredient2, ingredient3
            };

            recipe1.AddMoreIngredients(baseIngredients1);

            return(recipe1);
        }
        private IBaseRecipe Recipe1()
        {
            IBaseRecipe recipe1 = new SweetsRecipe
            {
                RecipeName         = "Placinta cu mere",
                RecipeDescriptions = "O placinta buna"
            };

            BaseIngredient ingredient1 = new BaseIngredient
            {
                Name     = "Mere",
                Quantity = "20"
            };

            BaseIngredient ingredient2 = new BaseIngredient
            {
                Name     = "Faina",
                Quantity = "4 pahare"
            };

            BaseIngredient ingredient3 = new BaseIngredient
            {
                Name     = "Drojdie",
                Quantity = "o bucata"
            };

            List <BaseIngredient> baseIngredients1 =
                new List <BaseIngredient>()
            {
                ingredient1, ingredient2, ingredient3
            };

            recipe1.AddMoreIngredients(baseIngredients1);

            return(recipe1);
        }