コード例 #1
0
        private async void logInOut(object sender)
        {
            bool temp = loginState.Value;

            LoginState = null;
            if (temp)
            {
                LoginState = !await cloud.Logout();
            }
            else
            {
                LoginState = await cloud.Login();
            }

            if (loginState.Value)
            {
                User = await cloud.GetUser();

                //Musics = new ObservableCollection<MusicViewModel>((await cloud.GetMusics()).OrderBy(m => m.Title).Select(m => new MusicViewModel(m)));
                var songs = await cloud.GetMusic();

                foreach (var s in songs.Cast <Song>())
                {
                    s.RetreiveMetadataAsync().ContinueWith(async(t) =>
                    {
                        await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                        {
                            musics.Add(new SongViewModel(s));
                        });
                    });
                }
            }
        }