/// <summary> /// Downloads music data from the internet and saves the data locally. /// </summary> public void LoadArtists() { StatusBarErrorText = string.Empty; StatusBarVisible = Visibility.Collapsed; try { var musicUrl = ConfigurationManager.AppSettings[MusicUriKey]; if (string.IsNullOrWhiteSpace(musicUrl)) { throw new Exception( string.Format("Key {0} is missing in AppSettings section in the configuration file.", MusicUriKey)); } var networkHelper = new NetworkHelper(); if (!networkHelper.CheckForInternetConnection()) { throw new Exception( "Internet connection is not available. Check if computer is connected to the internet."); } var translator = new Translator(); Artists = translator.Translate(networkHelper.GetJsonData(musicUrl)); OnPropertyChanged("ArtistCounterText"); if (Artists != null && Artists.Count > 0) { ArtistsSelectedIndex = 0; OnPropertyChanged("ArtistsSelectedIndex"); } StatusBarStatusText = String.Empty; } catch (Exception e) { StatusBarVisible = Visibility.Visible; StatusBarStatusText = String.Empty; StatusBarErrorText = string.Format("Error: {0}", e.Message); OnPropertyChanged("StatusBarStatusText"); OnPropertyChanged("StatusBarErrorText"); } }