J'écris un exemple d'application Windows Phone 8. J'ai également installé le cadre Async for .NET Framework 4, Silverlight 4 and 5, and Windows Phone. Mais, attendez sur une méthode n'attend pas et mon mainpage.xaml charge qui essaye d'accéder à une propriété qui n'a pas encore été remplie.Windows Phone 8 n'attend pas
Voici mon code.
public static ObservableCollection<Model.CatalogCategory> Products { get; set; }
private async void Application_Launching(object sender, LaunchingEventArgs e)
{
ApplicationViewModel vm = new ApplicationViewModel();
Products = await vm.LoadLocalDataAsync();
}
Après cette méthode, le MainPage.xaml est chargé qui tente d'accéder à « Produits » et renvoie une exception de référence null.
Y at-il une approche différente que je dois prendre?