00001 00002 using System; 00003 using Gtk; 00004 using Foodolini.Activities; 00005 using Foodolini.BusinessLogic; 00006 00007 namespace Foodolini.Activities.Cookbook 00008 { 00009 00010 [TreeNode (ListOnly = true)] 00011 public class RecipeAdapter : TreeNode 00012 { 00019 public RecipeAdapter(Recipe recipe) 00020 { 00021 this.Recipe = recipe; 00022 this.Type = "Unknown"; 00023 foreach (var category in recipe.Categories) 00024 { 00025 if(category == "Breakfast" | category == "Dinner" | category == "Lunch" | category == "Other") 00026 this.Type = category; 00027 } 00028 this.Rating = recipe.AverageRating; 00029 } 00030 00034 [Gtk.TreeNodeValueAttribute(Column=0)] 00035 public string Title{ 00036 get{return Recipe.Title;} 00037 } 00038 00042 [Gtk.TreeNodeValueAttribute(Column=2)] 00043 public string Type{get; private set;} 00044 00048 [Gtk.TreeNodeValueAttribute(Column=1)] 00049 public double Rating{get; private set;} 00050 00051 00055 public Recipe Recipe{get; private set;} 00056 } 00057 }