private async void GetData() { var model = await _apiServices.Kalendar(App.Zbor.Id); foreach (var d in model.Dogadjaji) { var colors = d.BackgroundColor.Substring(4, d.BackgroundColor.Length - 5).Split(","); int r = Int32.Parse(colors[0]); int g = Int32.Parse(colors[1]); int b = Int32.Parse(colors[2]); var ev = new CalendarInlineEvent() { StartTime = DateTime.Parse(d.Start), EndTime = DateTime.Parse(d.End), Subject = d.Title, Color = Color.FromRgb(r, g, b) }; CalendarInlineEvents.Add(ev); } IsBusy = false; }
void PageLoad() { List <EventList> list = new List <EventList>(); list.Add(new EventList(DateTime.Now.AddDays(-1), DateTime.Now.AddDays(-1).AddHours(3), "Netflix & Chill", Color.DarkBlue)); list.Add(new EventList(DateTime.Now.AddDays(1), DateTime.Now.AddDays(1).AddHours(3), "Netflix & Chill", Color.DarkRed)); list.Add(new EventList(DateTime.Now.AddDays(1), DateTime.Now.AddDays(1).AddHours(3), "Netflix & Chill", Color.DarkGreen)); list.Add(new EventList(DateTime.Now.AddDays(2), DateTime.Now.AddDays(2).AddHours(3), "Netflix & Chill", Color.DarkBlue)); list.Add(new EventList(DateTime.Now.AddDays(3), DateTime.Now.AddDays(3).AddHours(3), "Netflix & Chill", Color.DarkRed)); list.Add(new EventList(DateTime.Now.AddDays(4), DateTime.Now.AddDays(4).AddHours(3), "Netflix & Chill", Color.DarkGreen)); list.Add(new EventList(DateTime.Now.AddDays(5), DateTime.Now.AddDays(5).AddHours(3), "Netflix & Chill", Color.DarkBlue)); list.Add(new EventList(DateTime.Now.AddDays(5), DateTime.Now.AddDays(5).AddHours(3), "Netflix & Chill", Color.DarkRed)); list.Add(new EventList(DateTime.Now.AddDays(6), DateTime.Now.AddDays(6).AddHours(3), "Netflix & Chill", Color.DarkGreen)); list.Add(new EventList(DateTime.Now.AddDays(7), DateTime.Now.AddDays(7).AddHours(3), "Netflix & Chill", Color.DarkBlue)); list.Add(new EventList(DateTime.Now.AddDays(8), DateTime.Now.AddDays(8).AddHours(3), "Netflix & Chill", Color.DarkRed)); list.Add(new EventList(DateTime.Now.AddDays(9), DateTime.Now.AddDays(9).AddHours(3), "Netflix & Chill", Color.DarkGreen)); list.Add(new EventList(DateTime.Now.AddDays(10), DateTime.Now.AddDays(10).AddHours(3), "Netflix & Chill", Color.DarkBlue)); list.Add(new EventList(DateTime.Now.AddDays(10), DateTime.Now.AddDays(10).AddHours(3), "Netflix & Chill", Color.DarkRed)); list.Add(new EventList(DateTime.Now.AddDays(10), DateTime.Now.AddDays(10).AddHours(3), "Netflix & Chill", Color.DarkGreen)); foreach (var item in list) { CalendarInlineEvent event1 = new CalendarInlineEvent(); event1.StartTime = item.StartTime; event1.EndTime = item.EndTime; event1.Subject = item.Subject; event1.Color = item.Color; CalendarInlineEvents.Add(event1); } }