partial void addButtonPressed(UIButton sender) { var tabBarItems = TabBarController.TabBar.Items; if (obj.allDistanceNotZero()) { switch (SegmentChoiceTypeObject.SelectedSegment) { case 0: Item item = new Item(obj); ItemDAO itemDAO = new ItemDAO(); itemDAO.insertItem(item); addBadgeTabBarItem(tabBarItems, 1); break; case 1: Box box = new Box(obj); BoxDAO boxDAO = new BoxDAO(); boxDAO.insertBox(box); addBadgeTabBarItem(tabBarItems, 2); break; default: break; } } else { alert("Non è possibile aggiungere l'oggetto", "Una delle dimensioni è uguale a 0"); } }
public UIContextualAction duplicateAction(int row) { var action = UIContextualAction.FromContextualActionStyle( UIContextualActionStyle.Normal, "Duplica", (insertAction, view, success) => { var source = Source as BoxViewController; var boxSelected = source.Boxes[row]; var tmp = new Box(new MyObject(boxSelected.Name, boxSelected.Height, boxSelected.Width, boxSelected.Depth, boxSelected.Description)); boxDAO.insertBox(tmp); source.reloadData(); success(true); }); action.BackgroundColor = UIColor.Blue; return(action); }