void OnElementDeleted(object sender, ElementEventArgs args) { AircraftElement deleted = args.Element as AircraftElement; NSIndexPath path = deleted.IndexPath; if (LogBook.Delete(deleted.Aircraft)) { deleted.Changed -= OnElementChanged; Root[0].Remove(path.Row); SelectOrAdd(path.Row); } }
void LoadAircraft() { Section section = new Section(); AircraftElement element; foreach (var aircraft in LogBook.GetAllAircraft()) { element = new AircraftElement(aircraft); element.Changed += OnElementChanged; section.Add(element); } Root.Add(section); LogBook.AircraftAdded += OnAircraftAdded; }
void OnAircraftAdded(object sender, AircraftEventArgs added) { AircraftElement element = new AircraftElement(added.Aircraft); element.Changed += OnElementChanged; // Disengage search before adding to the list FinishSearch(); Root[0].Add(element); Root.Reload(Root[0], UITableViewRowAnimation.Fade); // Select the aircraft we just added NSIndexPath path = element.IndexPath; SelectRow(path, true, UITableViewScrollPosition.Bottom); }
void OnElementChanged(object sender, EventArgs args) { AircraftElement element = (AircraftElement)sender; Root.Reload(element, UITableViewRowAnimation.None); }
bool CanDeleteAircraftElement(Element element) { AircraftElement aircraft = element as AircraftElement; return(aircraft != null && LogBook.CanDelete(aircraft.Aircraft)); }
void OnAircraftAdded(object sender, AircraftEventArgs added) { AircraftElement element = new AircraftElement (added.Aircraft); element.Changed += OnElementChanged; // Disengage search before adding to the list FinishSearch (); Root[0].Add (element); Root.Reload (Root[0], UITableViewRowAnimation.Fade); // Select the aircraft we just added NSIndexPath path = element.IndexPath; SelectRow (path, true, UITableViewScrollPosition.Bottom); }
void LoadAircraft() { Section section = new Section (); AircraftElement element; foreach (var aircraft in LogBook.GetAllAircraft ()) { element = new AircraftElement (aircraft); element.Changed += OnElementChanged; section.Add (element); } Root.Add (section); LogBook.AircraftAdded += OnAircraftAdded; }