| | |
| | | if (common != null) { |
| | | var oldDevice = alexaDeviceLista.Find ((obj) => obj.SubnetID == common.SubnetID && obj.DeviceID == common.DeviceID && obj.LoopID == common.LoopID && obj.DeviceType == common.Type.ToString ()); |
| | | if (oldDevice == null) { |
| | | AddDevice (common); |
| | | var isSuccess = AddDevice (common); |
| | | if (!isSuccess) { |
| | | //跳出循环 |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | AddScene (uploadScene); |
| | | var isSuccess = AddScene (uploadScene); |
| | | if (!isSuccess) { |
| | | //跳出循环 |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | var revertObj = MainPage.RequestHttps (API.GetDeviceList, requestJson); |
| | | if (revertObj.StateCode.ToUpper() == "SUCCESS") { |
| | | deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UpdateDeviceObj>> (revertObj.ResponseData.ToString()); |
| | | } else { |
| | | //2020-06-29 弹窗提示错误 |
| | | |
| | | |
| | | } |
| | | return deviceList; |
| | | } |
| | |
| | | var revertObj = MainPage.RequestHttps (API.UploadDevices, requestJson); |
| | | if (revertObj.StateCode.ToUpper() == "SUCCESS") { |
| | | return true; |
| | | }else if (revertObj.StateCode == "Exist") { |
| | | Application.RunOnMainThread (() => { |
| | | MainPage.AddTip (ErrorCode.AddFailed + " " + ErrorCode.NameExist + " ( " + device.Name + " )"); |
| | | }); |
| | | return true; |
| | | } else { |
| | | //2020-06-29 弹出提示错误 |
| | | ShowUploadDevicesInfo (revertObj.StateCode); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 上传设备 错误提示 |
| | | /// </summary> |
| | | /// <param name="stateCodeStr"></param> |
| | | void ShowUploadDevicesInfo (string stateCodeStr) |
| | | { |
| | | string mes = ""; |
| | | if (stateCodeStr == "NoRecord") { |
| | | //住宅未绑定网关! |
| | | mes = ErrorCode.HomeNoRecord; |
| | | } else if (stateCodeStr == "NoExist") { |
| | | //住宅不存在! |
| | | mes = ErrorCode.HomeNoExist; |
| | | } else if (stateCodeStr == "Exist") { |
| | | //设备名称已存在 |
| | | mes = ErrorCode.NameExist; |
| | | } else if (stateCodeStr == ErrorCode.NetworkError) { |
| | | mes = ErrorCode.NetworkError; |
| | | } else { |
| | | mes = ErrorCode.OperationFailed + ErrorCode.Reason + stateCodeStr; |
| | | |
| | | } |
| | | if (!string.IsNullOrEmpty (mes)) { |
| | | Application.RunOnMainThread (() => { |
| | | MainPage.AddTip (ErrorCode.AddFailed + " " + mes); |
| | | |
| | | //new Alert ("", ErrorCode.AddFailed + " " + mes, Language.StringByID (R.MyInternationalizationString.Close)).Show (); |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | var revertObj = MainPage.RequestHttps (API.DeleteDevice, requestJson); |
| | | if (revertObj.StateCode.ToUpper() == "SUCCESS") { |
| | | return true; |
| | | } else { |
| | | //2020-06-29 弹窗提示错误 |
| | | |
| | | } |
| | | return false; |
| | | } |
| | |
| | | var revertObj = MainPage.RequestHttps (API.GetSceneList, requestJson); |
| | | if (revertObj.StateCode.ToUpper() == "SUCCESS") { |
| | | sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SceneByRegion>> (revertObj.ResponseData.ToString ()); |
| | | } else { |
| | | //2020-06-29 弹窗提示错误 |
| | | } |
| | | return sceneList; |
| | | } |
| | |
| | | //if (revertAddDeviceObj.StateCode.ToUpper() == "SUCCESS") { |
| | | return true; |
| | | //} |
| | | } else if (revertObj.StateCode == "Exist") { |
| | | Application.RunOnMainThread (() => { |
| | | MainPage.AddTip (ErrorCode.AddFailed + " " + ErrorCode.NameExist + " ( " + sceneMark.SceneName + " )"); |
| | | }); |
| | | return true; |
| | | } else { |
| | | //2020-06-29 弹出提示错误 |
| | | ShowUploadDevicesInfo (revertObj.StateCode); |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | |
| | | var revertObj = MainPage.RequestHttps (API.DeleteScene, requestJson); |
| | | if (revertObj.StateCode.ToUpper() == "SUCCESS") { |
| | | return true; |
| | | } else { |
| | | //2020-06-29 弹窗提示错误 |
| | | |
| | | } |
| | | return false; |
| | | } |