private void CreatePlaylistExecute() { var playlist = new Playlist { name = "MyPlaylist", user = Singleton.Singleton.Instance().CurrentUser, musics = new List<Music> {MusicForPlaylist} }; if (MusicForPlaylist != null) { var post = new HttpRequestPost(); try { ValidateKey.GetValideKey(); var test = post.SavePlaylist(playlist, Singleton.Singleton.Instance().SecureKey, Singleton.Singleton.Instance().CurrentUser); test.ContinueWith(delegate(Task<string> tmp) { var res = tmp.Result; if (res != null) { CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { var stringJson = JObject.Parse(res).SelectToken("content").ToString(); var playList = (Playlist) JsonConvert.DeserializeObject(stringJson, new Playlist().GetType()); try { ValidateKey.GetValideKey(); var up = post.UpdatePlaylist(playList, MusicForPlaylist, Singleton.Singleton.Instance().SecureKey, Singleton.Singleton.Instance().CurrentUser); up.ContinueWith(delegate(Task<string> tmp2) { var res2 = tmp2.Result; if (res2 != null) { CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, RefreshPlaylist); } }); } catch (Exception) { new MessageDialog(loader.GetString("ErrorUpdatePlaylist")).ShowAsync(); } }); } }); } catch (Exception) { new MessageDialog(loader.GetString("ErrorUpdatePlaylist")).ShowAsync(); } } else { new MessageDialog(loader.GetString("ErrorNoMusic")).ShowAsync(); } }