public override void ViewDidLoad() { base.ViewDidLoad(); try { collection = SqlClass.GetBrandCollection(); } catch { //(SqlClass.GetError("Не удалось подключиться к БД")).RunModal(); } BrandSource sou = new BrandSource(collection); BrandTable.DataSource = sou; BrandTable.Delegate = new BrandDelegate(sou); DeleteButton.Activated += (sender, e) => { if (BrandTable.SelectedRow != -1) { SqlClass.DeleteBrand(collection[(int)BrandTable.SelectedRow]); collection.RemoveAt((int)BrandTable.SelectedRow); BrandTable.ReloadData(); } }; }
void ReleaseDesignerOutlets() { if (BrandTable != null) { BrandTable.Dispose(); BrandTable = null; } if (DeleteButton != null) { DeleteButton.Dispose(); DeleteButton = null; } }
public override void PrepareForSegue(NSStoryboardSegue segue, NSObject sender) { base.PrepareForSegue(segue, sender); var a = segue.DestinationController as EditViewOrder; a.added += (sender1, e) => { try { SqlClass.AddBrand(a.item); collection.Add(a.item); BrandTable.ReloadData(); } catch { (SqlClass.GetError("Не удалось добавить поле")).RunModal(); } }; }