Ejemplo n.º 1
0
        private async Task GetSampleDataAsync()
        {
            if (this._groups.Count != 0)
            {
                return;
            }

            Uri dataUri = new Uri("ms-appx:///DataModel/Database.json");

            StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(dataUri);

            string jsonText = await FileIO.ReadTextAsync(file);

            JsonObject jsonObject = JsonObject.Parse(jsonText);
            JsonArray  jsonArray  = jsonObject["Groups"].GetArray();

            foreach (JsonValue groupValue in jsonArray)
            {
                JsonObject      groupObject = groupValue.GetObject();
                DataClassArtist group       = new DataClassArtist(groupObject["UniqueId"].GetString(),
                                                                  groupObject["Artist"].GetString(),
                                                                  groupObject["Period"].GetString(),
                                                                  groupObject["Title"].GetString(),
                                                                  groupObject["ImagePath"].GetString(),
                                                                  groupObject["ThreeDPath"].GetString(),
                                                                  groupObject["Description"].GetString(),
                                                                  groupObject["Content"].GetString());

                this.Groups.Add(group);
            }
        }
Ejemplo n.º 2
0
        public static IEnumerable <DataClassGroups> GetArtistGroup(ObservableCollection <DataClassArtist> _dataclass)
        {
            ObservableCollection <string>          str       = new ObservableCollection <string>();
            ObservableCollection <DataClassGroups> group_DCG = new ObservableCollection <DataClassGroups>();

            //Period
            foreach (DataClassArtist data in _dataclass)
            {
                if (!str.Contains(data.Artist))
                {
                    str.Add(data.Artist);
                }
            }
            foreach (string data in str)
            {
                var             matches = (IEnumerable <DataClassArtist>)_dataclass.Where((group) => group.Artist.Equals(data));
                DataClassGroups DCG     = new DataClassGroups(matches.First().Artist);

                foreach (DataClassArtist match in matches)
                {
                    DataClassArtist new_DCG = new DataClassArtist(match.UniqueId, match.Artist, match.Period, match.Title, match.ImagePath, match.ThreeDPath, match.Description, match.Content);
                    DCG.Items.Add(new_DCG);
                }
                group_DCG.Add(DCG);
            }

            return(group_DCG);
        }
Ejemplo n.º 3
0
        public static IEnumerable <DataClassGroups> GetSculptureGroup(ObservableCollection <DataClassArtist> _dataclass)
        {
            ObservableCollection <DataClassGroups> group_DCG = new ObservableCollection <DataClassGroups>();
            //Period
            var             matches = (IEnumerable <DataClassArtist>)_dataclass.Where((group) => group.Content.Equals("Sculpture"));
            DataClassGroups DCG     = new DataClassGroups("Sculpture");

            foreach (DataClassArtist match in matches)
            {
                DataClassArtist new_DCG = new DataClassArtist(match.UniqueId, match.Artist, match.Period, match.Title, match.ImagePath, match.ThreeDPath, match.Description, match.Content);
                DCG.Items.Add(new_DCG);
            }
            group_DCG.Add(DCG);

            return(group_DCG);
        }