From c96d62ac9c6bb1d880a9170f9dd477fcb5f76fc0 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 01 二月 2023 10:16:11 +0800 Subject: [PATCH] 备注同步功能 --- /dev/null | 0 Crabtree/SmartHome/UI/SimpleControl/Phone/Room/GenericDialog.cs | 95 ++++++++++++++++++++++++++++++- Crabtree/ON/Properties/AndroidManifest.xml | 2 Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserDeviceListPage.cs | 18 ++++- Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserRoom.cs | 3 + Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs | 2 Crabtree/SmartHome/UI/SimpleControl/MainPage.cs | 2 7 files changed, 111 insertions(+), 11 deletions(-) diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index e111c98..0000000 --- a/.DS_Store +++ /dev/null Binary files differ diff --git a/Crabtree/.DS_Store b/Crabtree/.DS_Store deleted file mode 100644 index 79ad52d..0000000 --- a/Crabtree/.DS_Store +++ /dev/null Binary files differ diff --git a/Crabtree/ON/.DS_Store b/Crabtree/ON/.DS_Store deleted file mode 100644 index 6a2a0ed..0000000 --- a/Crabtree/ON/.DS_Store +++ /dev/null Binary files differ diff --git a/Crabtree/ON/Properties/AndroidManifest.xml b/Crabtree/ON/Properties/AndroidManifest.xml index 3455605..5c38ea7 100644 --- a/Crabtree/ON/Properties/AndroidManifest.xml +++ b/Crabtree/ON/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@ 锘�<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.801062" android:versionCode="202301062"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.802011" android:versionCode="202302011"> <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="30" /> <!-- 鍦ㄥ畨鍗揚鐗堟湰涔嬪悗锛屽繀椤昏鎺堜簣FOREGROUND_SERVICE鏉冮檺锛屾墠鑳藉浣跨敤鍓嶅彴鏈嶅姟 --> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> diff --git a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs index 94756a8..a91721a 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs @@ -38,7 +38,7 @@ //public static Button LogoButton = new Button (); - public static string RequestVersion = "2.801091"; + public static string RequestVersion = "2.802011"; public static UserInfo LoginUser; /// <summary> /// 鏄惁鏄鐞嗗憳鏉冮檺(鍙樻洿浜�,鎴愬憳鐨勬椂鍊�,杩欎釜涔熶负ture銆備负浠�涔堜細澹版槑杩欐牱鍙橀噺,鍥犱负鏈変簺鎺ュ彛蹇呴』浣跨敤鍘熸潵鐨凾oken) diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs index d19e993..c1ccd5a 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs @@ -86,6 +86,7 @@ //etAccount.Text = "2791308028@qq.com"; etAccount.Text = "464027401@qq.com"; etAccount.Text = "460649739@qq.com"; + etAccount.Text = "1489771324@qq.com"; //etAccount.Text = "jai.panghal2201@gmail.com"; //etAccount.Text = "858539859@qq.com"; #endif @@ -143,6 +144,7 @@ //etPasswrod.Text = "123456"; etPasswrod.Text = "123456"; etPasswrod.Text = "kkkkkk333"; + etPasswrod.Text = "Hdl1985."; //etPasswrod.Text = "Haryana@2201"; #endif passwrodView.AddChidren (etPasswrod); diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/GenericDialog.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/GenericDialog.cs index 6e22cda..310a1e9 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/GenericDialog.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/GenericDialog.cs @@ -96,6 +96,8 @@ dialogBottomView.AddChidren (editor); editor.MouseUpEventHandler += (dff, ffd) => { + + string remakeStr = etDeviceName.Text.Trim (); if (string.IsNullOrEmpty (remakeStr)) { //澶囨敞涓嶈兘涓虹┖ @@ -107,6 +109,21 @@ if (remakeBytes.Length > 20) { new Alert ("", ErrorCode.RemarkLengthExceededTheLimit, "Close").Show (); return; + } + + //淇敼浜戠澶囨敞 + 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 (); @@ -146,14 +163,14 @@ IO.FileUtils.SaveEquipmentMessage (commonDevice, commonDevice.LoopID.ToString ()); } + + + successAction?.Invoke (); + //IO.FileUtils.SaveEquipmentMessage (commonDevice, commonDevice.LoopID.ToString ()); MainPage.Loading.Hide (); dialog.Close (); - }); - - //淇敼鎴愬姛鍥炶皟 - successAction?.Invoke (); } else { Application.RunOnMainThread (() => { new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.FailureToModify), Language.StringByID (R.MyInternationalizationString.Close)).Show (); @@ -162,6 +179,76 @@ }); } }); + + + //string remakeStr = etDeviceName.Text.Trim (); + //if (string.IsNullOrEmpty (remakeStr)) { + // //澶囨敞涓嶈兘涓虹┖ + // new Alert ("", ErrorCode.RemarksCannotBeEmpty, "Close").Show (); + // return; + //} + + //byte [] remakeBytes = CommonPage.MyEncodingGB2312.GetBytes (remakeStr); + //if (remakeBytes.Length > 20) { + // new Alert ("", ErrorCode.RemarkLengthExceededTheLimit, "Close").Show (); + // return; + //} + + //MainPage.Loading.Start (); + ////byte [] remakeBytes = CommonPage.MyEncodingGB2312.GetBytes (etDeviceName.Text.Trim ()); + //System.Threading.Tasks.Task.Run (() => { + // byte [] updateBytes = null; + // if (commonDevice.Type == DeviceType.LightSwitchSocket) { + // updateBytes = Control.ControlBytesSendHasReturn (Command.ReadDeviceLoopInfo, commonDevice.SubnetID, commonDevice.DeviceID, new byte [] { commonDevice.BigClass, 1, commonDevice.LoopID }); + // } else { + // updateBytes = Control.ControlBytesSendHasReturn (Command.ReadDeviceLoopInfo, commonDevice.SubnetID, commonDevice.DeviceID, new byte [] { commonDevice.BigClass, commonDevice.MinClass, commonDevice.LoopID }); + // } + // if (updateBytes == null) { + // Application.RunOnMainThread (() => { + // new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline), Language.StringByID (R.MyInternationalizationString.Close)).Show (); + // MainPage.Loading.Hide (); + // dialog.Close (); + // }); + // return; + // } + // byte [] uBytes = new byte [20]; + // Array.Copy (remakeBytes, 0, uBytes, 0, remakeBytes.Length < 20 ? remakeBytes.Length : 20); + // Array.Copy (uBytes, 0, updateBytes, 3, 20 < uBytes.Length ? 20 : uBytes.Length); + // byte [] reBytes = Control.ControlBytesSendHasReturn (Command.SetDeviceLoopInfo, commonDevice.SubnetID, commonDevice.DeviceID, updateBytes); + // if (reBytes != null) { + // Application.RunOnMainThread (() => { + // btnEquipment.Text = commonDevice.Name = etDeviceName.Text.Trim (); + // if (commonDevice.Type == DeviceType.InfraredMode) { + // //2020-07-03 淇绾㈠鐢佃淇敼鍚庡彉绾㈠妯″潡闂 + // InfraredMode mTV = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (System.Text.Encoding.UTF8.GetString (commonBytes)); + // if (mTV == null) { + // IO.FileUtils.SaveEquipmentMessage (commonDevice, commonDevice.LoopID.ToString ()); + // } else { + // mTV.Name = etDeviceName.Text.Trim (); + // IO.FileUtils.SaveEquipmentMessage (mTV, mTV.LoopID.ToString ()); + // } + // } else { + // IO.FileUtils.SaveEquipmentMessage (commonDevice, commonDevice.LoopID.ToString ()); + // } + + // //IO.FileUtils.SaveEquipmentMessage (commonDevice, commonDevice.LoopID.ToString ()); + // MainPage.Loading.Hide (); + // dialog.Close (); + + // }); + + // //淇敼鎴愬姛鍥炶皟 + // successAction?.Invoke (); + // } else { + // Application.RunOnMainThread (() => { + // new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.FailureToModify), Language.StringByID (R.MyInternationalizationString.Close)).Show (); + // MainPage.Loading.Hide (); + // dialog.Close (); + // }); + // } + //}); + + }; dialog.Show (); } 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 ()); diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserRoom.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserRoom.cs index b9c5d52..809a913 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserRoom.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserRoom.cs @@ -1096,6 +1096,8 @@ fhRowView.AddChidren (btnFHNull); #endregion } + //InitRoomView (roomFilePath); + foreach (var devcieCommon in room.DeviceList) { if (devcieCommon == null) continue; @@ -2401,6 +2403,7 @@ //if (!roomDeviceFilePathList.Contains (filePath)) { // roomDeviceFilePathList.Add (filePath); //} + }; GenericDialog.Current.ShowModifyRemarksDialog (commonDevice, commonBytes, btnEquipment, successAction); } -- Gitblit v1.8.0