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); }
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); }
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) { }
public ModRecipe(ICoreTranslationHelper translationHelper, ISprite sprite, IRecipePart result, params IRecipePart[] ingredients) : this(translationHelper, sprite, result.Yield(), ingredients?.AsEnumerable()) { }
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; }
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; }