Example #1
0
        private async Task GetTalks()
        {
            var result = new ObservableCollection <Talk>();

            List <JSONTalk> jsonTalks = await GetJSONTalksFromWeb();

            foreach (var data in jsonTalks)
            {
                if (!data.enabled)
                {
                    continue;
                }
                DateTime from = Convert.ToDateTime(data.startTime).ToUniversalTime();
                DateTime to   = Convert.ToDateTime(data.endTime).ToUniversalTime();
                if (data.description == null || data.description.Length <= 0)
                {
                    data.description = new [] { "TBA" };
                }
                result.Add(new Talk()
                {
                    Id          = data.id,
                    EventName   = data.title,
                    From        = new DateTime(2019, 11, 26, from.Hour, from.Minute, from.Second),
                    To          = new DateTime(2019, 11, 26, to.Hour, to.Minute, to.Second),
                    Color       = data.color,
                    SubTitle    = data.subTitle,
                    Description = String.Join(Environment.NewLine, data.description)
                });
            }

            Talks.Clear();
            foreach (var talk in result)
            {
                Talks.Add(talk);
            }
        }