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;
        }
 public TimetablesDatasource(DefaultDialogViewController dvc)
     : base(dvc)
 {
 }
Beispiel #3
0
 public TimetablesDatasource(DefaultDialogViewController dvc) : base(dvc)
 {
 }
Beispiel #4
0
 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;
 }