I have a class costructor:
public AllSignalsViewModel()
{
LoadSignals();
fetchMoreDataCommand = new DelegateCommand(
obj =>
{
if (busy)
{
return;
}
Busy = true;
ThreadPool.QueueUserWorkItem(
delegate
{
Deployment.Current.Dispatcher.BeginInvoke(
delegate
{
AddMoreItems();
Busy = false;
});
});
});
}
LoadSignals() is an async function, but I need to let it ends, before the running of the following code. But I can't await it, because I can't set the constructor as async. What I should to do?
Here is a LoadSignals() function:
private async void LoadSignals()
{
var xmlDocument = new XmlDataSource();
var sigCol = new SignalCollection(xmlDocument);
var region = GetRegionInSettingsStorage();
var allSignals = await sigCol.LoadSignals(isVotes(), false, region);
signalSchema = allSignals;
AddMoreItems();
}
What to do?