Пример #1
0
        public async Task<Artist> GetArtistAsync(string id)
        {
            Artist retVal = null;
            var content = await GetArtistStringAsync(id);
            if(content != null)
            {
                JsonObject jsonObject = JsonObject.Parse(content);
                retVal = new Artist(jsonObject);
            }

            return retVal;
        }
Пример #2
0
        /// <summary>
        /// Initializes the IDataSource and requests the Arist information.
        /// When the data returns, it will update any OneWay data bindings.
        /// </summary>
        private async void InitializeData()
        {
            _dataSource = new RemoteDataSource();
            var success = await _dataSource.Initialize();
            if (success)
            {
                Artist artist = await _dataSource.GetArtistAsync(DEFAULT_ARTIST_ID);
                if (artist != null)
                {
                    Artist = artist;

                    // Bind our data to our UI
                    Bindings.Update();

                    var width = Window.Current.Bounds.Width;
                    var height = Window.Current.Bounds.Height;

                    artistImage.Source = new BitmapImage(new Uri(Artist.ImageUrl + "&h=768&w=1024"));

                    progressRing.IsActive = false;
                    progressRing.Visibility = Visibility.Collapsed;

                    ElementCompositionPreview.GetElementVisual(this).StartAnimation("Opacity", _pageFadeIn);
                }
            }
        }