From 1abf90fe19252b83f527c363e7421425bf091ba6 Mon Sep 17 00:00:00 2001 From: Elena Date: Tue, 23 Feb 2021 21:44:11 +0100 Subject: [PATCH] =?UTF-8?q?M=C3=A1s=20pruebas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProWindow1.xaml.cs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/ProWindow1.xaml.cs b/ProWindow1.xaml.cs index 2569267..e423d31 100644 --- a/ProWindow1.xaml.cs +++ b/ProWindow1.xaml.cs @@ -40,14 +40,17 @@ namespace PruebaAddIn string layerpath, outpath; layerpath = "D:\\Proyectos\\Olivia\\Datos\\gdbs\\Soria.gdb\\prueba"; outpath = "D:\\Proyectos\\Olivia\\Pruebas"; - ConvertShp(layerpath, outpath); + //layerpath = @"Z:\Europe.gdb\Streets"; + //layerpath = @"C:\Users\narvaling_epareja\Documents\ArcGIS\Projects\MyProject\MyProject.gdb\SanLorenzo"; + //outpath = @"C:\Users\narvaling_epareja\Documents\PruebasOlivia"; + ConvertShp(layerpath, outpath); } protected async Task ConvertShp(string layerpath, string outpath) { - /*if (!System.IO.Directory.Exists(outpath)) + if (!System.IO.Directory.Exists(outpath)) System.IO.Directory.CreateDirectory(outpath); - var valueArray = await QueuedTask.Run(() => + /*var valueArray = await QueuedTask.Run(() => { //input layers list should contain the path of each layer name, i.e. if the root node is "Mapping" and the layer name is "gs_points", path is "Mapping\\gs_points". List inlayers = new List(); @@ -59,14 +62,14 @@ namespace PruebaAddIn using (Geodatabase fileGeodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri("D:\\Proyectos\\Olivia\\Datos\\gdbs\\Soria.gdb")))) using (FeatureClass featureClass = fileGeodatabase.OpenDataset("prueba")) { - FeatureClassDefinition facilitySiteDefinition = featureClass.GetDefinition(); - int facilityIdIndex = facilitySiteDefinition.FindField("TIPO_ENT"); + //FeatureClassDefinition facilitySiteDefinition = featureClass.GetDefinition(); + //int facilityIdIndex = facilitySiteDefinition.FindField("TIPO_ENT"); string whereClause = "NOM_TIPO_ENTIDAD = 'Aceras'"; Selection sel = featureClass.Select(new QueryFilter { WhereClause = whereClause }, SelectionType.ObjectID, SelectionOption.Normal); } - var progDlg = new ProgressDialog("Running Geoprocessing Tool", "Cancel", 100, true); + var progDlg = new ProgressDialog("Running Geoprocessing Tool", "Cancel", 100, true); progDlg.Show(); var progSrc = new CancelableProgressorSource(progDlg); @@ -84,7 +87,7 @@ namespace PruebaAddIn null, new CancelableProgressorSource(progDlg).Progressor, GPExecuteToolFlags.Default); // dialog hides itself once the execution is complete - progDlg.Hide(); + //progDlg.Hide(); /*//input layers list should contain the path of each layer name, i.e. if the root node is "Mapping" and the layer name is "gs_points", path is "Mapping\\gs_points". @@ -98,10 +101,12 @@ namespace PruebaAddIn // GPExecuteToolFlags flags = GPExecuteToolFlags.GPThread; // instruct the tool run non-blocking GPThread IGPResult gpResult = await Geoprocessing.ExecuteToolAsync("FeatureClassToShapefile_conversion", valueArray, null, null, null, flags);*/ - - return string.IsNullOrEmpty(gpResult.ReturnValue) + string res = string.IsNullOrEmpty(gpResult.ReturnValue) ? $@"Error in gp tool: {gpResult.ErrorMessages}" : $@"Ok: {gpResult.ReturnValue}"; + + + return res; } } }