Essentials
Essentials copied to clipboard
[QUESTION] MainThread.BeginInvokeOnMainThread
I have to update the ui (ObservableCollection) through an event synchronous (SignalR) it may be that at that moment the application is not with that view visible because the user is in another view. I went to test with MainThread.BeginInvokeOnMainThread and it didn't work, but with Device.BeginInvokeOnMainThread it got updated. Are there big differences?
Would need to compare code. What platform?
A colleague at my work, also faced with this. The difference is in the if else construct. Unfortunately he didn't have the sample code saved
public static bool IsMainThread =>
PlatformIsMainThread;
public static void BeginInvokeOnMainThread(Action action)
{
if (IsMainThread)
{
action();
}
else
{
PlatformBeginInvokeOnMainThread(action);
}
}
It happened to me on android, to see if I take the time and do the example.
@dimonovdd and what was the solution?