Select to view content in your preferred language

ArcGIS Pro 2.3 SDK Issue

424
0
02-15-2019 09:18 AM
MichaelStranovsky
Regular Contributor

Since switching to ArcGIS Pro 2.3 my addin is giving me trouble.   Calls to asynchronous task are not waiting to complete before the next task starts.  Here is a snippet:

private async void btnGo_Click(object sender, RoutedEventArgs e)
{
await ImportTemplate();
}

private async Task ImportTemplate()
{
lblProgress.Content = "Importing template...";
string mxd = @"N:\Support\ArcGIS\Tools\MailingList\MailingLabelsRequest_TemplatePro.mxd";
Item mxdItem = ItemFactory.Instance.Create(mxd, ItemFactory.ItemType.PathItem);
await QueuedTask.Run(() =>
{
MapFactory.Instance.CreateMapFromItem(mxdItem);
});
lblProgress.Content = "Rename Layout...";
m_wsName = txtProjectName.Text.Replace(" ", "");
mapName = String.Concat(m_wsName, "_", SizeUnits);
await QueuedTask.Run(() =>
{
LayoutView.Active.Layout.SetName(mapName);
}
}

the second QueuedTask starts before the first one completes and it dependent on the first one to complete.

0 Replies