protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); _classes = await WindesheimManager.GetAllClasses(); FillListBox(); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter == null) { return; } _klassen = e.Parameter as IEnumerable <string>; if (_klassen == null) { return; } if (!_klassen.Any()) { return; } EnablePinButton(_klassen); var requests = await Task.WhenAll(_klassen .AsParallel() .Select(async x => await WindesheimManager.GetScheduleForClass(x))); if (requests.Any(x => x is NoInternet)) { lvSchedule.Items.Add(NO_INTERNET_AVAILBLE); return; } var completeSchedule = requests.Cast <Success <List <Les> > >().SelectMany(x => x.Value) .OrderBy(x => x.roosterdatum) .ThenBy(x => x.starttijd) .GroupBy(x => x.roosterdatum) .ToArray(); foreach (var day in completeSchedule) { var date = day.Key.ToString("dddd dd MMMM", CultureInfo.CurrentCulture); lvSchedule.Items.Add(date); foreach (var lesson in day) { lvSchedule.Items.Add(lesson); } } }