I did something like this:
protected volatile bool ContentLoaded = false;
protected async override void LoadContent()
{
base.LoadContent();
Enabled = false;
await ThreadPool.RunAsync(new WorkItemHandler(LoadAllContent));
}
protected void LoadAllContent(Windows.Foundation.IAsyncAction action)
{
if (action.Status == Windows.Foundation.AsyncStatus.Error)
System.Diagnostics.Debug.WriteLine(action.ErrorCode);
ContentLoaded = true;
Enable = true;
}
And at the beginning of your method Draw:
if (!ContentLoaded)
{
return;
}
If you need a progress bar, you need a counter to increase each resource you load, and then Drawyour panel should refer to this counter in yours.
source
share