示例#1
0
        private List <IGenreCategory> RetrieveGenreCategories()
        {
            var result = new List <IGenreCategory>();

            try
            {
                var retrieveGenreStationsRequest = new JSONRequest(MethodNames.station_getGenreStations, false, RequiredInfo);
                var res = new JSONResult(retrieveGenreStationsRequest.StringRequestAsync().Result);

                if (res.IsFault)
                {
                    Messenger.Default.Send(new FaultMessage(res.Fault.Message));
                    return(null);
                }

                var data = res.Result;
                //GenreStationsChecksum = data["checksum"].ToString();
                foreach (var station in data["categories"])
                {
                    result.Add(StationFactory.CreateGenreCategory(RequiredInfo, station));
                }
            }
            catch (Exception ex)
            {
                Messenger.Default.Send(new FaultMessage(ex.Message, ex));
                return(null);
            }

            return(result);
        }