This repository was archived by the owner on May 1, 2024. It is now read-only.
File tree 3 files changed +8
-3
lines changed
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared
Xamarin.Forms.Platform.UAP
3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -80,13 +80,13 @@ protected override void Init()
80
80
var threadpoolButton = new Button { Text = "Update Instructions from Thread Pool" } ;
81
81
layout . Children . Add ( threadpoolButton ) ;
82
82
83
- this . Dispatcher . BeginInvokeOnMainThread ( ( ) => { instructions . Text = "updated from thread pool 1" ; } ) ;
83
+ this . Dispatcher . BeginInvokeOnMainThread ( ( ) => { instructions . Text = "updated from thread pool 1 IsInvokeRequired=" + this . Dispatcher . IsInvokeRequired ; } ) ;
84
84
85
85
threadpoolButton . Clicked += ( o , a ) =>
86
86
{
87
87
Task . Run ( ( ) =>
88
88
{
89
- this . Dispatcher . BeginInvokeOnMainThread ( ( ) => { instructions . Text = "updated from thread pool 2" ; } ) ;
89
+ this . Dispatcher . BeginInvokeOnMainThread ( ( ) => { instructions . Text = "updated from thread pool 2 IsInvokeRequired=" + this . Dispatcher . IsInvokeRequired ; } ) ;
90
90
} ) ;
91
91
} ;
92
92
Original file line number Diff line number Diff line change @@ -25,6 +25,6 @@ public Dispatcher(CoreDispatcher coreDispatcher)
25
25
_coreDispatcher = coreDispatcher ;
26
26
}
27
27
28
- bool IDispatcher . IsInvokeRequired => Device . IsInvokeRequired ;
28
+ bool IDispatcher . IsInvokeRequired => ! _coreDispatcher . HasThreadAccess ;
29
29
}
30
30
}
Original file line number Diff line number Diff line change @@ -27,6 +27,11 @@ public IDispatcher GetDispatcher(object context)
27
27
s_current = new Dispatcher ( renderer . ContainerElement . Dispatcher ) ;
28
28
return s_current ;
29
29
}
30
+ else
31
+ {
32
+ s_current = new Dispatcher ( ) ;
33
+ return s_current ;
34
+ }
30
35
}
31
36
32
37
return null ;
You can’t perform that action at this time.
0 commit comments