Hi, looking at the samples I have the following code which works great. However the moment I run
gpResult = await Geoprocessing.ExecuteToolAsync("ChangeVersion_management", parameters) before or after the initialization of ProgressDialog, the message doesn't get updated.
//Run the line below and ProgressDialog no longer works.
gpResult = await Geoprocessing.ExecuteToolAsync("ChangeVersion_management", parameters);
uint maxSteps = 10;
var pd = new ArcGIS.Desktop.Framework.Threading.Tasks.ProgressDialog("Running SPU", maxSteps, false);
ProgressorSource cps = new ProgressorSource(pd);
cps.Progressor.Max = (uint)maxSteps;
await QueuedTask.Run(() => {
//check every second
for (int i = 0; i < 10; i++)
{
cps.Progressor.Value += 1;
cps.Progressor.Status = (cps.Progressor.Value * 100 / cps.Progressor.Max) + @" % Completed";
cps.Progressor.Message = "Message " + cps.Progressor.Value;
if (System.Diagnostics.Debugger.IsAttached)
{
System.Diagnostics.Debug.WriteLine(string.Format("RunCancelableProgress Loop{0}", cps.Progressor.Value));
}
//block the CIM for a second
Task.Delay(1000).Wait();
//are we done?
if (cps.Progressor.Value == cps.Progressor.Max) break;
}
}, cps.Progressor);
Note, i am NOT after having the dialog or cancellation progress dialog running with the GP. I just need to run the GP and then after the GP have completed, show the progress dialog for some other tasks.
Thank you in advance.
Solved! Go to Solution.
Hi Victor,
I used Pro 2.5 and I attached my zip'ed sample project. If you change the desktop version attribute in config.daml you should be able to build the add-in for 2.4, 2.3 as well.
I replaced your "Geoprocessing.ExecuteToolAsync" line with the following code snippet and had no problems with the progress dialog. It showed and progressed as expected.
I would recommend to run the sample without starting Pro from the debugger - the progress dialog is not guarantied to display properly on the UI when in debug mode.
List<object> arguments = new List<object>
{
// store the results in the default geodatabase
CoreModule.CurrentProject.DefaultGeodatabasePath,
// name of the feature class
"TestPnt",
// type of geometry
"POINT",
// no template
"",
// no z values
"DISABLED",
// no m values
"DISABLED"
};
await QueuedTask.Run(() =>
{
// spatial reference
arguments.Add(SpatialReferenceBuilder.CreateSpatialReference(3857));
});
IGPResult result = await Geoprocessing.ExecuteToolAsync("CreateFeatureclass_management", Geoprocessing.MakeValueArray(arguments.ToArray()));
Hi Wolfgang Kaiser, I tested your code and I ran into the same issue.
Can I check what version of Pro and SDK are you using?
Hello!
Can you tell me if it is possible to run QUICK IMPORT (Data Interoperability) in the same way?
I took this solution as a basis, I could not find information on how to register the parameters for the launch.
Thank you for your help Wolfgang Kaiser i will try upgrading my pro to see if that fixes it.