private void LoadLunchtable(Lunchtable lunchtable) { UIApplication.SharedApplication.InvokeOnMainThread(() => { _pageScrollController.Clear(); if (lunchtable.HasError) { _pageScrollController.AddPage(new DefaultDialogViewController(new RootElement("Error") { new Section("Error") { new MultilineElement(lunchtable.ErrorMessage) } })); } else { foreach (LunchDay lunchDay in lunchtable.LunchDays) { _pageScrollController.AddPage(CreateView(lunchDay)); } try { _pageScrollController.ScrollToPage((int)DateTime.Now.DayOfWeek - 1); } catch (Exception) { } } }); _loadedTimetable = lunchtable; }
public override void ViewDidLoad() { base.ViewDidLoad(); _pageScrollController = new PageScrollController<DefaultDialogViewController>(ScrollView, PageController); _pageScrollController.OnPageChange += PageChanged; if (ApplicationSettings.Instance.Persistency.Exists(new Timetable(){Username = _userName})) LoadTimetable(ApplicationSettings.Instance.Persistency.Load(new Timetable(){Username = _userName})); else _pageScrollController.AddPage(GetNoDataScreen()); View.BackgroundColor = ApplicationColors.DEFAULT_BACKGROUND; }
public override void ViewDidLoad() { base.ViewDidLoad(); _pageScrollController = new PageScrollController <DefaultDialogViewController>(ScrollView, PageController); _pageScrollController.OnPageChange += PageChanged; if (ApplicationSettings.Instance.Persistency.Exists(new Timetable() { Username = _userName })) { LoadTimetable(ApplicationSettings.Instance.Persistency.Load(new Timetable() { Username = _userName })); } else { _pageScrollController.AddPage(GetNoDataScreen()); } View.BackgroundColor = ApplicationColors.DEFAULT_BACKGROUND; }
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; }