Arreglos importacion. FeatureClassToFeatureClass_conversion
parent
52f5993ce1
commit
43f2592915
|
|
@ -24,6 +24,7 @@ using OliviaAddInPro.View;
|
||||||
using OliviaAddInPro.Model.contract;
|
using OliviaAddInPro.Model.contract;
|
||||||
using ArcGIS.Core.Data.DDL;
|
using ArcGIS.Core.Data.DDL;
|
||||||
using ArcGIS.Core.CIM;
|
using ArcGIS.Core.CIM;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace OliviaAddInPro.Helper
|
namespace OliviaAddInPro.Helper
|
||||||
{
|
{
|
||||||
|
|
@ -1741,7 +1742,8 @@ namespace OliviaAddInPro.Helper
|
||||||
ArcGIS.Core.Geometry.SpatialReference spatref = GetSpatRef(nom_shp);
|
ArcGIS.Core.Geometry.SpatialReference spatref = GetSpatRef(nom_shp);
|
||||||
var environments = Geoprocessing.MakeEnvironmentArray(outputCoordinateSystem: spatref);
|
var environments = Geoprocessing.MakeEnvironmentArray(outputCoordinateSystem: spatref);
|
||||||
CancelableProgressorSource cps = new CancelableProgressorSource();
|
CancelableProgressorSource cps = new CancelableProgressorSource();
|
||||||
IGPResult gpResult = Geoprocessing.ExecuteToolAsync("FeatureClassToFeatureClass_conversion", Geoprocessing.MakeValueArray(args), environments,cps.CancellationTokenSource.Token,
|
var completa = false;
|
||||||
|
var gpres = Geoprocessing.ExecuteToolAsync("FeatureClassToFeatureClass_conversion", args, environments,cps.CancellationTokenSource.Token,
|
||||||
(event_name, o) => // implement delegate and handle events
|
(event_name, o) => // implement delegate and handle events
|
||||||
{
|
{
|
||||||
switch (event_name)
|
switch (event_name)
|
||||||
|
|
@ -1765,6 +1767,7 @@ namespace OliviaAddInPro.Helper
|
||||||
var av = (int)o;
|
var av = (int)o;
|
||||||
if ((int)o < 0)
|
if ((int)o < 0)
|
||||||
{
|
{
|
||||||
|
completa = true;
|
||||||
//System.Windows.MessageBox.Show(msg2);
|
//System.Windows.MessageBox.Show(msg2);
|
||||||
//cps.CancellationTokenSource.Cancel();
|
//cps.CancellationTokenSource.Cancel();
|
||||||
|
|
||||||
|
|
@ -1772,13 +1775,18 @@ namespace OliviaAddInPro.Helper
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).Result;
|
});
|
||||||
if (gpResult.IsCanceled)
|
|
||||||
|
while (!gpres.IsCompleted && gpres.IsCanceled && gpres.IsFaulted && !completa)
|
||||||
|
Thread.Sleep(10);
|
||||||
|
|
||||||
|
if (gpres.IsCanceled)
|
||||||
{
|
{
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (gpResult.IsFailed)
|
if (gpres.IsFaulted)
|
||||||
{
|
{
|
||||||
|
var gpResult = gpres.Result;
|
||||||
string msg;
|
string msg;
|
||||||
if (gpResult.ErrorMessages != null)
|
if (gpResult.ErrorMessages != null)
|
||||||
msg = gpResult.ErrorMessages.First().Text;
|
msg = gpResult.ErrorMessages.First().Text;
|
||||||
|
|
@ -1787,6 +1795,15 @@ namespace OliviaAddInPro.Helper
|
||||||
res.Error.Add("Error: " + msg);
|
res.Error.Add("Error: " + msg);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
gpres.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
string msg = "";
|
||||||
|
msg = e.Message;
|
||||||
|
}
|
||||||
res.Value = true;
|
res.Value = true;
|
||||||
//actualiza la gdb
|
//actualiza la gdb
|
||||||
Refresh(System.IO.Path.GetDirectoryName(Gdb_dataset));
|
Refresh(System.IO.Path.GetDirectoryName(Gdb_dataset));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue