/// <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); } } }
public static AbstractDataSource BuildDataSource(int documentId) { AbstractDataSource dataSource = null; switch (documentId) { case 0: dataSource = new LocalDataSource(); break; case 1: dataSource = new RemoteDataSource(); break; } return(dataSource); }