/// <summary>
        /// ExecuteLoadRecipeStepCommand Method
        /// </summary>
        ///
        /// <remarks>
        /// An async Method which executes a command. In this case creates a List of the RecipeSteps of the current
        /// Recipe Item.
        /// </remarks>
        ///
        /// <returns>
        /// Task Object -- Used with Threading
        /// </returns>
        async Task ExecuteLoadRecipeStepCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                RecipeSteps.Clear();
                var items = await DataStore.GetItemAsync(Item.Id);

                foreach (var recipeStep in items.RecipeSteps)
                {
                    RecipeSteps.Add(recipeStep);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #2
0
 public Recipe(CreateRecipeDto createRecipeDto)
 {
     Title       = createRecipeDto.Title;
     Description = createRecipeDto.Description;
     Saved       = createRecipeDto.Saved;
     createRecipeDto.RecipeSteps?.ForEach(step =>
     {
         var recipeStep = new RecipeStep(step);
         RecipeSteps.Add(recipeStep);
     });
 }