From c96d62ac9c6bb1d880a9170f9dd477fcb5f76fc0 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 01 二月 2023 10:16:11 +0800 Subject: [PATCH] 备注同步功能 --- Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserDeviceListPage.cs | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserDeviceListPage.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserDeviceListPage.cs index 4ce9682..1aa6388 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserDeviceListPage.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserDeviceListPage.cs @@ -443,11 +443,19 @@ } //淇敼浜戠澶囨敞 - new System.Threading.Thread (() => { - var http = new HttpServerRequest (); - http.EditDeviceName (commonDevice.DeviceID.ToString (), UserConfig.Instance.CurrentRegion.Id, remakeStr); - }) { IsBackground = true }.Start (); - + var cloudDataLoop = CommonConfig.Current.FunctionList.Find ((obj) => obj.bus.SubnetID == commonDevice.SubnetID + && obj.bus.DeviceID == commonDevice.DeviceID && obj.bus.LoopId == commonDevice.LoopID); + if (cloudDataLoop == null) { + new Alert (Language.StringByID (R.MyInternationalizationString.Tip), "Data is not synchronized to the cloud.", Language.StringByID (R.MyInternationalizationString.Close)).Show (); + } else { + new System.Threading.Thread (() => { + var http = new HttpServerRequest (); + var pack = http.EditDeviceName (cloudDataLoop.deviceId, UserConfig.Instance.CurrentRegion.Id, remakeStr); + if (pack.Code != "0") { + new Alert (Language.StringByID (R.MyInternationalizationString.Tip), $"Cloud data modification failed({pack.Code}).", Language.StringByID (R.MyInternationalizationString.Close)).Show (); + } + }) { IsBackground = true }.Start (); + } MainPage.Loading.Start (); //byte [] remakeBytes = CommonPage.MyEncodingGB2312.GetBytes (etDeviceName.Text.Trim ()); -- Gitblit v1.8.0