private static void AddLayerToMap(string tableName, string layerName) { try { lock (Jarvis.FeatureClassLockerObject) { var featureWorkspace = (IFeatureWorkspace)Jarvis.OpenWorkspace(Settings.Default.geoDatabase); var featureClass = featureWorkspace.OpenFeatureClass(tableName); ILayer featureLayer; featureLayer = VectorIndexHelper.CreateFeatureLayer(featureClass, layerName); VectorIndexHelper.AddFeatureLayerToMap(featureLayer); } } catch (Exception error) { Jarvis.Logger.Error(error); } }
private static bool AddLayerToMap(string tableName, string layerName) { var success = false; try { lock (locker) { var featureWorkspace = (IFeatureWorkspace)Jarvis.OpenWorkspace(Settings.Default.geoDatabase); var featureClass = featureWorkspace.OpenFeatureClass(tableName); ILayer featureLayer; featureLayer = VectorIndexHelper.CreateFeatureLayer(featureClass, layerName); VectorIndexHelper.AddFeatureLayerToMap(featureLayer); success = true; } } catch (Exception error) { Jarvis.Logger.Error(error); success = false; } return(success); }