private static void CreateOptredens()
        {
            foreach (var optreden in Festival.SingleFestival.Optredens)
            {
                OptredenDataItem optredenItem = new OptredenDataItem(optreden.ID,
                                                                     optreden.From,
                                                                     optreden.Until,
                                                                     optreden.Band,
                                                                     optreden.Stage,
                                                                     null);
                //optredenItem.UniqueId = optreden.ID;
                //optredenItem.From =optreden.From;
                //optredenItem.Until = optreden.Until;
                //optredenItem.Band = optreden.Band;
                //optredenItem.SetImage(optredenItem.Band.Picture);
                //optredenItem.SetTileImage(optredenItem.Band.Picture);
                //optredenItem.Stage = optreden.Stage;
                var group  = new LineUpDataGroup(optreden.LineUp);
                var groups = _optredenDataSource.AllGroups.Where(groupr => groupr.UniqueId == group.UniqueId);
                if (groups.Count() == 0)
                {
                    _optredenDataSource.AllGroups.Add(group);
                    optredenItem.Group = group;
                    group.Items.Add(optredenItem);
                }
                else
                {
                    optredenItem.Group = groups.First();
                    groups.First().Items.Add(optredenItem);
                }


                //case "group":
                //    var recipeGroup = val.GetObject();

                //    IJsonValue groupKey;
                //    if (!recipeGroup.TryGetValue("key", out groupKey))
                //        continue;

                //    dag = _recipeDataSource.AllGroups.FirstOrDefault(c => c.UniqueId.Equals(groupKey.GetString()));

                //    if (dag == null)
                //        dag = CreateRecipeGroup(recipeGroup);

                //    band.Group = dag;
                //    break;
            }
        }
Exemplo n.º 2
0
        private static LineUpDataGroup CreateRecipeGroup(JsonObject obj)
        {
            LineUpDataGroup group = new LineUpDataGroup();

            foreach (var key in obj.Keys)
            {
                IJsonValue val;
                if (!obj.TryGetValue(key, out val))
                {
                    continue;
                }

                switch (key)
                {
                case "key":
                    group.UniqueId = val.GetString();
                    break;

                case "title":
                    group.Title = val.GetString();
                    break;

                case "shortTitle":
                    group.ShortTitle = val.GetString();
                    break;

                case "description":
                    group.Description = val.GetString();
                    break;

                case "backgroundImage":
                    group.SetImage(val.GetString());
                    break;

                case "groupImage":
                    group.SetGroupImage(val.GetString());
                    break;
                }
            }

            _recipeDataSource.AllGroups.Add(group);
            return(group);
        }
Exemplo n.º 3
0
        private static void CreateRecipesAndRecipeGroups(JsonArray array)
        {
            foreach (var item in array)
            {
                var             obj    = item.GetObject();
                BandDataItem    recipe = new BandDataItem();
                LineUpDataGroup group  = null;

                foreach (var key in obj.Keys)
                {
                    IJsonValue val;
                    if (!obj.TryGetValue(key, out val))
                    {
                        continue;
                    }

                    switch (key)
                    {
                    case "key":
                        recipe.UniqueId = val.GetNumber().ToString();
                        break;

                    case "title":
                        recipe.Title = val.GetString();
                        break;

                    case "shortTitle":
                        recipe.ShortTitle = val.GetString();
                        break;

                    case "preptime":
                        recipe.PrepTime = (int)val.GetNumber();
                        break;

                    case "directions":
                        recipe.Directions = val.GetString();
                        break;

                    case "ingredients":
                        var ingredients = val.GetArray();
                        var list        = (from i in ingredients select i.GetString()).ToList();
                        recipe.Ingredients = new ObservableCollection <string>(list);
                        break;

                    case "backgroundImage":
                        recipe.SetImage(val.GetString());
                        break;

                    case "tileImage":
                        recipe.SetTileImage(val.GetString());
                        break;

                    case "group":
                        var recipeGroup = val.GetObject();

                        IJsonValue groupKey;
                        if (!recipeGroup.TryGetValue("key", out groupKey))
                        {
                            continue;
                        }

                        group = _recipeDataSource.AllGroups.FirstOrDefault(c => c.UniqueId.Equals(groupKey.GetString()));

                        if (group == null)
                        {
                            group = CreateRecipeGroup(recipeGroup);
                        }

                        recipe.Group = group;
                        break;
                    }
                }

                if (group != null)
                {
                    group.Items.Add(recipe);
                }
            }
        }
Exemplo n.º 4
0
 public BandDataItem(String uniqueId, String title, String shortTitle, String imagePath, int preptime, String directions, ObservableCollection <string> ingredients, LineUpDataGroup group)
     : base(uniqueId, title, shortTitle, imagePath)
 {
     this._preptime    = preptime;
     this._directions  = directions;
     this._ingredients = ingredients;
     this._group       = group;
 }
 public OptredenDataItem(String uniqueId, DateTime from, DateTime until, Band band, Stage stage, LineUpDataGroup group)
     : base(uniqueId, band.Name, band.Name, band.Picture)
 {
     this.UniqueId = uniqueId;
     this._from    = from;
     this._until   = until;
     this._band    = band;
     this._stage   = stage;
     this._group   = group;
 }