Exception | Description |
---|---|
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
var contentItem = Project.Current.GetItems<FolderConnectionProjectItem>().First(); //var contentItem = ... //Check if the MCT is required for Refresh() if (contentItem.IsMainThreadRequired) { //QueuedTask.Run must be used if item.IsMainThreadRequired //returns true QueuedTask.Run(() => contentItem.Refresh()); } else { //if item.IsMainThreadRequired returns false, any //thread can be used to invoke Refresh(), though //BackgroundTask is preferred. contentItem.Refresh(); //Or, via BackgroundTask ArcGIS.Core.Threading.Tasks.BackgroundTask.Run(() => contentItem.Refresh(), ArcGIS.Core.Threading.Tasks.BackgroundProgressor.None); }
Target Platforms: Windows 11, Windows 10