private void PersistentObjectChanged(PersistentObject obj) { if (IsViewLoaded) { if (obj.GetType() == typeof(UserCredentials)) { if (_ownTimetable == null) { _ownTimetable = new StyledStringElement(ApplicationSettings.Instance.UserCredentials.Name, OnOwnTapped){ Accessory = MonoTouch.UIKit.UITableViewCellAccessory.DisclosureIndicator }; Root.Add(new Section("Eigener Stundenplan"){_ownTimetable}); } else { _ownTimetable.Caption = ApplicationSettings.Instance.UserCredentials.Name; } } else if (obj.GetType() == typeof(UserTimetableList)) { if (_otherTimetables == null) { _otherTimetables = new Section("Andere Stundenpläne"); Root.Add(_otherTimetables); } if (!obj.Equals(_loadedList)) { _otherTimetables.Clear(); foreach (var o in ApplicationSettings.Instance.UserTimetablelist.Usernames) { var tmp = o; _otherTimetables.Add(new StyledStringElement(o, () => { OnTapped(tmp); }){ Accessory = MonoTouch.UIKit.UITableViewCellAccessory.DisclosureIndicator }); } _loadedList = new UserTimetableList(){ Usernames = new ObservableCollection<string>((obj as UserTimetableList).Usernames) }; } } this.ReloadData(); } }
private void SavePersistentObject(PersistentObject obj) { (obj as UserTimetableList).Usernames.ToList().ForEach(x => Console.WriteLine(x.ToString())); ApplicationSettings.Instance.Persistency.Save(obj); }