Пример #1
0
        /// <summary>
        /// Retrieves available genres from MixRadio API.
        /// </summary>
        public async void GetGenres()
        {
            if (!initialized)
            {
                return;
            }

            ShowProgressIndicator("GetGenres()");
            ListResponse <Genre> response = await client.GetGenresAsync();

            // Use results
            if (response != null && response.Result != null && response.Result.Count > 0)
            {
                int genreCount = response.Count();
                App.ViewModel.Genres.Clear();

                foreach (Genre g in response.Result)
                {
                    App.ViewModel.Genres.Add(new GenreModel()
                    {
                        Name = g.Name, Id = g.Id
                    });
                }
            }
            if (response != null && response.Error != null)
            {
                ShowMixRadioApiError();
            }
            HideProgressIndicator("GetGenres()");
        }