Пример #1
0
        private void LoadRecipe(RecipeShort shortRecipe)
        {
            string documentsPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);

            documentsPath = Path.Combine(documentsPath, "recipes", shortRecipe.Id + ".json");

            using (StreamReader r = new StreamReader(documentsPath))
            {
                string json = r.ReadToEnd();
                Recipe = Newtonsoft.Json.JsonConvert.DeserializeObject <Recipe>(json);
            }
        }
Пример #2
0
 public void DeleteFromList(RecipeShort recipe)
 {
     Recipes.Delete(recipe);
     ShortRecipeList.ItemsSource = Recipes.items;
 }
Пример #3
0
 public ViewRecipePage(RecipeShort shortRecipe)
 {
     InitializeComponent();
     LoadRecipe(shortRecipe);
     DisplayRecipe();
 }
Пример #4
0
        public void Delete(RecipeShort recipe)
        {
            int ind = items.IndexOf(el => el.Id == recipe.Id);

            items.RemoveAt(ind);
        }