protected override Task<bool> OnSketchCompleteAsync(Geometry geometry) { QueuedTask.Run(() => { var deleteFeatures = new EditOperation(); deleteFeatures.Name = "Delete Features"; Polygon polygon = geometry as Polygon; //Delete all the selected features in the active view //Select using a polygon (for example) var selection = MapView.Active.SelectFeatures(polygon).Select( k => new KeyValuePair<MapMember, List<long>>(k.Key as MapMember, k.Value)); deleteFeatures.Delete(selection); //Execute to execute the operation //Must be called within QueuedTask.Run deleteFeatures.Execute(); }); return base.OnSketchCompleteAsync(geometry); }
protected override Task<bool> OnSketchCompleteAsync(Geometry geometry) { QueuedTask.Run(() => { //Delete all the selected features in the active view //Select using a polygon (for example) var selection = MapView.Active.SelectFeatures(geometry).Select( k => new KeyValuePair<MapMember, List<long>>(k.Key as MapMember, k.Value)); foreach (var a in selection) { Layer featureLayer = a.Key as Layer; foreach (var id in a.Value) { var deleteFeatures = new EditOperation(); deleteFeatures.Name = "Delete Features"; deleteFeatures.ShowProgressor = true; deleteFeatures.EditOperationType = EditOperationType.Long; deleteFeatures.Clip(featureLayer, id, geometry); deleteFeatures.ExecuteAsync(); } } //deleteFeatures.Delete(selection); //Execute to execute the operation //Must be called within QueuedTask.Run }); return base.OnSketchCompleteAsync(geometry); }