public void LoadContent() { ListArtiste = new ObservableCollection<User>(); ListMusique = new ObservableCollection<Music>(); ListInfluences = new ObservableCollection<Influence>(); ListAmbiance = new ObservableCollection<Ambiance>(); var request = new HttpRequestGet(); try { var listIdentities = request.GetIdentities(new List<Identities>(), Singleton.Singleton.Instance().CurrentUser.id.ToString(), Singleton.Singleton.Instance().SecureKey); listIdentities.ContinueWith(delegate(Task<object> tmp) { var test = tmp.Result as List<Identities>; if (test != null) { foreach (var item in test) { if (item.provider == "soundcloud") { var post = new HttpRequestPost(); var result = post.GetMusicalPast(item.uid, Singleton.Singleton.Instance().SecureKey, Singleton.Singleton.Instance().CurrentUser.id.ToString()); result.ContinueWith(delegate(Task<string> t) { var res = t.Result; }); } } } }); var listGenre = request.GetListObject(new List<Influence>(), "influences"); listGenre.ContinueWith(delegate(Task<object> tmp) { var test = tmp.Result as List<Influence>; if (test != null) { foreach (var item in test) { CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { ListInfluences.Add(item); }); } } }); var listUser = request.GetListObject(new List<User>(), "users"); listUser.ContinueWith(delegate(Task<object> tmp) { var test = tmp.Result as List<User>; if (test != null) { foreach (var item in test) { var res = request.GetArtist(new Artist(), "users", item.id.ToString()); res.ContinueWith(delegate(Task<object> obj) { CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { var art = obj.Result as Artist; item.profilImage = new BitmapImage(new Uri(Constant.UrlImageUser + item.image, UriKind.RelativeOrAbsolute)); if (art != null && art.artist) ListArtiste.Add(item); }); }); } } }); ValidateKey.GetValideKey(); var listZik = request.GetSuggest(new List<Music>(), "music"); listZik.ContinueWith(delegate(Task<object> tmp) { var test = tmp.Result as List<Music>; if (test != null) { foreach (var item in test) { CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, () => { item.album.imageAlbum = new BitmapImage(new Uri(Constant.UrlImageAlbum + item.album.image, UriKind.RelativeOrAbsolute)); ListMusique.Add(item); }); } } }); var listAmb = request.GetListObject(new List<Ambiance>(), "ambiances"); listAmb.ContinueWith(delegate(Task<object> task) { var test = listAmb.Result as List<Ambiance>; if (test != null) { foreach (var item in test) { CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, () => { var ambiance = request.GetObject(new Ambiance(), "ambiances", item.id.ToString()); ambiance.ContinueWith(delegate(Task<object> task1) { var am = task1.Result as Ambiance; CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, () => { foreach (var music in am.musics) { music.album.imageAlbum = new BitmapImage( new Uri(Constant.UrlImageAlbum + music.album.image, UriKind.RelativeOrAbsolute)); } ListAmbiance.Add(am); }); }); }); } } }); } catch (Exception e) { //new MessageDialog("probleme reseau : " + e.Message).ShowAsync(); } }