Select to view content in your preferred language

SaveItemDialog spins forever

924
2
Jump to solution
05-07-2020 04:21 PM
AbelPerez
Frequent Contributor

In my add-in I allow the user to select where their output feature class will be saved. When I put my code inside the suggested QueuedTask.Run and FrameworkApplication.Current.Dispatcher.Invoke it will just sit there and spin. If I take the code outside of this then it works fine. What is the proper way to use SaveItemDialog?

QueuedTask.Run(
Sub()
FrameworkApplication.Current.Dispatcher.Invoke(
Sub()
     Dim savFeatClassDialog As New SaveItemDialog
     savFeatClassDialog.Title = "Output Feature Class..."
     savFeatClassDialog.InitialLocation = Project.Current.DefaultGeodatabasePath
     savFeatClassDialog.OverwritePrompt = True
     savFeatClassDialog.Filter = ItemFilters.featureClasses_all

     Dim IsResOk As Boolean? = savFeatClassDialog.ShowDialog
     If IsResOk Then
          txtOutput.Text = savFeatClassDialog.FilePath
     End If
End Sub)
End Sub)

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi Abel,

SaveItemDialog is GUI element so you should not use QueuedTask with SaveItemDialog. You need to end QueuedTask before calling SaveItemDialog and start new QueuedTask after SaveItemDialog return (if you need). All methods that needs QueuedTask are marked by Intellisense  as "This method must be called on MCT....". 

View solution in original post

2 Replies
GKmieliauskas
Esri Regular Contributor

Hi Abel,

SaveItemDialog is GUI element so you should not use QueuedTask with SaveItemDialog. You need to end QueuedTask before calling SaveItemDialog and start new QueuedTask after SaveItemDialog return (if you need). All methods that needs QueuedTask are marked by Intellisense  as "This method must be called on MCT....". 

AbelPerez
Frequent Contributor

Gotcha. I think as i work with the SDK I am getting better at it.

0 Kudos