public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) { switch (editingStyle) { case UITableViewCellEditingStyle.Delete: var box = Boxes[indexPath.Row]; Boxes.Remove(box); tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade); var items = itemDAO.getAllItemInBox(box.Id); foreach (var i in items) { i.Container = 0; itemDAO.updateItem(i); } boxDAO.deleteBox(box); break; case UITableViewCellEditingStyle.None: break; default: break; } }
// Removes this box from the body and broadphase. Forces the body // to recompute its mass if the body is dynamic. Frees the memory // pointed to by the box pointer. public void RemoveBox(Box box) { Assert(box != null); Assert(box.body == this); bool found = Boxes.Remove(box); // This shape was not connected to this body. Assert(found); // Remove all contacts associated with this shape foreach (var edge in ContactList) { ContactConstraint contact = edge.constraint; Box A = contact.A; Box B = contact.B; if (box == A || box == B) { Scene.ContactManager.RemoveContact(contact); } } Scene.ContactManager.Broadphase.RemoveBox(box); CalculateMassData(); // Scene.Heap.Free((void)box); }
public void MergeSelectedBoxes(IEnumerable <TessBoxControl> selectedBoxes) { var bounds = Rect.Empty; var remove = new List <TessBoxControl>(); foreach (var box in selectedBoxes) { var boxBounds = new Rect(box.Left, box.Top, box.Width, box.Height); if (bounds.IsEmpty) { bounds = boxBounds; } else { bounds.Union(boxBounds); } remove.Add(box); } var keep = remove[remove.Count - 1]; remove.RemoveAt(remove.Count - 1); foreach (var box in remove) { Boxes.Remove(box); } keep.Left = bounds.Left; keep.Top = bounds.Top; keep.Width = bounds.Width; keep.Height = bounds.Height; }
public void DeleteSelectedBoxes(IEnumerable <TessBoxControl> selectedBoxes) { var remove = new List <TessBoxControl>(selectedBoxes); foreach (var box in remove) { Boxes.Remove(box); } }
public void Delete(Entity entity) { if (entity is Box && Boxes.Contains((Box)entity)) { Boxes.Remove((Box)entity); } if (entity is Polyline && Polylines.Contains((Polyline)entity)) { Polylines.Remove((Polyline)entity); } if (entity is InsertedImage && InsertedImages.Contains((InsertedImage)entity)) { InsertedImages.Remove((InsertedImage)entity); } if (entity is Circle && Circles.Contains((Circle)entity)) { Circles.Remove((Circle)entity); } }