From dfa6733793434bdcfd394f978ae72f1628b2260f Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期三, 22 四月 2020 16:50:03 +0800 Subject: [PATCH] 合并代码 --- ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetForm.cs | 10 ZigbeeApp/GateWay.Droid/Assets/Language.ini | 13 ZigbeeApp/Home.Ios/Resources/Language.ini | 6 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs | 273 ++++++- ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs | 4 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs | 9 ZigbeeApp/Shared/R.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs | 38 ZigbeeApp/Shared/Common/CommonPage.cs | 2 ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs | 56 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs | 5 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs | 1 ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs | 50 + ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll | 0 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs | 19 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs | 10 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs | 17 ZigbeeApp/Shared/Common/Device.cs | 26 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/ShowDoorLockMsgControl.cs | 22 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs | 21 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs | 6 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs | 73 - ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs | 46 ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs | 48 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs | 31 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs | 21 ZigbeeApp/Shared/DLL/IOS/Shared.IOS.TBL.dll | 0 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs | 16 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindCommonLayout.cs | 35 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs | 24 ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs | 83 + ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs | 72 + ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs | 21 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs | 46 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs | 9 ZigbeeApp/Shared/Phone/MainPage/DeviceDetailInfoForm.cs | 1 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs | 21 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs | 947 ++++++++++++++------------ 40 files changed, 1,339 insertions(+), 753 deletions(-) diff --git a/ZigbeeApp/GateWay.Droid/Assets/Language.ini b/ZigbeeApp/GateWay.Droid/Assets/Language.ini index 548e959..e07949f 100755 --- a/ZigbeeApp/GateWay.Droid/Assets/Language.ini +++ b/ZigbeeApp/GateWay.Droid/Assets/Language.ini @@ -309,11 +309,10 @@ 303=娓╁害鏉ユ簮 304=婀垮害鏉ユ簮 305=PM2.5鏉ユ簮 -307=涓嶈兘鍒涘缓鑷姩鍖栧父寮�妯″紡 -308=涓嶈兘鍙栨秷鑷姩鍖栧父寮�妯″紡 - - - +307=璀﹀憡锛佹椂鏁堟�у父寮�鍏抽棴闂ㄩ攣鍔熻兘澶辫触锛岃鎵嬪姩鍙栨秷甯稿紑妯″紡銆� +308=璀﹀憡锛佹椂鏁堟�у父寮�鍒犻櫎澶辫触銆� +309=鏃舵晥鎬у父寮�鍒犻櫎澶辫触锛岀户缁�滃父寮�妯″紡鈥濊鍓嶅線闂ㄩ攣鐢ㄦ埛鐣岄潰璁剧疆; + 5097=鍙栨秷 5098=纭畾 @@ -1744,7 +1743,7 @@ 16034=闂厜鐏� 16035=鎴块棿鐨勫唴瀹瑰湪姝ゅ鏄剧ず 16036=鎴戠煡閬撲簡 -16037=鍒嗕韩鏁版嵁宸茬粡鍙樻洿,璇烽噸鏂扮櫥闄� +16037=鍒嗕韩鏁版嵁宸茬粡鍙樻洿,璇烽噸鏂扮櫥褰� 16038=宸ヤ綔妯″紡 16039=鎺у埗妯″紡 16040=瑙﹀彂妯″紡 @@ -1801,7 +1800,7 @@ 16091=甯稿紑妯″紡鎵嬪姩寮�鍚� 16092=甯稿紑妯″紡鎵嬪姩鍙栨秷 16093=甯稿紑妯″紡鍚敤{0}灏忔椂 -16094=鎮ㄧ殑鏉冮檺宸茬粡鍙樻洿,璇烽噸鏂扮櫥闄� +16094=鎮ㄧ殑鏉冮檺宸茬粡鍙樻洿,璇烽噸鏂扮櫥褰� 16095=鎴戝凡闃呰骞跺悓鎰� 16096=闅愮鏉冩斂绛� 16097=鍜� diff --git a/ZigbeeApp/Home.Ios/Resources/Language.ini b/ZigbeeApp/Home.Ios/Resources/Language.ini index c810653..05fabd8 100755 --- a/ZigbeeApp/Home.Ios/Resources/Language.ini +++ b/ZigbeeApp/Home.Ios/Resources/Language.ini @@ -312,7 +312,7 @@ 307=璀﹀憡锛佹椂鏁堟�у父寮�鍏抽棴闂ㄩ攣鍔熻兘澶辫触锛岃鎵嬪姩鍙栨秷甯稿紑妯″紡銆� 308=璀﹀憡锛佹椂鏁堟�у父寮�鍒犻櫎澶辫触銆� 309=鏃舵晥鎬у父寮�鍒犻櫎澶辫触锛岀户缁�滃父寮�妯″紡鈥濊鍓嶅線闂ㄩ攣鐢ㄦ埛鐣岄潰璁剧疆; - +310=璇疯緭鍏ュ悎娉曠殑鏁板瓧 5097=鍙栨秷 5098=纭畾 @@ -1743,7 +1743,7 @@ 16034=闂厜鐏� 16035=鎴块棿鐨勫唴瀹瑰湪姝ゅ鏄剧ず 16036=鎴戠煡閬撲簡 -16037=鍒嗕韩鏁版嵁宸茬粡鍙樻洿,璇烽噸鏂扮櫥闄� +16037=鍒嗕韩鏁版嵁宸茬粡鍙樻洿,璇烽噸鏂扮櫥褰� 16038=宸ヤ綔妯″紡 16039=鎺у埗妯″紡 16040=瑙﹀彂妯″紡 @@ -1800,7 +1800,7 @@ 16091=甯稿紑妯″紡鎵嬪姩寮�鍚� 16092=甯稿紑妯″紡鎵嬪姩鍙栨秷 16093=甯稿紑妯″紡鍚敤{0}灏忔椂 -16094=鎮ㄧ殑鏉冮檺宸茬粡鍙樻洿,璇烽噸鏂扮櫥闄� +16094=鎮ㄧ殑鏉冮檺宸茬粡鍙樻洿,璇烽噸鏂扮櫥褰� 16095=鎴戝凡闃呰骞跺悓鎰� 16096=闅愮鏉冩斂绛� 16097=鍜� diff --git a/ZigbeeApp/Shared/Common/CommonPage.cs b/ZigbeeApp/Shared/Common/CommonPage.cs index 3168270..684ca0d 100755 --- a/ZigbeeApp/Shared/Common/CommonPage.cs +++ b/ZigbeeApp/Shared/Common/CommonPage.cs @@ -57,7 +57,7 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string CodeIDString = "1.0.20041501"; + public static string CodeIDString = "1.0.20041601"; /// <summary> /// 娉ㄥ唽鏉ユ簮(0:HDL On 1:Zigbee) /// </summary> diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs old mode 100755 new mode 100644 index 0f8e7c2..15dcb3c --- a/ZigbeeApp/Shared/Common/Device.cs +++ b/ZigbeeApp/Shared/Common/Device.cs @@ -115,7 +115,7 @@ { CommonDevice device = null; //鍙嶅簭鍒楀寲涓烘寚瀹氱殑绫伙紝涓嶇劧鏁版嵁浼氫涪澶辫�屽鑷存棤娉曞己杞� - try + try { device = CommonDevice.CommonDeviceByFilePath(file); } @@ -1766,6 +1766,14 @@ info.ConcreteType = DeviceConcreteType.Sensor_Humidity; } info.ObjectTypeNameId = 60000;//浼犳劅鍣� + } + //14鏂伴璁惧 + else if (dicType.ContainsKey(DeviceType.FreshAir) == true) + { + info.ConcreteTextId = R.MyInternationalizationString.DeviceModelId2310; + info.BeloneType = DeviceBeloneType.A鏂伴; + info.ConcreteType = DeviceConcreteType.Relay_FangyueFreshAirModul; + info.ObjectTypeNameId = 60011;//鏂伴 } int value = (int)info.BeloneType; @@ -2024,8 +2032,8 @@ list.Add(DeviceBeloneType.A浼犳劅鍣�); //鍏朵粬鐨勭湅鐫�鍔炲憲,閮芥槸鎺掑湪鍚庨潰鐨�,閮藉綊涓鸿繖涓睘鎬� - list.Add(DeviceBeloneType.A鏈煡璁惧); - + list.Add(DeviceBeloneType.A鏈煡璁惧); + return list; } @@ -2826,9 +2834,9 @@ /// <summary> /// 鏂规偊鏂伴灏忔ā鍧� 闀滃儚id锛�2310 /// </summary> - Relay_FangyueFreshAirModul = 2310, - - //=========鈽呪槄璋冨厜鍣ㄧ被(2500-2799)鈽呪槄========= + Relay_FangyueFreshAirModul = 2310, + + //=========鈽呪槄璋冨厜鍣ㄧ被(2500-2799)鈽呪槄========= /// <summary> /// 璋冨厜鍣� /// </summary> @@ -3002,7 +3010,11 @@ /// <summary> /// 骞叉帴鐐� /// </summary> - A骞叉帴鐐� = 16 + A骞叉帴鐐� = 16, + /// <summary> + /// 鏂伴 + /// </summary> + A鏂伴 = 17 } #endregion diff --git a/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll b/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll index 2a3572b..af11f1d 100755 --- a/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll +++ b/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll Binary files differ diff --git a/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.TBL.dll b/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.TBL.dll index 9a322f6..083b92e 100755 --- a/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.TBL.dll +++ b/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.TBL.dll Binary files differ diff --git a/ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs b/ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs old mode 100755 new mode 100644 index 6af7fad..913be70 --- a/ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs +++ b/ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs @@ -476,7 +476,16 @@ var listDevice = new List<CommonDevice>(); for (int i = 0; i < rowInfo.listDeviceKeys.Count; i++) { - var device = LocalDevice.Current.GetDevice(rowInfo.listDeviceKeys[i]); + var device = LocalDevice.Current.GetDevice(rowInfo.listDeviceKeys[i]); + + //鑾峰彇璁惧绫诲瀷鐨� + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); + //鏂伴闈㈡澘涓嬬殑鍥炶矾涓嶆樉绀猴紝锛堝鏂伴銆佹俯/婀垮害浼犳劅鍣ㄥ垯涓嶆樉绀猴級 + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) + { + continue; + } + if (device != null) { listDevice.Add(device); @@ -511,6 +520,11 @@ } //绌鸿皟 else if (device.Type == DeviceType.Thermostat) + { + cardContr = new Controls.DeviceAcRowControl(listView.rowSpace / 2); + } + // 鏂伴 + else if (device.Type == DeviceType.FreshAir) { cardContr = new Controls.DeviceAcRowControl(listView.rowSpace / 2); } @@ -611,21 +625,43 @@ } var dicSceneContr = new Dictionary<int, SceneCategoryView>(); - var listview = new VerticalListControl(); - functionSceneBodyView.AddChidren(listview); + //涓讳汉锛岀鐞嗗憳涓撶敤鍒锋柊鎺т欢 + VerticalListRefreshControl listview1 = null; + //鎴愬憳涓撶敤涓嶈兘鍒锋柊鐨勬帶浠� + VerticalListControl listview2 = null; + //if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2) + //{ + // listview1 = new VerticalListRefreshControl(); + // functionSceneBodyView.AddChidren(listview1); + //} + //else + { + listview2 = new VerticalListControl(); + functionSceneBodyView.AddChidren(listview2); + } + foreach (var scene in listScene) { //鍦烘櫙鍗$墖鎺т欢 var sceneView = new SceneCategoryView(); - listview.AddChidren(sceneView); + listview1?.AddChidren(sceneView); + listview2?.AddChidren(sceneView); sceneView.InitControl(scene, room); dicSceneContr[scene.Id] = sceneView; } HdlThreadLogic.Current.RunThread(() => { - //鑾峰彇鍏ㄩ儴鍦烘櫙鐨勫欢鏃舵椂闂� - this.GetAllDelayScene(dicSceneContr, listview); + if (listview1 != null) + { + //鑾峰彇鍏ㄩ儴鍦烘櫙鐨勫欢鏃舵椂闂� + this.GetAllDelayScene(dicSceneContr, listview1); + } + else + { + //鑾峰彇鍏ㄩ儴鍦烘櫙鐨勫欢鏃舵椂闂� + this.GetAllDelayScene(dicSceneContr, listview2); + } }, ShowErrorMode.NO); } @@ -633,7 +669,7 @@ /// 鑾峰彇鍏ㄩ儴鍦烘櫙鐨勫欢鏃舵椂闂� /// </summary> /// <param name="dicSceneContr"></param> - private async void GetAllDelayScene(Dictionary<int, SceneCategoryView> dicSceneContr, VerticalListControl listview) + private async void GetAllDelayScene(Dictionary<int, SceneCategoryView> dicSceneContr, ViewGroup listview) { //璇诲彇鍏ㄩ儴鐨勫欢鏃舵椂闂� var result = await Scene.CatDelaySceneAsync(); diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs index 79ba027..7c8bd89 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs @@ -262,7 +262,10 @@ var accounts = new Dictionary<string, string>(); accounts.Add("Type", "1"); accounts.Add("Account", Config.Instance.Guid); - accounts.Add("AccountName",accountName); + accounts.Add("AccountName",accountName); + ///mac+绔彛鏄负璇嗗埆鏄偅涓棬閿�; + accounts.Add("MacAddr", Send.CurrentDoorLock.DeviceAddr); + accounts.Add("Epoint", Send.CurrentDoorLock.DeviceEpoint.ToString()); accounts.Add("UserId", userId); if (SelectedDeviceStatuscondition != "") { diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs index c4efc33..1c697dd 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs @@ -85,7 +85,14 @@ } bool yes = false; for (int a = 0; a < logic.Accounts.Count; a++) - { + { + if (logic.Accounts[a]["MacAddr"].ToString() != Send.CurrentDoorLock.DeviceAddr && logic.Accounts[a]["Epoint"].ToString() != Send.CurrentDoorLock.DeviceEpoint.ToString()) + { + //鏌ユ壘鏄惁鏄偅涓棬閿侊紱 + //濡傛灉涓嶆槸璇ラ棬閿佽仈鍔ㄤ簨浠朵笉鏄剧ず鍑烘潵; + yes = false; + break; + } if (logic.Accounts[a]["Account"].ToString() == Config.Instance.Guid) { //鏌ユ壘鑷繁璐﹀彿涓嬬殑鍒涘缓鑱斿姩浜嬩欢锛� diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs old mode 100644 new mode 100755 index f0cc373..d06d4eb --- a/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs @@ -67,7 +67,7 @@ Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray()); } //璇诲彇绯荤粺褰撳墠鏃堕棿锛氭椂-鍒� - //璇诲彇绯荤粺褰撳墠鏃堕棿锛氭椂-鍒� + //璇诲彇绯荤粺褰撳墠鏃堕棿锛氭椂-鍒� var h = DateTime.Now.ToString("HH"); var m = DateTime.Now.ToString("mm"); Dictionary<string, string> timeConditionsInfo = new Dictionary<string, string>(); @@ -345,9 +345,9 @@ /// 鍔犺浇鑷姩鍖栧垪琛ㄧ晫闈� /// </summary> /// <param name="refresview">Refresview.</param> - - static RowLayout selectedRow = new RowLayout() { Tag = "0" };//璁板綍宸︽粦鐘舵�� - + + static RowLayout selectedRow = new RowLayout() { Tag="0"};//璁板綍宸︽粦鐘舵�� + private static async void Automationview(VerticalRefreshLayout refresview, bool no) { refresview.RemoveAll(); @@ -438,7 +438,7 @@ //瀹炵幇android鏄剧ず閫昏緫鍒楄〃鐨勫渾瑙�; fLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); logicRowlayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); - + } i++; var logicnameBtn = new Button @@ -763,14 +763,14 @@ } return false;//琛ㄧず娣诲姞澶辫触; - } - - ///<summary> - /// s-one闂ㄩ攣鏄惁瀛樺湪鑷姩鍖栫殑鏂规硶; - /// 娉ㄦ剰锛堝弬鏁�2锛�3锛夛細valueInt=3鏄垹闄よ缃け鏁堟椂闂磋嚜鍔ㄥ寲锛泇alueInt=2鍒ゆ柇鏄惁瀛樺湪鑷姩鍖栵紱 - /// 杩斿洖鍊硷細0涓嶅瓨鍦�;1瀛樺湪;2鍒犻櫎鎴愬姛;3鍒犻櫎澶辫触; - /// </summary> - public static async System.Threading.Tasks.Task<int> Exist(int valueInt = 2) + } + + ///<summary> + /// s-one闂ㄩ攣鏄惁瀛樺湪鑷姩鍖栫殑鏂规硶; + /// 娉ㄦ剰锛堝弬鏁�2锛�3锛夛細valueInt=3鏄垹闄よ缃け鏁堟椂闂磋嚜鍔ㄥ寲锛泇alueInt=2鍒ゆ柇鏄惁瀛樺湪鑷姩鍖栵紱 + /// 杩斿洖鍊硷細0涓嶅瓨鍦�;1瀛樺湪;2鍒犻櫎鎴愬姛;3鍒犻櫎澶辫触; + /// </summary> + public static async System.Threading.Tasks.Task<int> Exist(int valueInt = 2) { int exist = 0; var Idlist = await Send.GetLogicId(valueInt); @@ -781,27 +781,27 @@ for (int i = 0; i < Idlist.Count; i++) { //valueInt=3涓�鏉$壒娈婄殑鑷姩鍖�(鐢ㄦ潵璁剧疆澶辨晥鏃堕棿) - var d = await Send.DelLogic(Idlist[i]); - if (d != 0) - { - //鍒犻櫎鎴愬姛 - exist = 2; - } - else - { - //鍒犻櫎澶辫触 - exist = 3; - } - return exist; + var d=await Send.DelLogic(Idlist[i]); + if (d == 0) + { + //鍒犻櫎鎴愬姛 + exist = 2; + } + else + { + //鍒犻櫎澶辫触 + exist = 3; + } + return exist; - } - } + } + } exist = 1; } return exist; } - + } } diff --git a/ZigbeeApp/Shared/Phone/MainPage/DeviceDetailInfoForm.cs b/ZigbeeApp/Shared/Phone/MainPage/DeviceDetailInfoForm.cs index 5512a41..3f52cff 100755 --- a/ZigbeeApp/Shared/Phone/MainPage/DeviceDetailInfoForm.cs +++ b/ZigbeeApp/Shared/Phone/MainPage/DeviceDetailInfoForm.cs @@ -319,6 +319,7 @@ var title = Language.StringByID(R.MyInternationalizationString.uSelectFunctionType); var form = new BottomItemSelectForm(); + form.SelectRowCanCancel = false;//閫夋嫨鐨勪笉鑳藉彇娑� form.AddForm(title, listText, nowSelectNo); form.FinishSelectEvent += (selectNo) => { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs index 09af164..fbc6aeb 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs @@ -19,6 +19,14 @@ /// 鍓嶅洖閫夋嫨鐨勬帶浠� /// </summary> private NormalSelectControl oldSelectContr = null; + /// <summary> + /// 閫夋嫨鍙栨秷(涓嶆槸宸︿笂瑙�),骞朵笖鎸変笅纭畾閿椂,鏄惁璋冪敤鍥炶皟鍑芥暟(璋冪敤鏃朵紶閫掔殑鍙傛暟鏄� -1,榛樿涓嶅洖璋�) + /// </summary> + public bool CancelCallEvent = false; + /// <summary> + /// 閫夋嫨鐨勮鑳藉惁鍙栨秷 + /// </summary> + public bool SelectRowCanCancel = true; #endregion @@ -111,6 +119,11 @@ //鍥炶皟鍑芥暟 FinishSelectEvent.Invoke(Convert.ToInt32(oldSelectContr.MainKeys)); } + else if (FinishSelectEvent != null && this.CancelCallEvent == true) + { + //鍥炶皟鍑芥暟 + FinishSelectEvent.Invoke(-1); + } this.CloseForm(); }; @@ -138,8 +151,12 @@ //鍙栨秷閫夋嫨 if (btnRow.IsSelected == true) { - btnRow.IsSelected = false; - oldSelectContr = null; + //鍏佽鍙栨秷鐨勬椂鍊�,鎵嶈兘鍙栨秷 + if (this.SelectRowCanCancel == true) + { + btnRow.IsSelected = false; + oldSelectContr = null; + } return; } if (oldSelectContr != null) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs index 1cbd2ab..99c9608 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs @@ -88,7 +88,7 @@ var pra2 = new AddDoorPra(); pra2.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); pra2.DoorLockId = i_doorLock.DeviceAddr + "_" + i_doorLock.DeviceEpoint; - var result2 = await UserCenterLogic.GetResponseDataByRequestHttps("DoorLock/AddDoorLock", true, pra, listCheck); + var result2 = await UserCenterLogic.GetResponseDataByRequestHttps("DoorLock/AddDoorLock", true, pra2, listCheck); //浜戠鏄洿鎺ヨ繑鍥炲垱寤虹殑涓婚敭瀛楃涓� return result2; } @@ -122,6 +122,10 @@ /// 甯稿紑鎸佺画鏃堕棿(1~72灏忔椂 OtherOpenLockMode=9003鐨勬椂鍊欐湁鏁�) /// </summary> public string NormallyOpenContinuedTime = string.Empty; + /// <summary> + /// 寮�閿佹椂闂�(鍘嗗彶璁板綍鐨勬椂闂碏rom-To妫�绱㈢殑瀵硅薄) + /// </summary> + public string UnlockTime = DateTime.UtcNow.ToString(); } /// <summary> @@ -184,6 +188,10 @@ /// 鍏朵粬寮�閿佹柟寮� 鍥哄畾9000 /// </summary> public int OpenLockMode = 9000; + /// <summary> + /// 褰曞叆鏃堕棿 + /// </summary> + public string EntryTime = DateTime.Now.ToString(); } /// <summary> diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs index 798ab93..bd3a852 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs @@ -1018,9 +1018,11 @@ if (strData != null) { listFloorSort = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(strData); - } - foreach (string keys in Common.Config.Instance.Home.FloorDics.Keys) - { + } + + + foreach (string keys in Common.Config.Instance.Home.FloorDics.Keys) + { if (listFloorSort != null) { if (listFloorSort.Contains(keys) == false) @@ -1029,9 +1031,10 @@ listFloorSort.Add(keys); } } - } - - var dic = new Dictionary<string, string>(); + + } + + var dic = new Dictionary<string, string>(); if (listFloorSort != null) { for (int i = 0; i < listFloorSort.Count; i++) @@ -1042,7 +1045,6 @@ } } } - //淇濆瓨椤哄簭 UserCenterLogic.SaveFileContent(fullName, listFloorSort); return dic; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs old mode 100755 new mode 100644 index cdbc6d0..ccccd7c --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs @@ -102,20 +102,20 @@ { RemoveFromParent(); }; - this.btnTitle.Width = Application.GetRealWidth(1080 - 161 - 200 - 58); + this.btnTitle.Width = Application.GetRealWidth(1080 - 161 - 300); this.btnBack.MouseUpEventHandler += eHandlerBack; this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; this.MidFrameLayout(this); var btnAddFrameLayout = new FrameLayout { - X = Application.GetRealWidth(830), + X = Application.GetRealWidth(619), }; this.titleFrameLayout.AddChidren(btnAddFrameLayout); btnFloorText = new Button { - Width = Application.GetRealWidth(110), + Width = Application.GetRealWidth(300 - 69 - 58), X = Application.GetRealWidth(15), Text = Language.StringByID(R.MyInternationalizationString.FirstFloor), TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, @@ -125,32 +125,40 @@ }; btnAddFrameLayout.AddChidren(btnFloorText); + var btnBindDownFrameLayout = new FrameLayout + { + Width = Application.GetMinReal(69 + 58), + X = Application.GetRealWidth(300 - 69 - 58), + }; + btnAddFrameLayout.AddChidren(btnBindDownFrameLayout); + var btnBindDown = new Button { Height = Application.GetMinReal(69), Width = Application.GetMinReal(69), - X = Application.GetRealWidth(200 - 77), UnSelectedImagePath = "BindPic/BindDown.png", Gravity = Gravity.CenterVertical, }; - btnAddFrameLayout.AddChidren(btnBindDown); + btnBindDownFrameLayout.AddChidren(btnBindDown); if (Common.Config.Instance.Home.FloorDics.Count == 0) { btnBindDown.Visible = false; } - btnBindDown.MouseDownEventHandler += (sender, e) => + EventHandler<MouseEventArgs> eHandlerBindDown = (sender, e) => { SideslipFramelayout(); }; + btnBindDown.MouseDownEventHandler += eHandlerBindDown; + btnBindDownFrameLayout.MouseDownEventHandler += eHandlerBindDown; if (Common.Config.Instance.Home.FloorDics.Count == 0) { btnAddFrameLayout.Width = 0; } else { - btnAddFrameLayout.Width = Application.GetRealWidth(200); + btnAddFrameLayout.Width = Application.GetRealWidth(300); } MidFrameLayoutContent(btnFloorText); } @@ -733,7 +741,6 @@ var sidelipFrameLayout = new FrameLayout() { - Height = Application.GetMinReal(783), Width = Application.GetMinReal(449), Y = Application.GetRealHeight(161), X = Application.GetRealWidth(596), @@ -758,17 +765,19 @@ var sidelipVerticalScrolViewLayout = new VerticalScrolViewLayout() { Height = Application.GetRealHeight(600), - Y = btnSelectFloor.Bottom, + Y = btnSelectFloor.Bottom + Application.GetRealHeight(45), }; sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout); Button oldbutton = null; Button oldbuttonText = null; + int count = 0; foreach (var floorId in dicFloor.Keys) { + count++; var rowFrameLayout = new RowLayout() { - Height = Application.GetRealHeight(150), + Height = Application.GetRealHeight(152), LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine, X = Application.GetRealWidth(81), }; @@ -778,7 +787,7 @@ { Width = Application.GetMinReal(81), Height = Application.GetMinReal(81), - Y = Application.GetRealHeight(55), + Gravity = Gravity.CenterVertical, UnSelectedImagePath = "Floor/Floor.png", SelectedImagePath = "Floor/FloorSelected.png", }; @@ -789,7 +798,7 @@ Width = Application.GetRealWidth(311), Height = Application.GetRealHeight(58), X = Application.GetRealWidth(92), - Y = Application.GetRealHeight(69), + Gravity = Gravity.CenterVertical, TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, TextSize = 14, TextAlignment = TextAlignment.CenterLeft, @@ -860,6 +869,19 @@ rowFrameLayout.MouseUpEventHandler += hander; btnMethodText.MouseUpEventHandler += hander; } + + if (count == 0) + { + sidelipFrameLayout.Height = 0; + } + else if (count <= 4 && count > 0) + { + sidelipFrameLayout.Height = Application.GetRealHeight(180) + count * Application.GetRealHeight(150); + } + else + { + sidelipFrameLayout.Height = Application.GetMinReal(780); + } } } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs old mode 100755 new mode 100644 index 72394ac..52eb782 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs @@ -75,20 +75,20 @@ { RemoveFromParent(); }; - this.btnTitle.Width = Application.GetRealWidth(1080 - 161 - 200 - 58); + this.btnTitle.Width = Application.GetRealWidth(1080 - 161 - 300); this.btnBack.MouseUpEventHandler += eHandlerBack; this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; this.MidFrameLayout(this); var btnAddFrameLayout = new FrameLayout { - X = Application.GetRealWidth(830), + X = Application.GetRealWidth(619), }; this.titleFrameLayout.AddChidren(btnAddFrameLayout); btnFloorText = new Button { - Width = Application.GetRealWidth(110), + Width = Application.GetRealWidth(300 - 69 - 58), X = Application.GetRealWidth(15), Text = Language.StringByID(R.MyInternationalizationString.FirstFloor), TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, @@ -98,26 +98,36 @@ }; btnAddFrameLayout.AddChidren(btnFloorText); + var btnBindDownFrameLayout = new FrameLayout + { + Width = Application.GetMinReal(69 + 58), + X = Application.GetRealWidth(300 - 69 - 58), + }; + btnAddFrameLayout.AddChidren(btnBindDownFrameLayout); + var btnBindDown = new Button { Height = Application.GetMinReal(69), Width = Application.GetMinReal(69), - X = Application.GetRealWidth(200 - 77), UnSelectedImagePath = "BindPic/BindDown.png", Gravity = Gravity.CenterVertical, }; - btnAddFrameLayout.AddChidren(btnBindDown); - btnBindDown.MouseDownEventHandler += (sender, e) => + btnBindDownFrameLayout.AddChidren(btnBindDown); + + EventHandler<MouseEventArgs> eHandlerBindDown = (sender, e) => { SideslipFramelayout(); }; + btnBindDown.MouseDownEventHandler += eHandlerBindDown; + btnBindDownFrameLayout.MouseDownEventHandler += eHandlerBindDown; + if (Common.Config.Instance.Home.FloorDics.Count == 0) { btnAddFrameLayout.Width = 0; } else { - btnAddFrameLayout.Width = Application.GetRealWidth(200); + btnAddFrameLayout.Width = Application.GetRealWidth(300); } MidFrameLayoutContent(btnFloorText); } @@ -362,18 +372,7 @@ var dev = new AddedDeviceBindResponseAllData(); dev = await currentKey.AddDeviceBindAsync(addBindeDev); - if (dev.addedDeviceBindResponseData == null) - { - Application.RunOnMainThread(() => - { - CommonPage.Loading.Hide(); - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); - }); - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - return; - } - else + if (dev != null && dev.addedDeviceBindResponseData != null) { if (dev.addedDeviceBindResponseData.Result == 0) { @@ -433,6 +432,17 @@ btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; return; } + } + else + { + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); + }); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + return; } } } @@ -761,7 +771,6 @@ var sidelipFrameLayout = new FrameLayout() { - Height = Application.GetMinReal(783), Width = Application.GetMinReal(449), Y = Application.GetRealHeight(161), X = Application.GetRealWidth(596), @@ -786,17 +795,19 @@ var sidelipVerticalScrolViewLayout = new VerticalScrolViewLayout() { Height = Application.GetRealHeight(600), - Y = btnSelectFloor.Bottom, + Y = btnSelectFloor.Bottom + Application.GetRealHeight(45), }; sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout); Button oldbutton = null; Button oldbuttonText = null; + int count = 0; foreach (var floorId in dicFloor.Keys) { + count++; var rowFrameLayout = new RowLayout() { - Height = Application.GetRealHeight(150), + Height = Application.GetRealHeight(152), LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine, X = Application.GetRealWidth(81), }; @@ -806,7 +817,7 @@ { Width = Application.GetMinReal(81), Height = Application.GetMinReal(81), - Y = Application.GetRealHeight(55), + Gravity = Gravity.CenterVertical, UnSelectedImagePath = "Floor/Floor.png", SelectedImagePath = "Floor/FloorSelected.png", }; @@ -817,7 +828,7 @@ Width = Application.GetRealWidth(311), Height = Application.GetRealHeight(58), X = Application.GetRealWidth(92), - Y = Application.GetRealHeight(69), + Gravity = Gravity.CenterVertical, TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, TextSize = 14, TextAlignment = TextAlignment.CenterLeft, @@ -898,6 +909,19 @@ rowFrameLayout.MouseUpEventHandler += hander; btnMethodText.MouseUpEventHandler += hander; } + + if (count == 0) + { + sidelipFrameLayout.Height = 0; + } + else if (count <= 4 && count > 0) + { + sidelipFrameLayout.Height = Application.GetRealHeight(180) + count * Application.GetRealHeight(150); + } + else + { + sidelipFrameLayout.Height = Application.GetMinReal(780); + } } /// <summary> diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindCommonLayout.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindCommonLayout.cs old mode 100755 new mode 100644 index 49fbae3..d0b4550 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindCommonLayout.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindCommonLayout.cs @@ -13,6 +13,7 @@ #region 鈼� 鍙橀噺鐢虫槑__________________________ public FrameLayout topFrameLayout = new FrameLayout { Height = Application.GetRealHeight(184), BackgroundColor = ZigbeeColor.Current.XMTopFrameLayout }; public FrameLayout midFrameLayout = new FrameLayout { Height = Application.GetRealHeight(1925 - 184), BackgroundColor = ZigbeeColor.Current.XMMidFrameLayout }; + public FrameLayout bottomRadiusFrameLayout = new FrameLayout() { Height = Application.GetRealHeight(100), @@ -20,35 +21,47 @@ Radius = 17, BackgroundColor = ZigbeeColor.Current.XMWhite, }; + public FrameLayout titleFrameLayout = new FrameLayout { Y = Application.GetRealHeight(92), + X = Application.GetRealWidth(161), + Width = Application.GetRealWidth(1080 - 161),//919 Height = Application.GetRealHeight(69), }; public Button btnTitle = new Button { TextAlignment = TextAlignment.CenterLeft, TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText, - X = Application.GetRealWidth(161), - Width = Application.GetRealWidth(1080 - 161), + Width = Application.GetRealWidth(1080 - 161),//919 Height = Application.GetRealWidth(69), - IsBold = true, TextSize = 17, + IsBold = true, + //X = Application.GetRealWidth(161 - 116), }; + /// <summary> + /// 鏍囬杩斿洖甯冨眬 + /// </summary> public FrameLayout btnBackFrameLayout = new FrameLayout { - X = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - Width = Application.GetRealWidth(58), + Width = Application.GetRealWidth(58 * 2),//116 }; + /// <summary> + /// 鏍囬杩斿洖鎸夐敭 + /// </summary> public Button btnBack = new Button { - Height = Application.GetMinReal(51), - Width = Application.GetMinReal(30), + Height = Application.GetRealHeight(51), + Width = Application.GetRealWidth(30), + X = Application.GetRealWidth(58), + Y = Application.GetRealHeight(98), UnSelectedImagePath = "DoorLock/Left.png", }; + /// <summary> + /// 鏍囬涓嬬嚎 + /// </summary> public Button btnTitleLine = new Button { Y = Application.GetRealHeight(181), @@ -58,18 +71,18 @@ #endregion /// <summary> - /// 闂ㄩ攣椤堕儴甯冨眬 + /// 椤堕儴甯冨眬 /// </summary> /// <param name="frameLayout"></param> public void TopFrameLayout(FrameLayout frameLayout, string titleText) { this.AddChidren(topFrameLayout); + topFrameLayout.AddChidren(btnBackFrameLayout); topFrameLayout.AddChidren(titleFrameLayout); topFrameLayout.AddChidren(btnTitleLine); + btnBackFrameLayout.AddChidren(btnBack); titleFrameLayout.AddChidren(btnTitle); btnTitle.Text = titleText; - titleFrameLayout.AddChidren(btnBackFrameLayout); - btnBackFrameLayout.AddChidren(btnBack); } /// <summary> /// 闂ㄩ攣涓儴甯冨眬 diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs old mode 100755 new mode 100644 index b0f791b..14d3e84 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs @@ -246,7 +246,7 @@ var btnAddFrameLayout = new FrameLayout() { - X = Application.GetRealWidth(888), + X = Application.GetRealWidth(772 - 58), Width = Application.GetRealWidth(192), }; this.titleFrameLayout.AddChidren(btnAddFrameLayout); @@ -352,6 +352,7 @@ InitListInfo(); } + /// <summary> /// 涓儴甯冨眬 /// </summary> @@ -490,6 +491,10 @@ { btnFloorRoomNameText = myName; } + else + { + btnFloorRoomNameText = Language.StringByID(R.MyInternationalizationString.Undistributed); + } } } else @@ -512,11 +517,25 @@ var tempDevFloorName = Common.Config.Instance.Home.GetFloorNameById(tempDevFloorId); if (string.IsNullOrEmpty(tempDevFloorName)) { - btnFloorRoomNameText = tempDevRoomName; + if (string.IsNullOrEmpty(tempDevRoomName)) + { + btnFloorRoomNameText = Language.StringByID(R.MyInternationalizationString.Undistributed); + } + else + { + btnFloorRoomNameText = tempDevRoomName; + } } else { - btnFloorRoomNameText = tempDevFloorName + "," + tempDevRoomName; + if (string.IsNullOrEmpty(tempDevRoomName)) + { + btnFloorRoomNameText = Language.StringByID(R.MyInternationalizationString.Undistributed); + } + else + { + btnFloorRoomNameText = tempDevFloorName + "," + tempDevRoomName; + } } } @@ -640,10 +659,10 @@ else { var temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Default); - if (temp.setWritableValueResponData?.Status != 0) + if (temp != null && temp.setWritableValueResponData?.Status != 0) { var temp1 = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Default); - if (temp1.setWritableValueResponData?.Status != 0) + if (temp1 != null && temp1.setWritableValueResponData?.Status != 0) { new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ChangeBindMode), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); } @@ -739,8 +758,10 @@ } } + int count = 0; foreach (var value in typeModeList) { + count++; #region rowView var rowView = new FrameLayout() { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs index 2028413..7fd5ff7 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs @@ -244,18 +244,7 @@ var dev = new AddedDeviceBindResponseAllData(); dev = await currentKey.AddDeviceBindAsync(addBindeDev); - if (dev != null || dev.addedDeviceBindResponseData == null) - { - Application.RunOnMainThread(() => - { - CommonPage.Loading.Hide(); - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); - }); - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - return; - } - else + if (dev != null && dev.addedDeviceBindResponseData != null) { if (dev.addedDeviceBindResponseData.Result == 0) { @@ -318,6 +307,17 @@ return; } } + else + { + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); + }); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + return; + } } else { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs index 3a52b0e..b38dd82 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs @@ -150,6 +150,10 @@ { device.IconPath = "Device/Light.png"; } + else + { + device.IconPath = "Device/RelayEpoint.png"; + } device.ReSave(); } this.CloseProgressBar(); @@ -338,10 +342,19 @@ var title = Language.StringByID(R.MyInternationalizationString.uSelectFunctionType); var form = new BottomItemSelectForm(); + form.CancelCallEvent = true;//鍏佽鍙栨秷 form.AddForm(title, listText, nowSelectNo); form.FinishSelectEvent += (selectNo) => { - btnFunction.Text = listText[selectNo]; + if (selectNo == -1) + { + //鍙栨秷閫夋嫨 + btnFunction.Text = string.Empty; + } + else + { + btnFunction.Text = listText[selectNo]; + } nowSelectNo = selectNo; //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨� if (selectNo == 0) @@ -352,10 +365,14 @@ { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鐏厜; } - else + else if (selectNo == 2) { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鎻掑骇; } + else + { + dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鏈畾涔�; + } }; }; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs old mode 100755 new mode 100644 index 0dc5e74..c20f9e1 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs @@ -446,10 +446,19 @@ } //鏂伴闈㈡澘 else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir) - { - //鏂规偊鏂伴闈㈡澘鐨勬寜閿厤缃� - var form = new DevicePanel.PanelFangyueFreshAirButtonSettionForm(); - form.AddForm(device); + { + //鏂规偊鏂伴闈㈡澘鐨勬寜閿厤缃� + //骞叉帴鐐� + if (device.Type == DeviceType.FreshAir) + { + var form = new DevicePanel.PanelFangyueFreshAirButtonSettionForm(); + form.AddForm(device); + } + else + { + var form = new DeviceFunctionSettionForm(); + form.AddForm(device, true); + } } //鏂规偊闈㈡澘 else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueTwo diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs old mode 100755 new mode 100644 index 4865485..be8c916 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs @@ -141,7 +141,7 @@ //閫夋嫨鏈垎閰嶆椂,娓呯┖ if (roomKeys == string.Empty) { listCheck = new List<string>(); } foreach (var device in this.listNewDevice) - { + { if (device is OTADevice) { //閽堝鍗曠函鍙湁涓�涓�200绔偣鐨勮澶� @@ -160,10 +160,16 @@ //杩欓噷鏈夌偣鐗规畩,濡傛灉鍥炶矾娌℃湁璁剧疆鏈夊尯鍩熺殑鏃跺��,鎵嶈缃� listCheck.Add(mainKeys); HdlRoomLogic.Current.ChangedRoom(device, roomKeys); + } + else if (this.deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir + && device.Type == DeviceType.FreshAir) + { + //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欏尯鍩熻窡鐫�妯″潡涓�璧� + HdlRoomLogic.Current.ChangedRoom(device, roomKeys); } else if (listCheck.Contains(mainKeys) == true) - { - //濡傛灉杩欎釜鍥炶矾涔嬪墠閮借繕娌℃湁鍖哄煙,鍦ㄦ湰鐣岄潰杩樻病鏈夊叧闂箣鍓�,鍙互鏃犳潯浠堕殢渚垮彉鏇� + { + //濡傛灉杩欎釜鍥炶矾涔嬪墠閮借繕娌℃湁鍖哄煙,鍦ㄦ湰鐣岄潰杩樻病鏈夊叧闂箣鍓�,鍙互鏃犳潯浠堕殢渚垮彉鏇� HdlRoomLogic.Current.ChangedRoom(device, roomKeys); } } @@ -932,10 +938,19 @@ var title = Language.StringByID(R.MyInternationalizationString.uSelectFunctionType); var form = new BottomItemSelectForm(); + form.CancelCallEvent = true;//鍏佽鍙栨秷 form.AddForm(title, listText, nowSelectNo); form.FinishSelectEvent += (selectNo) => { - btnFunction.Text = listText[selectNo]; + if (selectNo == -1) + { + //閫夋嫨鍙栨秷 + btnFunction.Text = string.Empty; + } + else + { + btnFunction.Text = listText[selectNo]; + } nowSelectNo = selectNo; //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨� if (selectNo == 0) @@ -956,13 +971,22 @@ this.listNewDevice[0].IconPath = "Device/Light.png"; } } - else + else if (selectNo == 2) { this.listNewDevice[0].DfunctionType = DeviceFunctionType.A鎻掑骇; if (this.listNewDevice[0].IsCustomizeImage == false) { //閲嶆柊璁剧疆鍥剧墖 this.listNewDevice[0].IconPath = "Device/Socket1.png"; + } + } + else + { + this.listNewDevice[0].DfunctionType = DeviceFunctionType.A鏈畾涔�; + if (this.listNewDevice[0].IsCustomizeImage == false) + { + //閲嶆柊璁剧疆鍥剧墖 + this.listNewDevice[0].IconPath = "Device/Switch.png"; } } this.listNewDevice[0].ReSave(); @@ -1187,8 +1211,8 @@ private void ShowTopRightMenu() { //妫�娴嬫鍥炶矾鏄惁鎷ユ湁瀹氫綅鍔熻兘(鎷跨鐐规渶灏忕殑閭d釜鍥炶矾鍘诲畾浣�) - bool canTest = Common.LocalDevice.Current.DeviceIsCanFixedPosition(listNewDevice[0]); - + bool canTest = Common.LocalDevice.Current.DeviceIsCanFixedPosition(listNewDevice[0]); + var frame = new TopRightMenuControl(canTest == true ? 2 : 1, 1); string deviceMenu = string.Empty; if (canTest == true) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs index 082f117..620df26 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs @@ -963,7 +963,7 @@ /// <summary> /// 鍏朵粬寮�閿佹柟寮�(OpenLockMode=9000鏃舵湁鏁�) 9001:甯稿紑鎵撳紑 9002:甯稿紑鍙栨秷 9003:甯稿紑鎸佺画 /// </summary> - public int OtherOpenLockMode = -1; + public int? OtherOpenLockMode = -1; /// <summary> /// 甯稿紑鎸佺画鏃堕棿(1~72灏忔椂 OtherOpenLockMode=9003鐨勬椂鍊欐湁鏁�) /// </summary> diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs old mode 100755 new mode 100644 index bb77abd..c02ee5a --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs @@ -575,15 +575,15 @@ } //鑺傝兘妯″紡淇敼(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�) - //璁惧鍚屼簨璇撮粯璁ゅ幓绉掓椂闂达紝杩欐牱鎺ヨ繎鎰熷簲鍔熻兘鎵嶅悎鐞� - energyModeInfo.time = 1; + //鑲栧織璞粰鎸夐敭鎺у埗闈㈡澘锛堝洓寮�鍏帶锛夎澶囷紝璇撮粯璁�15绉掓椂闂达紝杩欐牱鎺ヨ繎鎰熷簲鍔熻兘鎵嶅悎鐞� + energyModeInfo.time = 15; result = await HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode(panelDevice, energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level); if (result == false) { this.CloseProgressBar(); return; } - //鎺ヨ繎淇敼(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�) + //鎺ヨ繎浼犳劅璁剧疆 (鑲栧織璞粰鎸夐敭鎺у埗闈㈡澘锛堝洓寮�鍏帶锛夎澶囷紝浼犳劅璺濈鍜岃Е鍙戝欢杩熸椂闂撮粯璁ょ敤鏈�澶у��) result = await HdlDevicePanelLogic.Current.SetProximitySensorStatus(panelDevice, proximitySensorsInfo.enable); if (result == false) { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs old mode 100755 new mode 100644 index 35dea98..572a224 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs @@ -152,12 +152,22 @@ frameBack.AddChidren(seekBar1); seekBar1.ProgressChangedEvent += (div, value) => { - btnProgress1.Text = value.ToString(); + if (value == 0) + { + btnProgress1.Text = (value + 1).ToString(); + } + else + { + btnProgress1.Text = value.ToString(); + } + switch (value) { + case 0: case 1: linghtLevelInfo.panelDirectionsLevel = 20; btnLevel.Text = "1" + strRank; + break; case 2: linghtLevelInfo.panelDirectionsLevel = 40; @@ -175,14 +185,22 @@ linghtLevelInfo.panelDirectionsLevel = 100; btnLevel.Text = "5" + strRank; break; - default: - linghtLevelInfo.panelDirectionsLevel = 0; - btnLevel.Text = "0" + strRank; - break; } }; - if (linghtLevelInfo.panelDirectionsLevel <= 20 && linghtLevelInfo.panelDirectionsLevel > 0) + seekBar1.OnStopTrackingTouchEvent += (div, value) => + { + if (value == 0) + { + seekBar1.Progress = 1; + } + else + { + seekBar1.Progress = value; + } + }; + + if (linghtLevelInfo.panelDirectionsLevel <= 20 && linghtLevelInfo.panelDirectionsLevel >= 0) { btnLevel.Text = "1" + strRank; btnProgress1.Text = "1"; @@ -214,17 +232,17 @@ } else { - btnLevel.Text = "0" + strRank; - btnProgress1.Text = "0"; - seekBar1.Progress = 0; + btnLevel.Text = "1" + strRank; + btnProgress1.Text = "1"; + seekBar1.Progress = 1; } - + var btnTemp1 = new NormalViewControl(200, 50, true); btnTemp1.X = ControlCommonResourse.XXLeft; btnTemp1.Y = Application.GetRealHeight(322); btnTemp1.TextSize = 12; btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3; - btnTemp1.Text = "0"; + btnTemp1.Text = "1"; frameBack.AddChidren(btnTemp1); var btnTemp2 = new NormalViewControl(100, 50, true); @@ -565,15 +583,15 @@ this.ShowProgressBar(); //鑺傝兘妯″紡淇敼(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�) - //璁惧鍚屼簨璇撮粯璁ゅ幓1绉掓椂闂达紝杩欐牱鎺ヨ繎鎰熷簲鍔熻兘鎵嶅悎鐞� - energyModeInfo.time = 1; + //璁惧鍚屼簨璇存柊椋庨潰鏉块粯璁�60绉掓椂闂达紝杩欐牱鎺ヨ繎鎰熷簲鍔熻兘鎵嶅悎鐞� + energyModeInfo.time = 60; var result = await HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode(panelDevice, energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level); if (result == false) { this.CloseProgressBar(); return; } - //鎺ヨ繎鎰熷簲(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�) + //鎺ヨ繎鎰熷簲(鎻愪緵璁惧鐨勫悓浜嬭闅忎究涓�涓洖璺氨琛�) result = await HdlDevicePanelLogic.Current.SetProximitySensorStatus(panelDevice, proximitySensorsInfo.enable); if (result == false) { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs index 649e8ab..fd741ba 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs @@ -1,4 +1,8 @@ 锘縰sing System; +using System.Collections.Generic; +using Org.BouncyCastle.Bcpg.OpenPgp; +using Shared.Common; +using ZigBee.Common; using ZigBee.Device; namespace Shared.Phone.UserCenter.DevicePanel @@ -18,6 +22,22 @@ /// 璁惧鐨勬煇涓�鍥炶矾 /// </summary> private CommonDevice deviceObj = null; + /// <summary> + /// 鏂伴鐩爣鍚嶅瓧 + /// </summary> + private string bindFreshAirName = string.Empty; + /// <summary> + /// 娓╁害鐩爣鍚嶅瓧 + /// </summary> + private string bindTemperatureName = string.Empty; + /// <summary> + /// 婀垮害鐩爣鍚嶅瓧 + /// </summary> + private string bindHumidityName = string.Empty; + /// <summary> + /// PM鐩爣鍚嶅瓧 + /// </summary> + private string bindPmName = string.Empty; #endregion @@ -30,6 +50,8 @@ public void ShowForm(CommonDevice i_device) { this.deviceObj = i_device; + //鑾峰彇鏁版嵁 + ReadDoorLockUserInfo(deviceObj); //璁剧疆澶撮儴淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uPanelSettion)); @@ -65,9 +87,9 @@ this.listview = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 1028); //鍒濆鍖栬彍鍗曡 - this.InitMenuRow(); - - //鍒濆鍖栨甯冨畬鎴� + this.InitMenuRow(); + + //鍒濆鍖栨甯冨畬鎴� tableContr.FinishInitControl(); tableContr = null; @@ -79,30 +101,70 @@ { //鍏抽棴鑷韩 this.CloseForm(); - }; + }; } /// <summary> /// 鍒濆鍖栬彍鍗曡 /// </summary> private void InitMenuRow() - { + { this.listview.RemoveAll(); //娣诲姞鏂伴鐩爣 this.AddFreshAirRow(); //PM2.5鏉ユ簮 - //this.AddPMRow(); + this.AddPMRow(); //娣诲姞娓╁害鏉ユ簮 - //this.AddTemperatureSensorRow(); + this.AddTemperatureSensorRow(); //娣诲姞婀垮害鏉ユ簮 - //this.AddHumiditySourceRow(); - //娣诲姞鏂伴鐩爣 - //this.AddPMRow(); + this.AddHumiditySourceRow(); //浜害璋冭妭 this.AddLevelRow(); } #endregion - + + #region 鈻� 鍒濆鍖栨暟鎹甠________________________ + + /// <summary> + /// 鍒濆鍖栨暟鎹� + /// </summary> + void ReadDoorLockUserInfo(CommonDevice curControlDev) + { + System.Threading.Tasks.Task.Run(async () => + { + try + { + Application.RunOnMainThread(() => + { + CommonPage.Loading.Start(""); + }); + + var result = await GetBindName(curControlDev); + if (!result) + { + + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); + }); + } + } + catch (Exception ex) + { + var mess = ex.Message; + } + finally + { + Application.RunOnMainThread(() => + { + this.InitMenuRow(); + CommonPage.Loading.Hide(); + }); + } + }); + } + #endregion + #region 鈻� 鏂伴鐩爣_________________________ /// <summary> /// 鏂伴鐩爣琛� @@ -116,21 +178,90 @@ //搴曠嚎 rowNewWind.AddBottomLine(); //鍙崇澶� - rowNewWind.AddRightArrow(); - var msg = Language.StringByID(R.MyInternationalizationString.nothing); - // 鍥炶皟鏂伴缁戝畾鐩爣 + rowNewWind.AddRightArrow(); + + var msg = Language.StringByID(R.MyInternationalizationString.nothing); + if (!string.IsNullOrEmpty(bindFreshAirName)) + { + msg = bindFreshAirName; + } var btnNewWindStatu = rowNewWind.AddMostRightView(msg, 700); + rowNewWind.ButtonClickEvent += (sender, e) => { - //var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, 1); - //Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); - //Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - //addDevicePage.Show(); - var form = new PanelFangyueFreshAirTargetForm(); - form.AddForm(this.deviceObj, string.Empty, 3); + var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, 1); + Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); + Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + addDevicePage.Show(); + + addDevicePage.actionFreshAirTarget += (bindName) => + { + Application.RunOnMainThread(() => + { + if (string.IsNullOrEmpty(bindName)) + { + btnNewWindStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing); + } + else + { + btnNewWindStatu.Text = bindName; + } + }); + }; + + //var form = new PanelFangyueFreshAirTargetForm(); + //form.AddForm(this.deviceObj, string.Empty, 3); }; } #endregion + + /// <summary> + /// 鑾峰彇缁戝畾鐩爣 + /// </summary> + /// <param name="curControlDev"></param> + /// <returns></returns> + private async System.Threading.Tasks.Task<bool> GetBindName(CommonDevice curDev) + { + bool result = false; + //鑾峰彇闈㈡澘涓瓨鍦ㄧ殑缁戝畾鐩爣 + FreshAir curControlDev = curDev as FreshAir; + var panelBindListRes = await curControlDev.GetDeviceBindAsync(); + if (panelBindListRes != null && panelBindListRes.getAllBindResponseData != null) + { + foreach (var bDev in panelBindListRes.getAllBindResponseData.BindList) + { + curControlDev.bindList.Add(bDev); + var device = Common.LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint); + + //鑾峰彇璁惧绫诲瀷鐨� + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); + //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) + { + continue; + } + + if (device.Type == DeviceType.FreshAir) + { + bindFreshAirName = device.DeviceEpointName; + } + if (device.Type == DeviceType.TemperatureSensor) + { + bindTemperatureName = device.DeviceEpointName; + } + if (device.Type == DeviceType.FreshAirHumiditySensor) + { + bindHumidityName = device.DeviceEpointName; + } + //if (device.Type == DeviceType.FreshAir) + //{ + // bindPmName = device.DeviceEpointName; + //} + } + result = true; + } + return result; + } #region 鈻� PM2.5鏉ユ簮_________________________ /// <summary> @@ -139,22 +270,40 @@ private void AddPMRow() { //PM2.5 - var rowNewWind = new FrameRowControl(listview.rowSpace / 2); - listview.AddChidren(rowNewWind); - rowNewWind.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.PM25Source), 600); + var rowPM = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(rowPM); + rowPM.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.PM25Source), 600); //搴曠嚎 - rowNewWind.AddBottomLine(); + rowPM.AddBottomLine(); //鍙崇澶� - rowNewWind.AddRightArrow(); + rowPM.AddRightArrow(); var msg = Language.StringByID(R.MyInternationalizationString.nothing); - // 鍥炶皟PM2.5鏉ユ簮缁戝畾鐩爣 - var btnNewWindStatu = rowNewWind.AddMostRightView(msg, 700); - rowNewWind.ButtonClickEvent += (sender, e) => + if (!string.IsNullOrEmpty(bindPmName)) + { + msg = bindPmName; + } + var btnPMStatu = rowPM.AddMostRightView(msg, 700); + rowPM.ButtonClickEvent += (sender, e) => { var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, 4); Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; addDevicePage.Show(); + + addDevicePage.actionPMTarget += (bindName) => + { + Application.RunOnMainThread(() => + { + if (string.IsNullOrEmpty(bindName)) + { + btnPMStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing); + } + else + { + btnPMStatu.Text = bindName; + } + }); + }; }; } #endregion @@ -166,22 +315,40 @@ private void AddTemperatureSensorRow() { //娓╁害鏉ユ簮 - var rowNewWind = new FrameRowControl(listview.rowSpace / 2); - listview.AddChidren(rowNewWind); - rowNewWind.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.TemperatureSource), 600); + var rowTemPerature = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(rowTemPerature); + rowTemPerature.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.TemperatureSource), 600); //搴曠嚎 - rowNewWind.AddBottomLine(); + rowTemPerature.AddBottomLine(); //鍙崇澶� - rowNewWind.AddRightArrow(); + rowTemPerature.AddRightArrow(); var msg = Language.StringByID(R.MyInternationalizationString.nothing); - // 鍥炶皟娓╁害鏉ユ簮缁戝畾鐩爣 - var btnNewWindStatu = rowNewWind.AddMostRightView(msg, 700); - rowNewWind.ButtonClickEvent += (sender, e) => + if (!string.IsNullOrEmpty(bindTemperatureName)) + { + msg = bindTemperatureName; + } + var btnTemperatureStatu = rowTemPerature.AddMostRightView(msg, 700); + rowTemPerature.ButtonClickEvent += (sender, e) => { var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, 2); Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; addDevicePage.Show(); + + addDevicePage.actionTemperatureTarget += (bindName) => + { + Application.RunOnMainThread(() => + { + if (string.IsNullOrEmpty(bindName)) + { + btnTemperatureStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing); + } + else + { + btnTemperatureStatu.Text = bindName; + } + }); + }; }; } #endregion @@ -193,22 +360,40 @@ private void AddHumiditySourceRow() { //婀垮害 - var rowNewWind = new FrameRowControl(listview.rowSpace / 2); - listview.AddChidren(rowNewWind); - rowNewWind.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.HumiditySource), 600); + var rowHumidity = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(rowHumidity); + rowHumidity.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.HumiditySource), 600); //搴曠嚎 - rowNewWind.AddBottomLine(); + rowHumidity.AddBottomLine(); //鍙崇澶� - rowNewWind.AddRightArrow(); + rowHumidity.AddRightArrow(); var msg = Language.StringByID(R.MyInternationalizationString.nothing); - // 鍥炶皟婀垮害鏉ユ簮缁戝畾鐩爣 - var btnNewWindStatu = rowNewWind.AddMostRightView(msg, 700); - rowNewWind.ButtonClickEvent += (sender, e) => + if (!string.IsNullOrEmpty(bindHumidityName)) + { + msg = bindHumidityName; + } + var btnHumidityStatu = rowHumidity.AddMostRightView(msg, 700); + rowHumidity.ButtonClickEvent += (sender, e) => { var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, 3); Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; addDevicePage.Show(); + + addDevicePage.actionHumidityTarget += (bindName) => + { + Application.RunOnMainThread(() => + { + if (string.IsNullOrEmpty(bindName)) + { + btnHumidityStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing); + } + else + { + btnHumidityStatu.Text = bindName; + } + }); + }; }; } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetForm.cs old mode 100755 new mode 100644 index 64b9ea0..df25e36 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetForm.cs @@ -6,8 +6,7 @@ { public class PanelFangyueFreshAirTargetForm : EditorCommonForm { - #region 鈻� 鍙橀噺澹版槑___________________________ - + #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> /// 鍒楄〃鎺т欢 /// </summary> @@ -308,9 +307,7 @@ //鏀堕泦鍙互鏄剧ず鐨勮澶� this.dicShowDevice[room.Id].Add(device); } - } - - + } } return canShow; } @@ -320,8 +317,7 @@ bool canShow = false; return canShow; - } - + } #endregion } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs index e2765e4..f72f4e3 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs @@ -1,6 +1,7 @@ 锘縰sing System; using System.Collections.Generic; using System.Linq.Expressions; +using Microsoft.AppCenter.Crashes; using Shared.Common; using Shared.Phone.UserCenter.Safety; using ZigBee.Device; @@ -62,10 +63,6 @@ /// </summary> List<Room> supportRoomList = new List<Room>(); /// <summary> - /// 褰撶粦瀹氳〃鍙樺寲鍚庣殑鍥炶皟 - /// </summary> - public Action<List<BindListResponseObj>> action; - /// <summary> /// 淇濆瓨瀹屾垚鎸夐挳 /// </summary> Button btnFinifh; @@ -92,19 +89,19 @@ /// <summary> /// 鏂伴缁戝畾鐩爣鍥炶皟 /// </summary> - Action actionFreshAirTarget = null; + public Action<string> actionFreshAirTarget = null; /// <summary> /// 娓╁害缁戝畾鐩爣鍥炶皟 /// </summary> - Action actionTemperatureTarget = null; + public Action<string> actionTemperatureTarget = null; /// <summary> /// 婀垮害缁戝畾鐩爣鍥炶皟 /// </summary> - Action actionHumidityTarget = null; + public Action<string> actionHumidityTarget = null; /// <summary> /// PM缁戝畾鐩爣鍥炶皟 /// </summary> - Action actionPMTarget = null; + public Action<string> actionPMTarget = null; #endregion #region UI璁捐 @@ -135,7 +132,7 @@ { RemoveFromParent(); }; - this.btnTitle.Width = Application.GetRealWidth(1080 - 161 - 200 - 58); + this.btnTitle.Width = Application.GetRealWidth(1080 - 161 - 300); this.btnBack.MouseUpEventHandler += eHandlerBack; this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; this.MidFrameLayout(this); @@ -156,14 +153,13 @@ { var btnAddFrameLayout = new FrameLayout { - X = Application.GetRealWidth(830), + X = Application.GetRealWidth(619), }; this.titleFrameLayout.AddChidren(btnAddFrameLayout); btnFloorText = new Button { - Width = Application.GetRealWidth(110), - X = Application.GetRealWidth(15), + Width = Application.GetRealWidth(300 - 69 - 58), Text = Language.StringByID(R.MyInternationalizationString.FirstFloor), TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, TextSize = 14, @@ -172,26 +168,35 @@ }; btnAddFrameLayout.AddChidren(btnFloorText); + var btnBindDownFrameLayout = new FrameLayout + { + Width = Application.GetMinReal(69 + 58), + X = Application.GetRealWidth(300 - 69 - 58), + }; + btnAddFrameLayout.AddChidren(btnBindDownFrameLayout); + var btnBindDown = new Button { Height = Application.GetMinReal(69), Width = Application.GetMinReal(69), - X = Application.GetRealWidth(200 - 77), UnSelectedImagePath = "BindPic/BindDown.png", Gravity = Gravity.CenterVertical, }; - btnAddFrameLayout.AddChidren(btnBindDown); - btnBindDown.MouseDownEventHandler += (sender, e) => + btnBindDownFrameLayout.AddChidren(btnBindDown); + + EventHandler<MouseEventArgs> eHandlerBindDown = (sender, e) => { SideslipFramelayout(); }; + btnBindDown.MouseDownEventHandler += eHandlerBindDown; + btnBindDownFrameLayout.MouseDownEventHandler += eHandlerBindDown; if (Common.Config.Instance.Home.FloorDics.Count == 0) { btnAddFrameLayout.Width = 0; } else { - btnAddFrameLayout.Width = Application.GetRealWidth(200); + btnAddFrameLayout.Width = Application.GetRealWidth(300); } } @@ -220,6 +225,11 @@ Height = Application.GetRealHeight(1145), }; this.midFrameLayout.AddChidren(midVerticalScrolViewLayout); + midVerticalScrolViewLayout.BeginHeaderRefreshingAction += () => + { + midVerticalScrolViewLayout.BeginHeaderRefreshing(); + InitData(); + }; //搴曢儴淇濆瓨鏍� var bottomFrameLayout = new FrameLayout() @@ -253,8 +263,9 @@ /// </summary> /// <param name="gateway">Gateway.</param> /// <param name="key">Key.</param> - void RefreshRoomList(Room curRoom, ref int index2) + void RefreshRoomList() { + Room curRoom = null; if (supportRoomList.Count == 0) { return; @@ -263,7 +274,7 @@ Button curentOldRoom = null; FrameLayout curentOldRoomFrameLayout = null; int index = 0; - var roomTempList = GetSupportRoomList(curRoom); + var roomTempList = GetSupportRoomList(); for (int i = 0; i < roomTempList.Count; i++) { var room = roomTempList[i]; @@ -302,7 +313,6 @@ } EventHandler<MouseEventArgs> eHandlerRoom = (sender, e) => { - //ChangeRoom(curRoom, room, btnRoom, curentOldRoom, btnRoomFrameLayout, curentOldRoomFrameLayout); if (!btnRoom.IsSelected) { if (curentOldRoom != null) @@ -327,26 +337,11 @@ } curRoom = room; curControlDev.RoomId = room.Id; - if (curRoom.ListSceneId.Count == 0) - { - btnFinifh.Enable = false; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; - } - else - { - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - } - if (targetList.Count == 0) - { - btnFinifh.Enable = false; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; - } - else - { - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - } + + //鏂伴闈㈡澘淇濆瓨浣胯兘 + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + RefreshDeviceList(curRoom); }; btnRoom.MouseUpEventHandler += eHandlerRoom; @@ -354,6 +349,17 @@ index++; } BindInfo.FinishDisplay(roomTempList, btnFinifh); + + if (roomTempList.Count != 0) + { + curRoom = roomTempList[0]; + } + else + { + curRoom = new Shared.Common.Room(); + } + + RefreshDeviceList(curRoom); } /// <summary> @@ -425,7 +431,7 @@ }; rowLayout.AddChidren(line2); - if (curIndex == currentPanelSupportBindDeviceList.Count - 1) + if (curIndex == currentRoomSupportBindDeviceList.Count - 1) { line2.Visible = false; } @@ -435,23 +441,6 @@ string mianKey = device.DeviceAddr + device.DeviceEpoint; if (targetList.Count != 0) { - // if(curControlDev!=null) - // { - // foreach (var bindedSc in curControlDev.bindList) - // { - // if (bindedSc.BindMacAddr + bindedSc.BindEpoint == mianKey) - // { - // btnChoose.IsSelected = true; - // btnChoose.Visible = true; - // oldDevice = btnChoose; - // targetList.Add(device); - // } - // } - // } - - //} - //else - //{ foreach (var bindedDev in targetList) { if (bindedDev.DeviceAddr + bindedDev.DeviceEpoint == mianKey) @@ -465,17 +454,20 @@ EventHandler<MouseEventArgs> hander = (sender, e) => { - //ChangeTarget(device, btnChoose, oldDevice); - if (curControlDev.bindList.Count != 0) - { - if (btnChoose.IsSelected) - { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindExist), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); - return; - } - } - + btnChoose.IsSelected = !btnChoose.IsSelected; if (!btnChoose.IsSelected) + { + if (oldDevice != null) + { + oldDevice.IsSelected = false; + oldDevice.Visible = false; + } + oldDevice = btnChoose; + oldDevice.IsSelected = false; + oldDevice.Visible = false; + targetList.Clear(); + } + else { if (oldDevice != null) { @@ -488,33 +480,16 @@ targetList.Clear(); targetList.Add(device); } - if (targetList.Count == 0) - { - btnFinifh.Enable = false; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; - } - else - { - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - } + + //鏂伴闈㈡澘锛氱敱浜庣洰鏍囨病鏈夋彁渚涘垹闄ゆ帴鍙o紝鎵�浠ュ彲浠ュ彇娑堥�変腑鑳戒繚瀛� + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; }; rowLayout.MouseUpEventHandler += hander; devicePic.MouseUpEventHandler += hander; btnBindName.MouseUpEventHandler += hander; btnChoose.MouseUpEventHandler += hander; curIndex++; - } - - if (targetList.Count == 0) - { - btnFinifh.Enable = false; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; - } - else - { - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; } } @@ -537,7 +512,6 @@ var sidelipFrameLayout = new FrameLayout() { - Height = Application.GetMinReal(783), Width = Application.GetMinReal(449), Y = Application.GetRealHeight(161), X = Application.GetRealWidth(596), @@ -561,18 +535,19 @@ var sidelipVerticalScrolViewLayout = new VerticalScrolViewLayout() { + Y = btnSelectFloor.Bottom + Application.GetRealHeight(45), Height = Application.GetRealHeight(600), - Y = btnSelectFloor.Bottom, }; sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout); Button oldbutton = null; Button oldbuttonText = null; + int count = 0; foreach (var floorId in dicFloorList.Keys) { var rowFrameLayout = new RowLayout() { - Height = Application.GetRealHeight(150), + Height = Application.GetRealHeight(152), LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine, X = Application.GetRealWidth(81), }; @@ -582,9 +557,9 @@ { Width = Application.GetMinReal(81), Height = Application.GetMinReal(81), - Y = Application.GetRealHeight(55), UnSelectedImagePath = "Floor/Floor.png", SelectedImagePath = "Floor/FloorSelected.png", + Gravity = Gravity.CenterVertical, }; rowFrameLayout.AddChidren(btnAllMethod); @@ -593,7 +568,7 @@ Width = Application.GetRealWidth(311), Height = Application.GetRealHeight(58), X = Application.GetRealWidth(92), - Y = Application.GetRealHeight(69), + Gravity = Gravity.CenterVertical, TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, TextSize = 14, TextAlignment = TextAlignment.CenterLeft, @@ -608,36 +583,18 @@ btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; } + string curFloorId = floorId; EventHandler<MouseEventArgs> hander = (sender, e) => { - //ChangeFloor(dialog, floorId, btnMethodText, oldbuttonText, oldbutton); - var curFloorId = floorId; - curControlDev.currentSelectFloorId = curFloorId; - btnFloorText.Text = dicFloorList[curFloorId]; if (curControlDev.currentSelectFloorId == curFloorId) { return; } curControlDev.currentSelectFloorId = curFloorId; - btnFloorText.Text = dicFloorList[curFloorId]; + btnFloorText.Text = dicFloorList[floorId]; //鑾峰彇妤煎眰涓埧闂村垪琛� supportRoomList = GetFloorRoomList(); - if (supportRoomList.Count == 0) - { - return; - } - var curRoom = new Room(); - if (supportRoomList.Count != 0) - { - curRoom = supportRoomList[0]; - } - else - { - curRoom = new Shared.Common.Room(); - supportRoomList.Add(curRoom); - } - if (!btnMethodText.IsSelected) { if (oldbutton != null) @@ -656,23 +613,26 @@ } int index = 0; - RefreshRoomList(curRoom, ref index); - - if (targetList.Count == 0) - { - btnFinifh.Enable = false; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; - } - else - { - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - } + RefreshRoomList(); dialog.Close(); }; btnAllMethod.MouseUpEventHandler += hander; rowFrameLayout.MouseUpEventHandler += hander; btnMethodText.MouseUpEventHandler += hander; + count++; + } + + if (count == 0) + { + sidelipFrameLayout.Height = 0; + } + else if (count <= 4 && count > 0) + { + sidelipFrameLayout.Height = Application.GetRealHeight(180) + count * Application.GetRealHeight(150); + } + else + { + sidelipFrameLayout.Height = Application.GetMinReal(780); } } #endregion @@ -697,8 +657,10 @@ curControlDev.currentSelectFloorId = BindInfo.GetCurrentSelectFloorId(); if (BindInfo.GetCurrentSelectFloorIdName() != null) { - btnFloorText.Text = BindInfo.GetCurrentSelectFloorIdName(); - + Application.RunOnMainThread(() => + { + btnFloorText.Text = BindInfo.GetCurrentSelectFloorIdName(); + }); } //鑾峰彇妤煎眰涓埧闂村垪琛� @@ -743,215 +705,76 @@ var device = LocalDevice.Current.GetDevice(bindDev.DeviceAddr, bindDev.DeviceEpoint); if (device != null) { - //鑾峰彇璁惧绫诲瀷鐨� - var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); - //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず - if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) + switch (curDeviceBindType) { - continue; + case 1: + //鑾峰彇璁惧绫诲瀷鐨� + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); + //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) + { + continue; + } + if (device.Type == DeviceType.FreshAir) + { + targetList.Add(device); + oldTargetList.Add(device); + } + break; + case 2: + if (device.Type == DeviceType.TemperatureSensor) + { + targetList.Add(device); + oldTargetList.Add(device); + } + break; + case 3: + if (device.Type == DeviceType.FreshAirHumiditySensor) + { + targetList.Add(device); + oldTargetList.Add(device); + } + break; + case 4: + //PM2.5 + break; } - if (device.Type == DeviceType.FreshAir) - { - targetList.Add(device); - oldTargetList.Add(device); - } - } + } } } } } - catch { } + catch (Exception ex) + { + var mess = ex.Message; + } finally { Application.RunOnMainThread(() => { if (supportRoomList.Count != 0) { - Shared.Common.Room curRoom = supportRoomList[0]; - int index = 0; - RefreshRoomList(curRoom, ref index); - RefreshDeviceList(curRoom); - - if (curRoom.ListDevice.Count == 0 || targetList.Count == 0) - { - btnFinifh.Enable = false; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; - } - else - { - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - } + RefreshRoomList(); } + + //棣栨鏄惁鑳界偣鍑讳繚瀛� + if (targetList.Count == 0) + { + btnFinifh.Enable = false; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; + } + else + { + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + } + CommonPage.Loading.Hide(); + midVerticalScrolViewLayout.EndHeaderRefreshing(); }); } }); - } - - /// <summary> - /// 鍒囨崲妤煎眰 - /// </summary> - /// <param name="dialog"></param> - /// <param name="curFloorId"></param> - /// <param name="btnMethodText"></param> - /// <param name="oldbuttonText"></param> - /// <param name="oldbutton"></param> - void ChangeFloor(Dialog dialog, string curFloorId, Button btnMethodText, Button oldbuttonText, Button oldbutton) - { - if (curControlDev.currentSelectFloorId == curFloorId) - { - return; - } - curControlDev.currentSelectFloorId = curFloorId; - btnFloorText.Text = dicFloorList[curFloorId]; - - //鑾峰彇妤煎眰涓埧闂村垪琛� - supportRoomList = GetFloorRoomList(); - if (supportRoomList.Count == 0) - { - return; - } - var curRoom = new Room(); - if (supportRoomList.Count != 0) - { - curRoom = supportRoomList[0]; - } - else - { - curRoom = new Shared.Common.Room(); - supportRoomList.Add(curRoom); - } - - if (!btnMethodText.IsSelected) - { - if (oldbutton != null) - { - oldbutton.IsSelected = false; - } - if (oldbuttonText != null) - { - oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; - } - oldbutton = btnMethodText; - oldbuttonText = btnMethodText; - btnMethodText.IsSelected = true; - oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - oldbuttonText.IsBold = true; - } - - int index = 0; - RefreshRoomList(curRoom, ref index); - - if (targetList.Count == 0) - { - btnFinifh.Enable = false; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; - } - else - { - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - } - dialog.Close(); - } - - /// <summary> - /// 鍒囨崲鎴块棿 - /// </summary> - /// <param name="curRoom"></param> - /// <param name="room"></param> - /// <param name="btnRoom"></param> - /// <param name="curentOldRoom"></param> - /// <param name="btnRoomFrameLayout"></param> - /// <param name="curentOldRoomFrameLayout"></param> - void ChangeRoom(Room curRoom, Room room, Button btnRoom, Button curentOldRoom, FrameLayout btnRoomFrameLayout, FrameLayout curentOldRoomFrameLayout) - { - if (!btnRoom.IsSelected) - { - if (curentOldRoom != null) - { - curentOldRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; - } - curentOldRoom = btnRoom; - curentOldRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite; - } - - if (btnRoomFrameLayout.BorderWidth == 1) - { - if (curentOldRoomFrameLayout != null) - { - curentOldRoomFrameLayout.BorderWidth = 1; - curentOldRoomFrameLayout.BorderColor = Shared.Common.ZigbeeColor.Current.XMOrange; - curentOldRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackground.png"; - } - curentOldRoomFrameLayout = btnRoomFrameLayout; - curentOldRoomFrameLayout.BorderWidth = 0; - curentOldRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; - } - curRoom = room; - curControlDev.RoomId = room.Id; - if (curRoom.ListSceneId.Count == 0) - { - btnFinifh.Enable = false; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; - } - else - { - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - } - if (targetList.Count == 0) - { - btnFinifh.Enable = false; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; - } - else - { - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - } - RefreshDeviceList(curRoom); - } - - /// <summary> - /// 鍒囨崲缁戝畾鐩爣 - /// </summary> - void ChangeTarget(CommonDevice device, Button btnChoose, Button oldDevice) - { - if (curControlDev.bindList.Count != 0) - { - if (btnChoose.IsSelected) - { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindExist), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); - return; - } - } - - if (!btnChoose.IsSelected) - { - if (oldDevice != null) - { - oldDevice.IsSelected = false; - oldDevice.Visible = false; - } - oldDevice = btnChoose; - oldDevice.IsSelected = true; - oldDevice.Visible = true; - targetList.Clear(); - targetList.Add(device); - } - if (targetList.Count == 0) - { - btnFinifh.Enable = false; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; - } - else - { - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - } } /// <summary> @@ -960,24 +783,127 @@ /// <param name="curControlDev"></param> void SaveTarget() { - bool isFinish = false; - - //绌虹洰鏍� if (targetList.Count == 0) { - Application.RunOnMainThread(() => + //绌虹洰鏍� + System.Threading.Tasks.Task.Run(async () => { - var myTip = new Tip(); - myTip.Direction = AMPopTipDirection.None; - myTip.CloseTime = 2; - myTip.Text = Language.StringByID(R.MyInternationalizationString.BindDeviceTargetIsEmpty); - myTip.Show(Common.CommonPage.Instance); + try + { + Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); + + if (oldTargetList.Count != 0) + { + //鍒犻櫎鍙栨秷鐨勭洰鏍� + foreach (var bd in oldTargetList) + { + var delDevice = new DelDeviceBindData(); + delDevice.DeviceAddr = curControlDev.DeviceAddr; + delDevice.Epoint = curControlDev.DeviceEpoint; + + var removeDevice = new RemoveBindListObj(); + removeDevice.BindType = 0; + switch (curDeviceBindType) + { + case 1: + removeDevice.BindCluster = 514; + break; + case 2: + removeDevice.BindCluster = 1026; + break; + case 3: + removeDevice.BindCluster = 1029; + break; + case 4: + //PM2.5 + break; + } + removeDevice.BindMacAddr = bd.DeviceAddr; + removeDevice.BindEpoint = bd.DeviceEpoint; + delDevice.RemoveBindList.Add(removeDevice); + + var delResult = new DelDeviceBindResponseAllData(); + delResult = await curControlDev.DelDeviceBindAsync(delDevice); + if (delResult != null && delResult.removeBindResultResponseData != null) + { + if (delResult.removeBindResultResponseData.Result == 0) + { + switch (curDeviceBindType) + { + case 1: + if (actionFreshAirTarget != null) + { + actionFreshAirTarget(""); + } + break; + case 2: + if (actionTemperatureTarget != null) + { + actionTemperatureTarget(""); + } + break; + case 3: + if (actionHumidityTarget != null) + { + actionHumidityTarget(""); + } + break; + case 4: + if (actionPMTarget != null) + { + actionPMTarget(""); + } + break; + } + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + this.RemoveFromParent(); + }); + } + else + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } + } + } + } + else + { + //娌℃湁鐩爣鎻愮ず + Application.RunOnMainThread(() => + { + var myTip = new Tip(); + myTip.Direction = AMPopTipDirection.None; + myTip.CloseTime = 2; + myTip.Text = Language.StringByID(R.MyInternationalizationString.BindDeviceTargetIsEmpty); + myTip.Show(Common.CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } + } + catch (Exception ex) + { + var mess = ex.Message; + } }); - return; } else { - //宸茬粡缁戝畾杩囩殑鐩爣 + //閫変腑鐩爣 + //1銆佸凡缁忕粦瀹氳繃鐨勭洰鏍� if (checkExistDevice()) { Application.RunOnMainThread(() => @@ -987,6 +913,8 @@ myTip.CloseTime = 2; myTip.Text = Language.StringByID(R.MyInternationalizationString.BindExist); myTip.Show(Common.CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; }); return; } @@ -1002,23 +930,52 @@ { foreach (var bd in oldTargetList) { - var res = await RemoveTargets(bd); - if (res != 0) - { - Application.RunOnMainThread(() => - { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - CommonPage.Loading.Hide(); - return; - }); - } + var delDevice = new DelDeviceBindData(); + delDevice.DeviceAddr = curControlDev.DeviceAddr; + delDevice.Epoint = curControlDev.DeviceEpoint; + var removeDevice = new RemoveBindListObj(); + removeDevice.BindType = 0; + switch (curDeviceBindType) + { + case 1: + removeDevice.BindCluster = 514; + break; + case 2: + removeDevice.BindCluster = 1026; + break; + case 3: + removeDevice.BindCluster = 1029; + break; + case 4: + //PM2.5 + break; + } + removeDevice.BindMacAddr = bd.DeviceAddr; + removeDevice.BindEpoint = bd.DeviceEpoint; + delDevice.RemoveBindList.Add(removeDevice); + + var delResult = new DelDeviceBindResponseAllData(); + delResult = await curControlDev.DelDeviceBindAsync(delDevice); + if (delResult != null && delResult.removeBindResultResponseData != null) + { + if (delResult.removeBindResultResponseData.Result != 0) + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } + } } } - //娣诲姞鏂扮殑鐩爣 + //2銆佹坊鍔犳柊鐨勭洰鏍� + string bindName = ""; var addBindeDev = new AddBindData(); addBindeDev.DeviceAddr = curControlDev.DeviceAddr; addBindeDev.Epoint = curControlDev.DeviceEpoint; @@ -1036,25 +993,29 @@ case 3: addBindInfo.BindCluster = 1029; break; + case 4: + //PM2.5 + break; } addBindInfo.BindType = 0; addBindInfo.BindMacAddr = de.DeviceAddr; addBindInfo.BindEpoint = de.DeviceEpoint; addBindeDev.BindList.Add(addBindInfo); + bindName = de.DeviceEpointName; } var dev = new AddedDeviceBindResponseAllData(); dev = await curControlDev.AddDeviceBindAsync(addBindeDev); - if (dev != null || dev.addedDeviceBindResponseData == null) + if (dev == null || dev.addedDeviceBindResponseData == null) { Application.RunOnMainThread(() => { CommonPage.Loading.Hide(); new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + return; }); - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - return; } else { @@ -1062,24 +1023,41 @@ { curControlDev.bindList = dev.addedDeviceBindResponseData.BindList; targetList.Clear(); - isFinish = true; - if (isFinish) + + switch (curDeviceBindType) { - if (action != null) - { - action(curControlDev.bindList); - } - this.RemoveFromParent(); + case 1: + if (actionFreshAirTarget != null) + { + actionFreshAirTarget(bindName); + } + break; + case 2: + if (actionTemperatureTarget != null) + { + actionTemperatureTarget(bindName); + } + break; + case 3: + if (actionHumidityTarget != null) + { + actionHumidityTarget(bindName); + } + break; + case 4: + if (actionPMTarget != null) + { + actionPMTarget(bindName); + } + break; } - else - { - this.RemoveFromParent(); - } + Application.RunOnMainThread(() => { CommonPage.Loading.Hide(); btnFinifh.Enable = true; btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + this.RemoveFromParent(); }); } else if (dev.addedDeviceBindResponseData.Result == 1) @@ -1118,68 +1096,12 @@ } } } - catch + catch (Exception ex) { + var mess = ex.Message; } }); } - } - - /// <summary> - /// 鍒犻櫎瀛樺湪鐨勭洰鏍� - /// </summary> - /// <param name="bindDevice"></param> - /// <param name="btnDel"></param> - /// <returns></returns> - private async System.Threading.Tasks.Task<int> RemoveTargets(CommonDevice delDev) - { - var delDevice = new DelDeviceBindData(); - delDevice.DeviceAddr = curControlDev.DeviceAddr; - delDevice.Epoint = curControlDev.DeviceEpoint; - - var removeDevice = new RemoveBindListObj(); - removeDevice.BindType = 0; - switch (curDeviceBindType) - { - case 1: - removeDevice.BindCluster = 514; - break; - case 2: - removeDevice.BindCluster = 1026; - break; - case 3: - removeDevice.BindCluster = 1029; - break; - } - removeDevice.BindMacAddr = delDev.DeviceAddr; - removeDevice.BindEpoint = delDev.DeviceEpoint; - delDevice.RemoveBindList.Add(removeDevice); - - try - { - CommonPage.Loading.Start(""); - var delResult = new DelDeviceBindResponseAllData(); - delResult = await curControlDev.DelDeviceBindAsync(delDevice); - if (delResult != null && delResult.delDeviceBindResponseData != null) - { - if (delResult.delDeviceBindResponseData?.RemoveBindList != null) - { - foreach (var re in delResult.delDeviceBindResponseData.RemoveBindList) - { - if (re.Result == 0) - { - return 0; - } - { - return -1; - } - } - } - } - } - catch { } - - return -1; } /// <summary> @@ -1208,7 +1130,7 @@ /// <summary> /// 鑳芥樉绀虹殑鎴块棿鍒楄〃 /// </summary> - private List<Room> GetSupportRoomList(Room curRoom) + private List<Room> GetSupportRoomList() { var roomTempList = new List<Room>(); for (int i = 0; i < supportRoomList.Count; i++) @@ -1225,11 +1147,81 @@ { continue; } - - roomTempList.Add(room); - if (roomTempList.Count != 0) + else { - curRoom = roomTempList[0]; + List<CommonDevice> roomIncludeMatchDevice = new List<CommonDevice>(); + + //鎴块棿涓病鏈夊搴旂殑鏀寔缁戝畾鐨勭洰鏍� + switch (curDeviceBindType) + { + case 1: + foreach (var de in room.ListDevice) + { + var device = LocalDevice.Current.GetDevice(de); + if (device != null) + { + //鑾峰彇璁惧绫诲瀷鐨� + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); + //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) + { + continue; + } + if (device.Type == DeviceType.FreshAir) + { + roomIncludeMatchDevice.Add(device); + } + } + } + break; + case 2: + foreach (var de in room.ListDevice) + { + var device = LocalDevice.Current.GetDevice(de); + if (device != null) + { + if (device.Type == DeviceType.TemperatureSensor) + { + roomIncludeMatchDevice.Add(device); + } + } + } + break; + case 3: + foreach (var de in room.ListDevice) + { + var device = LocalDevice.Current.GetDevice(de); + if (device != null) + { + if (device.Type == DeviceType.FreshAirHumiditySensor) + { + roomIncludeMatchDevice.Add(device); + } + } + } + break; + case 4: + break; + } + + if (roomIncludeMatchDevice.Count == 0) + { + continue; + } + } + + if (!string.IsNullOrEmpty(room.FloorId)) + { + //鏈夋ゼ灞� + if (room.FloorId == curControlDev.currentSelectFloorId) + { + roomTempList.Add(room); + } + } + else + { + //娌℃湁妤煎眰 + roomTempList.Add(room); } } return roomTempList; @@ -1261,24 +1253,21 @@ } else { - // 鑾峰彇妤煎眰瀵瑰簲瀵规埧闂� + // 鑾峰彇鏀寔鐨勬埧闂� foreach (var room in listAllRoom) { - if (room.FloorId == curControlDev.currentSelectFloorId) + if (room.IsLove) { - if (room.IsLove) - { - continue; - } - supportRoomListTemp.Add(room); + continue; } + supportRoomListTemp.Add(room); } } return supportRoomListTemp; } /// <summary> - /// 鎴块棿涓尮閰嶇殑鏀寔缁戝畾鐨勬墍鏈夌洰鏍囧垪琛� + /// 鎵�鏈夋埧闂翠腑鍖归厤鐨勬敮鎸佺粦瀹氱殑鎵�鏈夌洰鏍囧垪琛� /// </summary> /// <returns></returns> List<CommonDevice> GetAllRoomSupportDeviceList() @@ -1299,13 +1288,13 @@ var device = LocalDevice.Current.GetDevice(deviceKeys); if (device != null) { - ////鑾峰彇璁惧绫诲瀷鐨� - //var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); - ////鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず - //if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) - //{ - // continue; - //} + //鑾峰彇璁惧绫诲瀷鐨� + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); + //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) + { + continue; + } if (device.Type == DeviceType.FreshAir) { currentPanelBindSupportDeviceListTemp.Add(device); @@ -1315,8 +1304,44 @@ } break; case 2: + foreach (var r in supportRoomList) + { + if (r.ListDevice.Count == 0) + { + continue; + } + foreach (var deviceKeys in r.ListDevice) + { + var device = LocalDevice.Current.GetDevice(deviceKeys); + if (device != null) + { + if (device.Type == DeviceType.TemperatureSensor) + { + currentPanelBindSupportDeviceListTemp.Add(device); + } + } + } + } break; case 3: + foreach (var r in supportRoomList) + { + if (r.ListDevice.Count == 0) + { + continue; + } + foreach (var deviceKeys in r.ListDevice) + { + var device = LocalDevice.Current.GetDevice(deviceKeys); + if (device != null) + { + if (device.Type == DeviceType.FreshAirHumiditySensor) + { + currentPanelBindSupportDeviceListTemp.Add(device); + } + } + } + } break; case 4: break; @@ -1340,13 +1365,13 @@ var device = LocalDevice.Current.GetDevice(deviceKeys); if (device != null) { - ////鑾峰彇璁惧绫诲瀷鐨� - //var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); - ////鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず - //if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) - //{ - // continue; - //} + //鑾峰彇璁惧绫诲瀷鐨� + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); + //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) + { + continue; + } if (device.Type == DeviceType.FreshAir) { curRoomDeviceListTemp.Add(device); @@ -1355,14 +1380,50 @@ } break; case 2: + foreach (var deviceKeys in curRoom.ListDevice) + { + var device = LocalDevice.Current.GetDevice(deviceKeys); + if (device != null) + { + if (device.Type == DeviceType.TemperatureSensor) + { + curRoomDeviceListTemp.Add(device); + } + } + } break; case 3: + foreach (var deviceKeys in curRoom.ListDevice) + { + var device = LocalDevice.Current.GetDevice(deviceKeys); + if (device != null) + { + if (device.Type == DeviceType.FreshAirHumiditySensor) + { + curRoomDeviceListTemp.Add(device); + } + } + } break; case 4: break; } return curRoomDeviceListTemp; } - #endregion + #endregion + + #region 绉婚櫎鏂规硶 + /// <summary> + /// 閲嶅啓绉婚櫎鏂规硶 + /// </summary> + public override void RemoveFromParent() + { + actionFreshAirTarget = null; + actionTemperatureTarget = null; + actionHumidityTarget = null; + actionPMTarget = null; + base.RemoveFromParent(); + } + #endregion } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs index dce3ae5..711e561 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs @@ -144,6 +144,10 @@ { device.IconPath = "Device/Light.png"; } + else + { + device.IconPath = "Device/RelayEpoint.png"; + } device.ReSave(); } this.CloseProgressBar(); @@ -332,10 +336,19 @@ var title = Language.StringByID(R.MyInternationalizationString.uSelectFunctionType); var form = new BottomItemSelectForm(); + form.CancelCallEvent = true;//鍏佽鍙栨秷 form.AddForm(title, listText, nowSelectNo); form.FinishSelectEvent += (selectNo) => { - btnFunction.Text = listText[selectNo]; + if (selectNo == -1) + { + //閫夋嫨鍙栨秷 + btnFunction.Text = string.Empty; + } + else + { + btnFunction.Text = listText[selectNo]; + } nowSelectNo = selectNo; //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨� if (selectNo == 0) @@ -346,10 +359,14 @@ { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鐏厜; } - else + else if (selectNo == 2) { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鎻掑骇; } + else + { + dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鏈畾涔�; + } }; }; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs index cde8171..47590b7 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs @@ -144,6 +144,10 @@ { device.IconPath = "Device/Light.png"; } + else + { + device.IconPath = "Device/RelayEpoint.png"; + } device.ReSave(); } this.CloseProgressBar(); @@ -332,10 +336,19 @@ var title = Language.StringByID(R.MyInternationalizationString.uSelectFunctionType); var form = new BottomItemSelectForm(); + form.CancelCallEvent = true;//鍏佽鍙栨秷 form.AddForm(title, listText, nowSelectNo); form.FinishSelectEvent += (selectNo) => { - btnFunction.Text = listText[selectNo]; + if (selectNo == -1) + { + //閫夋嫨鍙栨秷 + btnFunction.Text = string.Empty; + } + else + { + btnFunction.Text = listText[selectNo]; + } nowSelectNo = selectNo; //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨� if (selectNo == 0) @@ -346,10 +359,14 @@ { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鐏厜; } - else + else if (selectNo == 2) { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鎻掑骇; } + else + { + dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鏈畾涔�; + } }; }; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs old mode 100755 new mode 100644 index 9b0f7c9..ac89816 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs @@ -77,10 +77,10 @@ #endregion /// <summary> - /// 鑾峰彇褰撳墠闂ㄩ攣鐨勫父寮�妯″紡 + /// 鑾峰彇褰撳墠闂ㄩ攣鐨勫父寮�妯″紡 /// </summary> /// <param name="doorLock:褰撳墠闂ㄩ攣"></param> - /// <returns></returns> + /// <returns>null:娌℃湁鍥炲 锛� true:闂ㄩ攣甯稿紑锛沠alse锛氶棬閿佸父鍏�</returns> public static async System.Threading.Tasks.Task<bool?> GetNormallyOpenMode(ZigBee.Device.DoorLock doorLock) { bool? IsDoorLockNormallyMode = null; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs old mode 100755 new mode 100644 index 8574e46..1721127 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs @@ -15,7 +15,7 @@ } #region 鍙橀噺鐢虫槑 public FrameLayout topFrameLayout = new FrameLayout { Height = Application.GetRealHeight(184), BackgroundColor = ZigbeeColor.Current.XMTopFrameLayout }; - public FrameLayout midFrameLayout = new FrameLayout { Height = Application.GetRealHeight(1921 - 184), BackgroundColor = ZigbeeColor.Current.XMMidFrameLayout }; + public FrameLayout midFrameLayout = new FrameLayout { Height = Application.GetRealHeight(1925 - 184), BackgroundColor = ZigbeeColor.Current.XMMidFrameLayout }; #region 搴曢儴鏈夊渾瑙掑竷灞� /// 鑳屾櫙闃村奖鐣岄潰 /// </summary> @@ -120,7 +120,6 @@ Height = 1, BackgroundColor = Shared.Common.ZigbeeColor.Current.XMTitleLine, }; - /// <summary> /// 寮圭獥鍙栨秷鎸夐敭 @@ -233,6 +232,7 @@ PlaceholderText = Language.StringByID(R.MyInternationalizationString.InputUnlockPasswrd), TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, TextAlignment = TextAlignment.BottomLeft, + IsNumberKeyboardType = true, }; editInputPasswordFrameLayout.AddChidren(editInputPassword); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/ShowDoorLockMsgControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/ShowDoorLockMsgControl.cs old mode 100755 new mode 100644 index de6bb06..42ee72e --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/ShowDoorLockMsgControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/ShowDoorLockMsgControl.cs @@ -265,7 +265,27 @@ IsNumberKeyboardType = true, }; editTextFrameLayout.AddChidren(editInvalidTime); - + editInvalidTime.TextChangeEventHandler += (sender, e) => + { + if (!string.IsNullOrEmpty((sender as EditText).Text)) + { + var textFir = (sender as EditText).Text.Substring(0, 1); + if ((sender as EditText).Text.Length > 1) + { + if (textFir == "0") + { + editInvalidTime.Text = (sender as EditText).Text.Substring(1, 1); + } + } + if (int.Parse((sender as EditText).Text) > 72) + { + string msg0 = Language.StringByID(R.MyInternationalizationString.InvalidTimeMoreThan72); + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, msg0, Language.StringByID(R.MyInternationalizationString.confrim)); + alert.Show(); + editInvalidTime.Text = "72"; + } + } + }; var btnMsg2 = new Button() { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs index dfa00d7..d259aeb 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs @@ -628,6 +628,7 @@ var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; localDoorLockObj.UserID = curDoorLockUser.UserID; localDoorLockObj.UnlockType = curDoorLockUser.UnlockType; + localDoorLockObj.PrimaryId = curDoorLockUser.PrimaryId; localDoorLockObj.EntryTime = curDoorLockUser.EntryTime; localDoorLockObj.UserName = refreshDoorLockData.UserIdRemarks; localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs index fdac3f9..285699d 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs @@ -685,9 +685,7 @@ { tempRes = false; } - - NormallyOpenModeValue(tempRes); - + DoorLockCommonInfo.NormallyOpenModeValue(doorLock, tempRes); Application.RunOnMainThread(async () => { var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(); @@ -1036,23 +1034,7 @@ } #endregion - #region 甯稿紑妯″紡 - /// <summary> - /// 闂ㄩ攣甯稿紑妯″紡鍊� - /// </summary> - public void NormallyOpenModeValue(bool value) - { - string key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; - if (doorLock.IsDoorLockNormallyMode.ContainsKey(key)) - { - doorLock.IsDoorLockNormallyMode[key] = value; - } - else - { - doorLock.IsDoorLockNormallyMode.Add(key, value); - } - } - + #region 甯稿紑妯″紡 /// <summary> /// 甯稿紑妯″紡澶勭悊 /// </summary> @@ -1102,7 +1084,7 @@ //姣忔閲嶆柊璁剧疆甯稿紑锛岄粯璁ゆ椂闂撮兘鏄�12灏忔椂 DoorLockCommonInfo.NormallyOpenModeInvalidTime = 12; - NormallyOpenModeValue(true); + DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true); Application.RunOnMainThread(() => { UpdateNomallyOpenStatus(); @@ -1146,8 +1128,8 @@ { if (IsFromReport) { - //涓婃姤鈥滃父寮�妯″紡鈥濆凡琚彇娑堬紝app榛樿浜嗏�滃父寮�妯″紡鈥濊鍙栨秷 - NormallyOpenModeValue(false); + //涓婃姤鈥滃父寮�妯″紡鈥濆凡琚彇娑堬紝app榛樿浜嗏�滃父寮�妯″紡鈥濊鍙栨秷 + DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false); Application.RunOnMainThread(() => { UpdateNomallyOpenStatus(); @@ -1165,8 +1147,8 @@ } else { - //app榛樿鈥滃父寮�妯″紡鈥濊繕鏄紑鍚� - NormallyOpenModeValue(true); + //app榛樿鈥滃父寮�妯″紡鈥濊繕鏄紑鍚� + DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true); Application.RunOnMainThread(() => { UpdateNomallyOpenStatus(); @@ -1197,7 +1179,7 @@ { string msg0 = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); this.ShowTipMsg(msg0); - NormallyOpenModeValue(false); + DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false); Application.RunOnMainThread(() => { UpdateNomallyOpenStatus(); @@ -1208,7 +1190,7 @@ { string msg1 = Language.StringByID(R.MyInternationalizationString.OpenNormallyOpenModeFailed); this.ShowTipMsg(msg1); - NormallyOpenModeValue(false); + DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false); Application.RunOnMainThread(() => { UpdateNomallyOpenStatus(); @@ -1217,8 +1199,8 @@ } else { - //淇濇寔鈥滃父寮�鎴愬姛鈥� - NormallyOpenModeValue(true); + //淇濇寔鈥滃父寮�鎴愬姛鈥� + DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true); Application.RunOnMainThread(() => { UpdateNomallyOpenStatus(); @@ -1237,8 +1219,8 @@ } else { - //app鎿嶄綔涓嶅彇娑堚�滃父寮�妯″紡鈥� - NormallyOpenModeValue(true); + //app鎿嶄綔涓嶅彇娑堚�滃父寮�妯″紡鈥� + DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true); Application.RunOnMainThread(() => { UpdateNomallyOpenStatus(); @@ -1250,8 +1232,8 @@ { if (IsFromReport) { - //涓婃姤闂ㄩ攣鈥滃父寮�妯″紡鈥濆凡缁忓彇娑堬紝鐜板湪app纭鈥滃父寮�妯″紡鈥濆彇娑� - NormallyOpenModeValue(false); + //涓婃姤闂ㄩ攣鈥滃父寮�妯″紡鈥濆凡缁忓彇娑堬紝鐜板湪app纭鈥滃父寮�妯″紡鈥濆彇娑� + DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false); Application.RunOnMainThread(() => { UpdateNomallyOpenStatus(); @@ -1290,8 +1272,8 @@ //娣诲姞App寮�鍚父寮�妯″紡鐨勫巻鍙茶褰� HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(this.doorLock, 9002, string.Empty); - //app纭鍙栨秷鈥滃父寮�妯″紡鈥濇垚鍔� - NormallyOpenModeValue(false); + //app纭鍙栨秷鈥滃父寮�妯″紡鈥濇垚鍔� + DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false); Application.RunOnMainThread(() => { UpdateNomallyOpenStatus(); @@ -1367,19 +1349,6 @@ alertTimeInValidSetting.InvalidTimeAction += async (obj) => { - Regex rg = new Regex("^[0-9]+$"); - if (!rg.IsMatch(obj)) - { - //蹇呴』鏄暟瀛� - string msg0 = Language.StringByID(R.MyInternationalizationString.NormallyOpenModeInvalidTimeTip); - this.ShowTipMsg(msg0); - - string msgTimeInValidSetting2 = Language.StringByID(R.MyInternationalizationString.DoorLockOpenAllTheTime); - var timeConfrim2 = Language.StringByID(R.MyInternationalizationString.Confrim); - var alertTimeInValidSetting2 = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.InValid, msgTimeInValidSetting2, timeConfrim2); - alertTimeInValidSetting2.Show(); - return; - } //甯稿紑妯″紡澶辨晥鏃堕棿璁剧疆鎴愬姛 var temp = int.Parse(obj); DoorLockCommonInfo.NormallyOpenModeInvalidTime = temp; @@ -1389,8 +1358,8 @@ { //榛樿鍒涘缓甯稿紑妯″紡澶辫触 string msg0 = Language.StringByID(R.MyInternationalizationString.AddLogicNormallyModeFailed); - this.ShowTipMsg(msg0); - + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, msg0, Language.StringByID(R.MyInternationalizationString.confrim)); + alert.Show(); //浜屾鍔犺浇寮圭獥 甯稿紑妯″紡寮�鍚彁绀� NomallyOpenModeInvalidTimeDialog(); } @@ -1408,6 +1377,10 @@ return; } string key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; + if (!doorLock.IsDoorLockNormallyMode.ContainsKey(key)) + { + return; + } if (doorLock.IsDoorLockNormallyMode[key] == true) { btnNormallyOpen.IsSelected = true; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs index 25ec696..6739b3e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs @@ -109,6 +109,15 @@ HdlGatewayLogic.Current.ChangedGatewayRoom(this.zbGateway, roomKeys); }; + //鎵�灞炰綇瀹� + caption = Language.StringByID(R.MyInternationalizationString.uBelongResidence); + var btnBeloneArea = new FrameCaptionViewControl(caption, Common.Config.Instance.Home.Name, listview.rowSpace / 2); + btnBeloneArea.UseClickStatu = false; + listview.AddChidren(btnBeloneArea); + btnBeloneArea.InitControl(); + //鍒掔嚎 + btnBeloneArea.AddBottomLine(); + //鏁版嵁涓婁紶涓庝笅杞� var rowData = new RowLayoutControl(listview.rowSpace / 2); listview.AddChidren(rowData); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs index e142e5b..1ce3a11 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs @@ -111,14 +111,17 @@ btnType.AddBottomLine(); HdlGatewayLogic.Current.SetGatewayImageText(btnType.txtView, zbGateway); - //鎵�灞炰綇瀹� - caption = Language.StringByID(R.MyInternationalizationString.uBelongResidence); - var btnBeloneArea = new FrameCaptionViewControl(caption, Common.Config.Instance.Home.Name, listview.rowSpace / 2); - btnBeloneArea.UseClickStatu = false; - listview.AddChidren(btnBeloneArea); - btnBeloneArea.InitControl(); - //鍒掔嚎 - btnBeloneArea.AddBottomLine(); + //瀹夎浣嶇疆 + var rowBeloneArea = new BelongAreaControl(listview.rowSpace / 2); + listview.AddChidren(rowBeloneArea); + rowBeloneArea.InitControl(Language.StringByID(R.MyInternationalizationString.uInstallationLocation), this.zbGateway); + //搴曠嚎 + rowBeloneArea.AddBottomLine(); + rowBeloneArea.SelectRoomEvent += (roomKeys) => + { + //鍙樻洿缃戝叧鎴块棿 + HdlGatewayLogic.Current.ChangedGatewayRoom(this.zbGateway, roomKeys); + }; //瀹屾垚鍒濆鍖栨甯� tableContr.FinishInitControl(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs index 6ca7502..b36ff40 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs @@ -16,9 +16,13 @@ /// </summary> private FrameLayout frameTable = null; /// <summary> - /// 鍒楄〃鎺т欢 + /// 鍒楄〃鎺т欢(鐧借壊鑳屾櫙) /// </summary> - private VerticalListControl listView = null; + private FrameListControl listView = null; + /// <summary> + /// 鏁翠釜鐣岄潰鐨勪笂涓嬫粦鍔ㄦ帶浠� + /// </summary> + private VerticalFrameControl listBackContr = null; /// <summary> /// 妤煎眰椤哄簭 /// </summary> @@ -64,10 +68,16 @@ //娓呯┖bodyFrame this.ClearBodyFrame(); + //鏁翠釜鐣岄潰鐨勪笂涓嬫粦鍔ㄦ帶浠� + this.listBackContr = new VerticalFrameControl(); + listBackContr.Height = bodyFrameLayout.Height; + bodyFrameLayout.AddChidren(listBackContr); + + //浣忓畢琛� var rowHome = new RowLayoutControl(); rowHome.Height = Application.GetRealHeight(173); rowHome.BackgroundColor = UserCenterColor.Current.White; - bodyFrameLayout.AddChidren(rowHome); + listBackContr.frameTable.AddChidren(rowHome); rowHome.frameTable.UseClickStatu = false; var btnAdreeIcon = rowHome.frameTable.AddLeftIcon(81); @@ -144,8 +154,8 @@ //鍒濆鍖栨甯� this.frameTable = new FrameLayout(); frameTable.Y = rowHome.Bottom + Application.GetRealHeight(23); - frameTable.Height = bodyFrameLayout.Height - rowHome.Bottom - Application.GetRealHeight(23); - bodyFrameLayout.AddChidren(frameTable); + frameTable.Height = listBackContr.frameTable.Height - rowHome.Bottom - Application.GetRealHeight(23); + listBackContr.frameTable.AddChidren(frameTable); //鏍规嵁鎸囧畾妯″紡,鍒濆鍖栨甯冩帶浠� this.InitFrameTableByMode(); @@ -244,7 +254,7 @@ frameFloor.UseClickStatu = false; frameFloor.Height = Application.GetRealHeight(115); frameFloor.BackgroundColor = UserCenterColor.Current.White; - frameTable.AddChidren(frameFloor); + this.frameTable.AddChidren(frameFloor); //妤煎眰 var btnFloor = frameFloor.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uFloor), 200, 60); @@ -253,11 +263,11 @@ btnFloor.TextSize = 15; frameFloor.AddChidren(btnFloor, ChidrenBindMode.NotBind); - listView = new VerticalListControl(29); + listView = new FrameListControl(29); listView.BackgroundColor = UserCenterColor.Current.White; listView.Y = frameFloor.Bottom; listView.Height = frameTable.Height - frameFloor.Bottom; - frameTable.AddChidren(listView); + this.frameTable.AddChidren(listView); //鍒濆鍖栨ゼ灞傝 this.InitFloorRow(); @@ -289,7 +299,7 @@ this.AddFloorRow(keys, dicFloor[keys], i != count); } //璋冩暣鎺т欢楂樺害 - listView.AdjustRealHeight(Application.GetRealHeight(23)); + this.AdjustContrlTableHeight(); }); } @@ -306,6 +316,7 @@ private void AddFloorRow(string keys, string floorName, bool addLine) { var frameRow = new RowLayoutControl(listView.rowSpace / 2); + frameRow.MainKeys = keys; this.listView.AddChidren(frameRow); //鍥炬爣 var btnIcon = frameRow.frameTable.AddLeftIcon(81); @@ -395,8 +406,24 @@ } else { + bool canMove = false; + for (int i = 0; i < listView.ChildrenCount; i++) + { + var myRow = listView.GetChildren(i) as RowLayoutControl; + if (myRow != null && myRow.MainKeys == keys) + { + canMove = true; + continue; + } + if (canMove == true) + { + //瀹冧箣鍚庣殑琛岋紝鍏ㄩ儴寰�涓婄Щ + myRow.Y -= frameRow.Height; + } + } frameRow.RemoveFromParent(); - listView.AdjustRealHeight(Application.GetRealHeight(23)); + //璋冩暣妗屽竷楂樺害 + this.AdjustContrlTableHeight(); } }); }; @@ -495,7 +522,7 @@ btnRoomList.TextSize = 15; frameRoom.AddChidren(btnRoomList, ChidrenBindMode.NotBind); - listView = new VerticalListControl(29); + listView = new FrameListControl(29); listView.BackgroundColor = UserCenterColor.Current.White; listView.Y = frameRoom.Bottom; listView.Height = frameTable.Height - frameRoom.Bottom; @@ -523,8 +550,8 @@ //娣诲姞鎴块棿琛� this.AddRoomRow(listRoom[i], i != listRoom.Count - 1); } - //璋冩暣鎺т欢鐪熷疄楂樺害 - listView.AdjustRealHeight(Application.GetRealHeight(23)); + //璋冩暣妗屽竷楂樺害 + this.AdjustContrlTableHeight(); } #endregion @@ -539,6 +566,7 @@ private void AddRoomRow(Common.Room room, bool addLine) { var frameRow = new RowLayoutControl(listView.rowSpace / 2); + frameRow.MainKeys = room.Id; listView.AddChidren(frameRow); //鍥炬爣 var btnIcon = frameRow.frameTable.AddLeftIcon(81); @@ -602,8 +630,24 @@ } else { + bool canMove = false; + for (int i = 0; i < listView.ChildrenCount; i++) + { + var myRow = listView.GetChildren(i) as RowLayoutControl; + if (myRow != null && myRow.MainKeys == room.Id) + { + canMove = true; + continue; + } + if (canMove == true) + { + //瀹冧箣鍚庣殑琛岋紝鍏ㄩ儴寰�涓婄Щ + myRow.Y -= frameRow.Height; + } + } frameRow.RemoveFromParent(); - listView.AdjustRealHeight(Application.GetRealHeight(23)); + //璋冩暣妗屽竷楂樺害 + this.AdjustContrlTableHeight(); } }); }; @@ -812,6 +856,17 @@ return true; } + /// <summary> + /// 璋冩暣鎺т欢妗屽竷楂樺害 + /// </summary> + private void AdjustContrlTableHeight() + { + //璋冩暣妗屽竷楂樺害 + listView.AdjustRealHeight(Application.GetRealHeight(23)); + this.frameTable.Height = listView.Bottom; + this.listBackContr.AdjustTableHeight(); + } + #endregion #region 鈻� 缁撴瀯浣揰____________________________ diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs old mode 100755 new mode 100644 index 4de23e1..a6c6de9 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs @@ -1402,7 +1402,7 @@ ///<summary > /// 閰嶇疆鎸夐敭鎸囩ず鐏潰鏉胯妭鑳芥ā寮� /// <para>modeEnable:鑺傝兘妯″紡浣胯兘</para> - /// <para>modeTime:鏃犳搷浣滆繘鍏ヨ妭鑳芥ā寮忔椂闂� 0-ff</para> + /// <para>modeTime:鏃犳搷浣滆繘鍏ヨ妭鑳芥ā寮忔椂闂� 0-ffff</para> /// <para>鑺傝兘妯″紡浜害:0-100</para> /// </summary> public async System.Threading.Tasks.Task<ResponseAllData> SetKeyModeAsync(bool modeEnable, int modeTime, int level) @@ -1509,11 +1509,11 @@ string SetPanelModeModeData(bool modeEnable, int modeTime, int modelevel) { string data = ""; - string dataLength = "07"; + string dataLength = "08"; string dataComand1 = "03"; string dataComand2 = "04"; string dataSerialNum = "01"; - string addDataLength = "03"; + string addDataLength = "04"; string mode = ""; string time = ""; string level = ""; @@ -1527,17 +1527,30 @@ { mode = "00"; } - var sbString1 = new System.Text.StringBuilder(); - string temp = Convert.ToString(modeTime, 16); - switch (temp.Length) + + if (modeTime == -1) { - case 1: - time = "0" + temp; - break; - case 2: - time = temp; - break; + //褰撹妭鑳芥ā寮忔病鏈夌粰鏃堕棿锛岄粯璁ょ粰60绉� + modeTime = 60; } + + var tempBytes = new byte[2]; + for (int i = 0; i < 2; i++) + { + tempBytes[i] = (byte)(modeTime >> (i * 8) & 0xff); + } + var time1 = Convert.ToString(tempBytes[0], 16); + var time2 = Convert.ToString(tempBytes[1], 16); + if (time1.Length == 1) + { + time1 = "0" + time1; + } + if (time2.Length == 1) + { + time2 = "0" + time2; + } + + time = (time1 + time2).ToUpper(); var sbString2 = new System.Text.StringBuilder(); string temp2 = Convert.ToString(modelevel, 16); @@ -1550,11 +1563,10 @@ level = temp2; break; } - - sbString1.Append(time.ToUpper()); + sbString2.Append(level.ToUpper()); data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength + - mode + sbString1 + sbString2; + mode + time + sbString2; } catch { }; @@ -2153,7 +2165,7 @@ if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null) { var data = gatewayTemp.clientDataPassthroughResponseData.PassData; - if (data.Length == 16) + if (data.Length == 18) { var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString(); if (command == "0409") @@ -2167,8 +2179,8 @@ { tempR.enable = false; } - tempR.time = Convert.ToInt32(data[12].ToString() + data[13].ToString(), 16); - tempR.level = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16); + tempR.time = Convert.ToInt32(data[14].ToString() + data[15].ToString() + data[12].ToString() + data[13].ToString(), 16); + tempR.level = Convert.ToInt32(data[16].ToString() + data[17].ToString(), 16); panelSaveEnergyModeInfo = tempR; result = new PanelSwitchLevelResponInfo { panelSaveEnergyModeInfo = tempR }; System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0408_{ topic}"); diff --git a/ZigbeeApp/Shared/R.cs b/ZigbeeApp/Shared/R.cs index a0a0d6c..9cf03ef 100644 --- a/ZigbeeApp/Shared/R.cs +++ b/ZigbeeApp/Shared/R.cs @@ -550,6 +550,10 @@ /// 鏃舵晥鎬у父寮�鍒犻櫎澶辫触锛岀户缁�滃父寮�妯″紡鈥濊鍓嶅線闂ㄩ攣鐢ㄦ埛鐣岄潰璁剧疆 /// </summary> public const int CancelLogicNormallyModeFailed2 = 309; + /// <summary> + /// 璇疯緭鍏ュ悎娉曠殑鏁板瓧 + /// </summary> + public const int IllegalNumber = 310; public readonly static int cancel = 5097; public readonly static int confrim = 5098; -- Gitblit v1.8.0