Skip to content

Commit 6131632

Browse files
committed
fix cross thread problem
1 parent 938755f commit 6131632

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

J4JMapWinLibrary/map-control/dep-props/projection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public sealed partial class J4JMapControl
3939
public event EventHandler<NewCredentialsEventArgs>? NewCredentials;
4040

4141
private readonly DispatcherQueue _dispatcherLoadImages = DispatcherQueue.GetForCurrentThread();
42+
private readonly DispatcherQueue _dispatcherChangeProjection = DispatcherQueue.GetForCurrentThread();
4243
private readonly ThrottleDispatcher _throttleRegionChanges = new();
4344
private readonly ThrottleDispatcher _throttleProjChanges = new();
4445

@@ -75,8 +76,7 @@ public string? MapProjection
7576
if( !IsLoaded )
7677
return;
7778

78-
_throttleProjChanges.Throttle( UpdateEventInterval,
79-
_ => Task.Run( async () => await InitializeProjectionAsync() ) );
79+
_dispatcherChangeProjection.TryEnqueue( async () => await InitializeProjectionAsync() );
8080
}
8181
}
8282

0 commit comments

Comments
 (0)