private void Buttons_EditClicked(object sender, EventArgs e) { try { if (Grid.BusinessObjectCollection == null) { throw new GridDeveloperException("You cannot call edit since the grid has not been set up"); } IBusinessObject selectedBo = SelectedBusinessObject; if (selectedBo != null) { if (BusinessObjectEditor != null) { //This cannot be generalised for Win an Web due to the fact that you cannot // have a true Modal dialogue in VWG see VWG website for more details. BusinessObjectEditor.EditObject(selectedBo, UiDefName, delegate { _grid.RefreshBusinessObjectRow( selectedBo); _grid.Update(); _grid.SelectedBusinessObject = selectedBo; }); } } } catch (Exception ex) { GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error trying to edit an item"); } }
private void Buttons_AddClicked(object sender, EventArgs e) { try { if (Grid.BusinessObjectCollection == null) { throw new GridDeveloperException("You cannot call add since the grid has not been set up"); } if (BusinessObjectCreator == null) { throw new GridDeveloperException( "You cannot call add as there is no business object creator set up for the grid"); } _grid.SelectedBusinessObject = null; var newBo = BusinessObjectCreator.CreateBusinessObject(); if (BusinessObjectEditor != null && newBo != null) { //This cannot be generalised for Win an Web due to the fact that you cannot // have a true Modal dialogue in VWG see VWG website for more details. BusinessObjectEditor.EditObject(newBo, UiDefName, delegate(IBusinessObject bo, bool cancelled) { IBusinessObjectCollection collection = this.Grid.BusinessObjectCollection; if (cancelled) { collection.Remove(bo); } else { if (!collection.Contains(bo)) { collection.Add(bo); } _grid.RefreshBusinessObjectRow(bo); _grid.Update(); Grid.SelectedBusinessObject = bo; } }); } } catch (Exception ex) { GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error trying to add an item"); } }
private void Buttons_AddClicked(object sender, EventArgs e) { try { if (Grid.BusinessObjectCollection == null) { throw new GridDeveloperException("You cannot call add since the grid has not been set up"); } if (BusinessObjectCreator == null) { throw new GridDeveloperException( "You cannot call add as there is no business object creator set up for the grid"); } IBusinessObject newBo = BusinessObjectCreator.CreateBusinessObject(); if (BusinessObjectEditor != null && newBo != null) { BusinessObjectEditor.EditObject(newBo, UiDefName, delegate(IBusinessObject bo, bool cancelled) { IBusinessObjectCollection collection = this.Grid.BusinessObjectCollection; if (cancelled) { collection.Remove(bo); } else { if (!collection.Contains(bo)) { collection.Add(bo); } Grid.SelectedBusinessObject = bo; } }); } } catch (Exception ex) { GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error trying to add an item"); } }
private void Buttons_EditClicked(object sender, EventArgs e) { try { if (Grid.BusinessObjectCollection == null) { throw new GridDeveloperException("You cannot call edit since the grid has not been set up"); } IBusinessObject selectedBo = SelectedBusinessObject; if (selectedBo != null) { if (BusinessObjectEditor != null) { BusinessObjectEditor.EditObject(selectedBo, UiDefName, null); } } } catch (Exception ex) { GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error trying to edit an item"); } }