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)
Solved! Go to Solution.
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....".
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....".
Gotcha. I think as i work with the SDK I am getting better at it.