private static diseaseDataGroup CreatediseaseGroup(JsonObject obj)
        {
            diseaseDataGroup group = new diseaseDataGroup();

            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;
                }
            }

            _diseaseDataSource.AllGroups.Add(group);
            return(group);
        }
        private static void CreatediseasesAnddiseaseGroups(JsonArray array)
        {
            foreach (var item in array)
            {
                var              obj     = item.GetObject();
                diseaseDataItem  disease = new diseaseDataItem();
                diseaseDataGroup group   = null;

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

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

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

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

                    case "treatments":
                        disease.treatments = val.GetString();
                        break;

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

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

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

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

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

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

                        if (group == null)
                        {
                            group = CreatediseaseGroup(diseaseGroup);
                        }

                        disease.Group = group;
                        break;
                    }
                }

                if (group != null)
                {
                    group.Items.Add(disease);
                }
            }
        }
 public diseaseDataItem(String uniqueId, String title, String shortTitle, String imagePath, String treatments, ObservableCollection <string> medicines, diseaseDataGroup group)
     : base(uniqueId, title, shortTitle, imagePath)
 {
     this._treatments = treatments;
     this._medicines  = medicines;
     this._group      = group;
 }