public LedRegistationInfoResponse GetLedRegistationInfo(string mac, string sn = "") { LedRegistationInfoResponse registationInfo = null; LedRegistationInfoRequest infoRequest = new LedRegistationInfoRequest() { mac = mac, sn = sn }; RestFulClient.Instance.Post("api/index/getScreen", infoRequest, response => { if (response.ResponseStatus == ResponseStatus.Completed) { try { var registInfoResponse = JsonConvert.DeserializeObject<LedRegistationInfoResponse>(response.Content); if (registInfoResponse == null) return; registationInfo = new LedRegistationInfoResponse() { IsRegisted = registInfoResponse.IsRegisted, User = registInfoResponse.User, Name = registInfoResponse.Name, Mac = registInfoResponse.Mac, SN = registInfoResponse.SN }; } catch (JsonSerializationException serializatinException) { _logService.Error(string.Format("ExistCatch:<-{0}->:{1}", "GetLedRegistationInfo", serializatinException.ToString())); } catch (Exception ex) { _logService.Error(string.Format("ExistCatch:<-{0}->:{1}", "GetLedRegistationInfo", ex.ToString())); } } else { _logService.Info(string.Format("ExistCatch:<-{0}->:{1}", "GetLedRegistationInfo", "请求未完成!")); } }); return registationInfo; }
private List<LedRegistationInfoResponse> GetRegistationInfoByString(string response) { List<LedRegistationInfoResponse> registationInfos = new List<LedRegistationInfoResponse>(); List<LedRegistationInfoResponse> registInfoResponseList = CommandTextParser.GetDeJsonSerialization<List<LedRegistationInfoResponse>>(response); if (registInfoResponseList == null) { registInfoResponseList = new List<LedRegistationInfoResponse>(); } foreach (LedBasicInfo ledbasic in _ledInfoList) { LedRegistationInfoResponse registationInfo = registInfoResponseList.Find(a => a.SN == ledbasic.Sn); if (registationInfo == null) { registationInfo = new LedRegistationInfoResponse() { IsRegisted = false, User = null, Name = null, Mac = AppDataConfig.CurrentMAC, SN = ledbasic.Sn }; } ledbasic.AliaName = registationInfo.Name; registationInfos.Add(registationInfo); } _fLogService.Info("完成获取到的Care注册的信息处理"); return registationInfos; }