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); } }
public void DeleteFromList(RecipeShort recipe) { Recipes.Delete(recipe); ShortRecipeList.ItemsSource = Recipes.items; }
public ViewRecipePage(RecipeShort shortRecipe) { InitializeComponent(); LoadRecipe(shortRecipe); DisplayRecipe(); }
public void Delete(RecipeShort recipe) { int ind = items.IndexOf(el => el.Id == recipe.Id); items.RemoveAt(ind); }