-
Notifications
You must be signed in to change notification settings - Fork 731
Closed
Labels
Description
I am probably just doing it the wrong way but the idea is
that I have one (or more) buttons which when pressed/clicked
load some data and display that data in a ListBox.
When I click the button the first time I can see the first WriteLine
and then the LoadItemsAsync method is awaited.
If I don't do anything it will just await forever.
When I click the button again or move focus to the next control
the awaited method completes and the next WriteLine is executed.
Update: If I move the mouse the awaited method also completes
I have tried without MainLoop.Invoke as well.
I'm guessing I am just handling this the wrong way.
Any suggestions?
button.Clicked += async () =>
{
Application.MainLoop.Invoke (async () => {
//When the button is 'clicked' the following is executed
Debug.WriteLine($"Clicked the button");
var items = await LoadItemsAsync();
//However the following line is not executed
//until the button is clicked again or
//until the cursor is moved to the next view/control
Debug.WriteLine($"Got {items.Count} items)");
itemsList.SetSource(items);
//Without calling this the UI is not updated
this.LayoutSubviews();
});
};
System: Ubuntu 19.10
jmurth1234