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); } }
public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) { if (editingStyle != UITableViewCellEditingStyle.Delete) { return; } Aircraft aircraft = GetItem(tableView, indexPath); if (!LogBook.Delete(aircraft)) { return; } OnAircraftDeleted(tableView, indexPath); }
void OnElementDeleted(object sender, ElementEventArgs args) { FlightElement deleted = args.Element as FlightElement; NSIndexPath path = deleted.IndexPath; int n = GetElementOffsetFromPath(path); if (LogBook.Delete(deleted.Flight)) { deleted.Changed -= OnFlightElementChanged; Root[path.Section].Remove(path.Row); if (Root[path.Section].Count == 0) { Root.RemoveAt(path.Section, UITableViewRowAnimation.Fade); } SelectOrAdd(n); } }