public void addLunchtable(Lunchtable lunchtable) { this.RunOnUiThread(() => horiPager.RemoveAllViews()); if (lunchtable.NoMenuesFound || lunchtable.LunchDays.Count < 1) { View dishDay = this.LayoutInflater.Inflate(Resource.Layout.DishDay, null); var dayTitle = dishDay.FindViewById <TextView>(Resource.Id.day_text); dayTitle.Text = "Keine Menüeinträge!"; this.RunOnUiThread(() => horiPager.AddView(dishDay)); return; } int day_value = (int)System.DateTime.Today.DayOfWeek - 1; if (day_value > 5 || day_value < 0) { day_value = 0; } foreach (LunchDay day in lunchtable.LunchDays) { this.RunOnUiThread(() => horiPager.AddView(new LunchDayView(day).GetView(this, day_value))); } this.RunOnUiThread(() => horiPager.SetCurrentScreen(day_value, false)); System.Console.WriteLine(lunchtable.LastUpdated); }
private void displayTimetable(Timetable timetable) { this.RunOnUiThread(() => horiPager.RemoveAllViews()); if (timetable != null && timetable.TimetableDays.Count > 0) { int i = 0; int day_value = (int)System.DateTime.Today.DayOfWeek; if (day_value == 0) { day_value = 7; } foreach (TimetableDay day in timetable.TimetableDays) { this.RunOnUiThread(() => horiPager.AddView(new TimetableDayView(day, i > 0, i < timetable.TimetableDays.Count - 1).GetView(this))); i++; } this.RunOnUiThread(() => horiPager.SetCurrentScreen(day_value, false)); } else { TextView test = new TextView(this); if (timetable.ErrorMessage != null) { test.Text = timetable.ErrorMessage; } else { test.Text = "Keine Daten gefunden"; } this.RunOnUiThread(() => horiPager.AddView(test)); } }