示例#1
0
        private IUserStation RetrieveExtendedUserStationInfo(string stationToken)
        {
            IUserStation result = null;

            try
            {
                var retrieveExUserStationInfoRequest = new JSONRequest(
                    MethodNames.station_getStation,
                    false,
                    RequiredInfo,
                    new KeyValuePair <string, object>("stationToken", stationToken));
                var res = new JSONResult(retrieveExUserStationInfoRequest.StringRequestAsync().Result);

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

                var data = res.Result;
                result = StationFactory.CreateUserStation(RequiredInfo, data);
            }
            catch (Exception ex)
            {
                Messenger.Default.Send(new FaultMessage(ex.Message, ex));
                return(null);
            }

            return(result);
        }
示例#2
0
        private List <IUserStation> RetrieveUserStations()
        {
            var result = new List <IUserStation>();

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

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

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

            return(result);
        }