Using Open/SaveItemDialog from within QueuedTask.Run

222
2
05-02-2019 03:24 AM
AdamDavis
Occasional Contributor

Hi,

In a very large code base that has no need for async as every action needs to be run synchronously we have been successful in finessing away async by calling our functionality from within a single QueuedTask.Run. That generally works very well. However if we try and use the Open/SaveItemDialog then we get some issues.

Is there any way of making these calls work in the current version and if not would it be possible for Esri to update these calls to function from within a QueuedTask.Run in a future version.

OpenItemDialog works in that the dialog is shown and an item can be picked.

SaveItemDialog does not work as the Save button does not close the dialog.

Both dialogs do not show the initial location.

Steps to reproduce.

protected override void OnClick()

{

QueuedTask.Run(

() =>

{

Application.Current.Dispatcher.Invoke(() => { new SaveItemDialog().ShowDialog(); });

});

}

Thanks,

Adam

0 Kudos
2 Replies
UmaHarano
Esri Regular Contributor

Hi Adam,

The initial location issue is a known defect that I can confirm. The development team for this has been notified.  

I tried your exact code in the 2.4 version of Pro - I am not able to reproduce this issue. The Save item dialog closes for me.

Thanks

Uma

0 Kudos
AdamDavis
Occasional Contributor

Hi Uma,

Thanks so much - that's great news that Save works in 2.4 which should not be long now for the beta version to be available?

I have a similar problem with using the Coordinate System Dialog from the Snippets collection.

If I run it without QueuedTask.Run it works fine but if it is in a QueuedTask then the indexing of the coordinate systems never completes and the wait cursor on the Geographic and Projected Systems just goes round forever.

Steps to reproduce

protected override void OnClick()

{

QueuedTask.Run(

() =>

{

Application.Current.Dispatcher.Invoke(() => { new CoordSysDialog().ShowDialog(); });

});

}

Thanks,

Adam

0 Kudos