private void LoadTimetable(Timetable timetable)
        {
            UIApplication.SharedApplication.InvokeOnMainThread(() =>
            {
                _pageScrollController.Clear();
                if (timetable.BlockedTimetable)
                {
                    var root = new RootElement("Blockiert"){
                        new Section("Blockiert"){
                            new MultilineElement("Benutzer hat Stundenplan\nblockiert")
                        }
                    };
                    var dvc = new DefaultDialogViewController(root, UITableViewStyle.Plain, RefreshRequested);
                    dvc.CustomLastUpdate = timetable.LastUpdated;
                    _pageScrollController.AddPage(dvc);
                }
                else if (timetable.HasError)
                {
                    var root = new RootElement("Error"){
                        new Section("Error"){
                            new MultilineElement(timetable.ErrorMessage)
                        }
                    };
                    var dvc = new DefaultDialogViewController(root, UITableViewStyle.Plain, RefreshRequested);
                    dvc.CustomLastUpdate = timetable.LastUpdated;
                    _pageScrollController.AddPage(dvc);
                }
                else
                {
                    foreach (var day in timetable.TimetableDays)
                    {
                        if (day.Lessions.Count() == 0)
                            continue;
                        var root = new RootElement((string.IsNullOrEmpty(day.Weekday) ? "Ohne Wochentag" : day.Weekday));
                        foreach (var lession in day.Lessions)
                        {
                            var section = new Section(lession.Name + " " + lession.Type);
                            foreach (var alloc in lession.CourseAllocations)
                            {
                                string t = alloc.Timeslot;
                                if (alloc.RoomAllocations.Count() > 0)
                                    t += "\n" + alloc.RoomAllocations.FirstOrDefault().Roomnumber;
                                var tmpLession = new Lession(){CourseAllocations=lession.CourseAllocations,
                                                               Lecturers=lession.Lecturers,
                                                               Name=lession.Name,
                                                               Type=lession.Type};
                                section.Add(new MultilineElement(t, () => {

                                    OnElementTappet(tmpLession);}){Value=lession.LecturersShortVersion});
                            }
                            root.Add(section);
                        }
                        var dvc = new DefaultDialogViewController(root, UITableViewStyle.Plain, RefreshRequested);
                        dvc.CustomLastUpdate = timetable.LastUpdated;
                        _pageScrollController.AddPage(dvc);
                    }
                }
            });
            _loadedTimetable = timetable;
        }
 private void OnElementTappet(Lession lession)
 {
     var root = new RootElement(lession.Name);
     var allocations = new Section("Termine");
     foreach (CourseAllocation alloc in lession.CourseAllocations)
     {
         string t = alloc.Timeslot;
         if (!string.IsNullOrEmpty(alloc.Type))
             t += "\n" + alloc.Type;
         if (!string.IsNullOrEmpty(alloc.Description))
             t += "\n" + alloc.Description;
         allocations.Add(new MultilineElement(t, (alloc.RoomAllocations.Count() > 0 ? alloc.RoomAllocations.FirstOrDefault().Roomnumber : string.Empty)));
     }
     root.Add(allocations);
     var lecturers = new Section("Betreuer");
     foreach (Lecturer l in lession.Lecturers)
     {
         lecturers.Add(new StringElement(l.Fullname, l.Shortname));
     }
     root.Add(lecturers);
     NavigationController.PushViewController(new DefaultDialogViewController(root), true);
 }