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)); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); var display = WindowManager.DefaultDisplay; horiPager = new HorizontalPager(this.ApplicationContext, display); SetContentView(horiPager); TextView test = new TextView(this); test.Text = "Laden..."; horiPager.AddView(test); var _loadedLuchtable = ApplicationSettings.Instance.Persistency.Load <Lunchtable>(); if (_loadedLuchtable != null && _loadedLuchtable.LunchDays.Count > 0) { var cal = CultureInfo.CurrentCulture.Calendar; int db = cal.GetWeekOfYear(_loadedLuchtable.LastUpdated, DateTimeFormatInfo.CurrentInfo.CalendarWeekRule, DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek); int act = cal.GetWeekOfYear(System.DateTime.Today, DateTimeFormatInfo.CurrentInfo.CalendarWeekRule, DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek); if (act <= db) { addLunchtable(_loadedLuchtable); DomainLibraryHelper.GetUserBadgeInformation(ApplicationSettings.Instance.UserCredentials, badgeInfoCallback); return; } } DomainLibraryHelper.GetLunchtable(lunchtableCallback); DomainLibraryHelper.GetUserBadgeInformation(ApplicationSettings.Instance.UserCredentials, badgeInfoCallback); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); var display = WindowManager.DefaultDisplay; horiPager = new HorizontalPager(this.ApplicationContext, display); TextView test = new TextView(this); test.Text = "Laden..."; horiPager.AddView(test); SetContentView(horiPager); var _loadedTimetable = ApplicationSettings.Instance.Persistency.Load <Timetable>(new Timetable() { Username = ApplicationSettings.Instance.UserCredentials.Name }); if (_loadedTimetable != null && _loadedTimetable.TimetableDays.Count > 0) { displayTimetable(_loadedTimetable); } else { DomainLibraryHelper.GetUserTimetable(ApplicationSettings.Instance.UserCredentials, TimetableCallback); } }