Beispiel #1
0
        public static RecipePart FromRecipePart(IRecipePart recipePart)
        {
            RecipePart r = new RecipePart
            {
                Name = recipePart.Name,
                PreparationMethod = recipePart.PreparationMethod == null ? null : Tag.FromTag(recipePart.PreparationMethod),
                PreparationTime   = recipePart.PreparationTime,
                CookTime          = recipePart.CookTime,
                ChillTime         = recipePart.ChillTime,
                Temperature       = recipePart.Temperature,
                Ingredients       = new ObservableCollection <IngredientDetail> (recipePart.Ingredients.Select <IIngredientDetail, IngredientDetail>(IngredientDetail.FromIngredientDetail)),
                Instructions      = recipePart.Instructions,
            };

            if (recipePart.Comments != null)
            {
                r.Comments = new ObservableCollection <IComment> (recipePart.Comments.Select <IComment, Comment>(Comment.FromComment).Cast <IComment> ());
            }
            return(r);
        }
Beispiel #2
0
        public static RecipePart FromRecipePart(IRecipePart recipePart)
        {
            RecipePart r = new RecipePart
            {
                Name = recipePart.Name,
                PreparationMethod  = Tag.FromTag(recipePart.PreparationMethod),
                PreparationSeconds = (int)recipePart.PreparationTime.TotalSeconds,
                CookSeconds        = (int)recipePart.CookTime.TotalSeconds,
                ChillSeconds       = (int)recipePart.ChillTime.TotalSeconds,
                Temperature        = recipePart.Temperature,
                Ingredients        =
                    recipePart.Ingredients
                    .Select <IIngredientDetail, IngredientDetail>(IngredientDetail.FromIngredientDetail)
                    .Where(i => !string.IsNullOrWhiteSpace(i.Amount) || !string.IsNullOrWhiteSpace(i.Ingredient) || !string.IsNullOrWhiteSpace(i.Preparation) || !string.IsNullOrWhiteSpace(i.Quantity))
                    .ToArray(),
                Instructions = new [] { recipePart.Instructions },
            };

            if (recipePart.Comments != null)
            {
                r.Comments = recipePart.Comments.Select <IComment, Comment>(Comment.FromComment).ToArray();
            }
            return(r);
        }
Beispiel #3
0
 public ModRecipe(ICoreTranslationHelper translationHelper, ISprite sprite, IRecipePart result, IEnumerable <IRecipePart> ingredients, string name = null, bool isCooking = false) : this(translationHelper, sprite, result.Yield(), ingredients?.AsEnumerable(), name, isCooking)
 {
 }
Beispiel #4
0
 public ModRecipe(ICoreTranslationHelper translationHelper, ISprite sprite, IRecipePart result, params IRecipePart[] ingredients) : this(translationHelper, sprite, result.Yield(), ingredients?.AsEnumerable())
 {
 }
Beispiel #5
0
 public static RecipePart FromRecipePart(IRecipePart recipePart)
 {
     RecipePart r = new RecipePart
      {
     Name = recipePart.Name,
     PreparationMethod = Tag.FromTag (recipePart.PreparationMethod),
     PreparationSeconds = (int)recipePart.PreparationTime.TotalSeconds,
     CookSeconds = (int)recipePart.CookTime.TotalSeconds,
     ChillSeconds = (int)recipePart.ChillTime.TotalSeconds,
     Temperature = recipePart.Temperature,
     Ingredients =
        recipePart.Ingredients
           .Select<IIngredientDetail,IngredientDetail>(IngredientDetail.FromIngredientDetail)
           .Where(i => !string.IsNullOrWhiteSpace (i.Amount) || !string.IsNullOrWhiteSpace (i.Ingredient) || !string.IsNullOrWhiteSpace (i.Preparation) || !string.IsNullOrWhiteSpace (i.Quantity))
           .ToArray (),
     Instructions = new [] {recipePart.Instructions},
      };
      if (recipePart.Comments != null)
     r.Comments = recipePart.Comments.Select<IComment,Comment>(Comment.FromComment).ToArray ();
      return r;
 }
Beispiel #6
0
 public static RecipePart FromRecipePart(IRecipePart recipePart)
 {
     RecipePart r = new RecipePart
      {
     Name = recipePart.Name,
     PreparationMethod = recipePart.PreparationMethod == null ? null : Tag.FromTag (recipePart.PreparationMethod),
     PreparationTime = recipePart.PreparationTime,
     CookTime = recipePart.CookTime,
     ChillTime = recipePart.ChillTime,
     Temperature = recipePart.Temperature,
     Ingredients = new ObservableCollection<IngredientDetail> ( recipePart.Ingredients.Select<IIngredientDetail,IngredientDetail>(IngredientDetail.FromIngredientDetail)),
     Instructions = recipePart.Instructions,
      };
      if (recipePart.Comments != null)
     r.Comments = new ObservableCollection<IComment> (recipePart.Comments.Select<IComment,Comment>(Comment.FromComment).Cast<IComment> ());
      return r;
 }