public void SetTableSource(IFeatureSet fs, int layerHandle, bool ogr) { if (fs == null) { RowCount = 0; return; } _layerHandle = layerHandle; _shapefile = fs; _table = fs.Table; _ogr = ogr; InitColumns(_table); RowManager.Reset(_shapefile); RowCount = 0; // this will clear all rows at once or else it will try to remove them one by one (veeeery slow) RowCount = _table.NumRows; bool editing = _shapefile.CanEditTable(); ReadOnly = !editing; }
private bool RequestEditSession(TableEditorCommand command) { switch (command) { case TableEditorCommand.CalculateField: case TableEditorCommand.AddField: case TableEditorCommand.RemoveField: case TableEditorCommand.ImportFieldDefinitions: case TableEditorCommand.UpdateMeasurements: case TableEditorCommand.Replace: case TableEditorCommand.RemoveFields: case TableEditorCommand.RecalculateFields: { if (FeatureSet.CanEditTable()) { return(true); } if (!CanStartEditingDirectly()) { return(false); } string msg = "The requested operation needs to change data." + Environment.NewLine; msg += "Do you want to start edit session?"; if (MessageService.Current.Ask(msg)) { return(StartEditing()); } return(false); } } return(true); }