From 21736b2944d5e88cd705a39ff87fd73d5a16e609 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期六, 09 五月 2020 11:06:35 +0800 Subject: [PATCH] 安川 --- ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs | 3 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs | 3 ZigbeeApp/GateWay.Droid/Assets/Language.ini | 23 ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs | 50 - ZigbeeApp/Home.Ios/Resources/Language.ini | 23 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs | 49 ZigbeeApp/Shared/Phone/Login/AccountLoginForm.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs | 15 ZigbeeApp/Shared/Phone/Device/Logic/Method.cs | 12 ZigbeeApp/Shared/R.cs | 23 ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs | 11 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs | 19 ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs | 15 ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs | 3 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs | 29 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueFreshAirDirectionForm.cs | 17 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs | 156 ++- ZigbeeApp/Shared/Common/Device.cs | 55 + ZigbeeApp/Shared/Phone/UserView/UserPage.cs | 43 ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs | 496 ++++++----- ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs | 28 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs | 16 ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs | 3 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/ResidenceOption.cs | 5 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs | 19 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs | 135 +-- ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs | 83 - ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs | 7 ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceFreshAirDetailCardForm.cs | 14 ZigbeeApp/Shared/Shared.projitems | 1 ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs | 9 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs | 9 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs | 4 ZigbeeApp/Shared/Phone/UserView/HomePage.cs | 2 ZigbeeApp/Shared/Common/House.cs | 9 ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs | 3 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs | 292 +++++- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs | 730 ++++------------- ZigbeeApp/Shared/Phone/ZigBee/Device/DeviceType.cs | 6 ZigbeeApp/Shared/Phone/ZigBee/Device/PMSensor.cs | 16 43 files changed, 1,239 insertions(+), 1,209 deletions(-) diff --git a/ZigbeeApp/GateWay.Droid/Assets/Language.ini b/ZigbeeApp/GateWay.Droid/Assets/Language.ini index d23cfa6..6c4e455 100755 --- a/ZigbeeApp/GateWay.Droid/Assets/Language.ini +++ b/ZigbeeApp/GateWay.Droid/Assets/Language.ini @@ -237,13 +237,11 @@ 231=鎺ヨ繎鎰熷簲 232=鎺ヨ繎鎰熷簲鍔熻兘璁剧疆缃け璐� 233=鑾峰彇鎺ヨ繎鎰熷簲鍔熻兘澶辫触 -235=鎸変綇闈㈡澘妯″紡锛圡ode)鍜岄閫燂紙Fan)鎸夐敭{0}缁胯壊鎸囩ず鐏寒璧枫�傚垯閰嶇綉鎴愬姛 -;涓夋寜閿潰鏉垮叆缃戞搷浣滄寚绀� +235=鎸変綇闈㈡澘妯″紡鎸夐敭5绉掞紝缁胯壊鎸囩ず鐏棯鐑亄0}杩涘叆閰嶇綉鐘舵�侊紱闂儊鍋滄{0}鎸囩ず鐏彉鐧借壊琛ㄧず閰嶇綉鎴愬姛 236=缁胯壊鎸囩ず鐏棯鐑� 237=鎸囩ず鐏� 238=闀挎寜5绉掞紙鎸夐敭锛� 239=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁裤�侀棯鐑亄0}杩涘叆閰嶇綉鐘舵�併�傜豢鐏唲鐏垯閰嶇綉鎴愬姛 -;涓夋寜閿潰鏉垮叆缃戞搷浣滄寚绀� 241=璁剧疆甯稿紑妯″紡鍚庯紝鎮ㄧ殑闂ㄩ攣灏嗗缁坽0}澶勪簬鎵撳紑鐘舵�侊紝纭寮�鍚紵 242=鐢甸噺 243=甯稿紑妯″紡宸插紑鍚� @@ -316,6 +314,7 @@ 311=鎵嬪姩 312= 鑳屽厜鐏鑹� 313=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝淇″彿鍥炬爣{0}蹇棯锛� 杩涘叆閰嶇綉鐘舵�併�備俊鍙峰浘鏍囧父浜垯閰嶇綉鎴愬姛 +314=鑷姩妯″紡涓嶆敮鎸佹搷浣� 5097=鍙栨秷 5098=纭畾 @@ -590,6 +589,12 @@ 5397=鏃堕棿涓虹┖ 5398=鍙敮鎸佹暟瀛楄緭鍏� +5399=鍏抽棴澶辫触 +5400=寮�鍚け璐� +5401=娣诲姞澶辫触 +5402=鏃舵晥鎬у父寮�璁剧疆 +5403=鏃跺叧闂� + 10000=HDL Home 10001=甯哥敤 @@ -671,7 +676,7 @@ 11001=鍦烘櫙 11002=鑷姩鍖� -11010=娌℃湁鍔熻兘 {\r\n} 璇峰湪涓汉涓績--璁惧绠$悊澶勬坊鍔� +11010=娌℃湁鍔熻兘{0}璇峰湪涓汉涓績--璁惧绠$悊澶勬坊鍔� 11011=缂栬緫 11012=鍔熻兘璁剧疆 11013=淇℃伅缂栬緫 @@ -685,7 +690,7 @@ 11021=淇濆瓨 11022=鎻愰啋 11023=鍙栨秷 -11024=娌℃湁鍦烘櫙 {\r\n} 璇风偣鍑诲彸涓婅娣诲姞 +11024=娌℃湁鍦烘櫙{0}璇风偣鍑诲彸涓婅娣诲姞 11025=璁剧疆 11026=寤舵椂 11027=纭畾鍒犻櫎鍚楋紵 @@ -1914,11 +1919,11 @@ ;娓╂箍搴︿紶鎰熷櫒鍏ョ綉鎿嶄綔鎸囩ず 21017=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝淇″彿鍥炬爣{0}蹇棯锛� 杩涘叆閰嶇綉鐘舵�併�傚浘鏍囧父浜垯閰嶇綉鎴愬姛 ;鏂规偊2鎸夐敭杞昏Е寮忛潰鏉垮叆缃戞搷浣滄寚绀� -21018=鎸変綇闈㈡澘宸︿笂瑙掓寜閿紝鎵�鏈夋寜閿寚绀虹伅{0}浜捣锛屽垯閰嶇綉鎴愬姛 +21018=闀挎寜BUTTON1鎸夐敭5绉掞紝鎵�鏈夋寚绀虹伅{0}鍙樹负缁胯壊骞堕棯鐑侊紝杩涘叆閰嶇綉鐘舵�� ;鏂规偊4鎸夐敭杞昏Е寮忛潰鏉垮叆缃戞搷浣滄寚绀� -21019=鎸変綇闈㈡澘宸︿笂瑙掓寜閿紝鎵�鏈夋寜閿寚绀虹伅{0}浜捣锛屽垯閰嶇綉鎴愬姛 +21019=闀挎寜BUTTON1鎸夐敭5绉掞紝鎵�鏈夋寚绀虹伅{0}鍙樹负缁胯壊骞堕棯鐑侊紝杩涘叆閰嶇綉鐘舵�� ;鏂规偊8鎸夐敭杞昏Е寮忛潰鏉垮叆缃戞搷浣滄寚绀� -21020=鎸変綇闈㈡澘宸︿笂瑙掓寜閿紝鎵�鏈夋寜閿寚绀虹伅{0}浜捣锛屽垯閰嶇綉鎴愬姛 +21020=闀挎寜BUTTON1鎸夐敭5绉掞紝鎵�鏈夋寚绀虹伅{0}鍙樹负缁胯壊骞堕棯鐑侊紝杩涘叆閰嶇綉鐘舵�� ;鏂规偊鐜闈㈡澘鍏ョ綉鎿嶄綔鎸囩ず 21021=鎸変綇闈㈡澘鍔熻兘(function)鎸夐敭锛屾墍鏈夋寜閿畕0}鎸囩ず鐏寒璧凤紝鍒欓厤缃戞垚鍔� ;绐楀笜闈㈡澘鐨勫叆缃戞搷浣滄寚绀� @@ -1967,6 +1972,7 @@ 30037=S-one 30038=鏂规偊鏂伴灏忔ā鍧� 30039=Zigbee鍚搁《鐕冩皵浼犳劅鍣� +30040=PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄澶囨墍灞炵绫荤殑缈昏瘧鍚嶅瓧,浠�40000寮�濮嬧槄鈽呪槄鈽� 40000=閬槼 @@ -2030,6 +2036,7 @@ 50037=Zigbee鏅鸿兘闂ㄩ攣 50038=鏂伴鎺у埗灏忔ā鍧� 50039=Zigbee鍚搁《鐕冩皵浼犳劅鍣� +50040=PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄ā鍧桰D鐨勮澶囩被鍨嬪悕瀛�,浠�60000寮�濮�.娉�:瀹冨苟涓嶉渶瑕佸啀R.cs鏂囦欢涓畾涔夆槄鈽呪槄鈽� 60000=浼犳劅鍣� diff --git a/ZigbeeApp/Home.Ios/Resources/Language.ini b/ZigbeeApp/Home.Ios/Resources/Language.ini index d23cfa6..6c4e455 100755 --- a/ZigbeeApp/Home.Ios/Resources/Language.ini +++ b/ZigbeeApp/Home.Ios/Resources/Language.ini @@ -237,13 +237,11 @@ 231=鎺ヨ繎鎰熷簲 232=鎺ヨ繎鎰熷簲鍔熻兘璁剧疆缃け璐� 233=鑾峰彇鎺ヨ繎鎰熷簲鍔熻兘澶辫触 -235=鎸変綇闈㈡澘妯″紡锛圡ode)鍜岄閫燂紙Fan)鎸夐敭{0}缁胯壊鎸囩ず鐏寒璧枫�傚垯閰嶇綉鎴愬姛 -;涓夋寜閿潰鏉垮叆缃戞搷浣滄寚绀� +235=鎸変綇闈㈡澘妯″紡鎸夐敭5绉掞紝缁胯壊鎸囩ず鐏棯鐑亄0}杩涘叆閰嶇綉鐘舵�侊紱闂儊鍋滄{0}鎸囩ず鐏彉鐧借壊琛ㄧず閰嶇綉鎴愬姛 236=缁胯壊鎸囩ず鐏棯鐑� 237=鎸囩ず鐏� 238=闀挎寜5绉掞紙鎸夐敭锛� 239=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁裤�侀棯鐑亄0}杩涘叆閰嶇綉鐘舵�併�傜豢鐏唲鐏垯閰嶇綉鎴愬姛 -;涓夋寜閿潰鏉垮叆缃戞搷浣滄寚绀� 241=璁剧疆甯稿紑妯″紡鍚庯紝鎮ㄧ殑闂ㄩ攣灏嗗缁坽0}澶勪簬鎵撳紑鐘舵�侊紝纭寮�鍚紵 242=鐢甸噺 243=甯稿紑妯″紡宸插紑鍚� @@ -316,6 +314,7 @@ 311=鎵嬪姩 312= 鑳屽厜鐏鑹� 313=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝淇″彿鍥炬爣{0}蹇棯锛� 杩涘叆閰嶇綉鐘舵�併�備俊鍙峰浘鏍囧父浜垯閰嶇綉鎴愬姛 +314=鑷姩妯″紡涓嶆敮鎸佹搷浣� 5097=鍙栨秷 5098=纭畾 @@ -590,6 +589,12 @@ 5397=鏃堕棿涓虹┖ 5398=鍙敮鎸佹暟瀛楄緭鍏� +5399=鍏抽棴澶辫触 +5400=寮�鍚け璐� +5401=娣诲姞澶辫触 +5402=鏃舵晥鎬у父寮�璁剧疆 +5403=鏃跺叧闂� + 10000=HDL Home 10001=甯哥敤 @@ -671,7 +676,7 @@ 11001=鍦烘櫙 11002=鑷姩鍖� -11010=娌℃湁鍔熻兘 {\r\n} 璇峰湪涓汉涓績--璁惧绠$悊澶勬坊鍔� +11010=娌℃湁鍔熻兘{0}璇峰湪涓汉涓績--璁惧绠$悊澶勬坊鍔� 11011=缂栬緫 11012=鍔熻兘璁剧疆 11013=淇℃伅缂栬緫 @@ -685,7 +690,7 @@ 11021=淇濆瓨 11022=鎻愰啋 11023=鍙栨秷 -11024=娌℃湁鍦烘櫙 {\r\n} 璇风偣鍑诲彸涓婅娣诲姞 +11024=娌℃湁鍦烘櫙{0}璇风偣鍑诲彸涓婅娣诲姞 11025=璁剧疆 11026=寤舵椂 11027=纭畾鍒犻櫎鍚楋紵 @@ -1914,11 +1919,11 @@ ;娓╂箍搴︿紶鎰熷櫒鍏ョ綉鎿嶄綔鎸囩ず 21017=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝淇″彿鍥炬爣{0}蹇棯锛� 杩涘叆閰嶇綉鐘舵�併�傚浘鏍囧父浜垯閰嶇綉鎴愬姛 ;鏂规偊2鎸夐敭杞昏Е寮忛潰鏉垮叆缃戞搷浣滄寚绀� -21018=鎸変綇闈㈡澘宸︿笂瑙掓寜閿紝鎵�鏈夋寜閿寚绀虹伅{0}浜捣锛屽垯閰嶇綉鎴愬姛 +21018=闀挎寜BUTTON1鎸夐敭5绉掞紝鎵�鏈夋寚绀虹伅{0}鍙樹负缁胯壊骞堕棯鐑侊紝杩涘叆閰嶇綉鐘舵�� ;鏂规偊4鎸夐敭杞昏Е寮忛潰鏉垮叆缃戞搷浣滄寚绀� -21019=鎸変綇闈㈡澘宸︿笂瑙掓寜閿紝鎵�鏈夋寜閿寚绀虹伅{0}浜捣锛屽垯閰嶇綉鎴愬姛 +21019=闀挎寜BUTTON1鎸夐敭5绉掞紝鎵�鏈夋寚绀虹伅{0}鍙樹负缁胯壊骞堕棯鐑侊紝杩涘叆閰嶇綉鐘舵�� ;鏂规偊8鎸夐敭杞昏Е寮忛潰鏉垮叆缃戞搷浣滄寚绀� -21020=鎸変綇闈㈡澘宸︿笂瑙掓寜閿紝鎵�鏈夋寜閿寚绀虹伅{0}浜捣锛屽垯閰嶇綉鎴愬姛 +21020=闀挎寜BUTTON1鎸夐敭5绉掞紝鎵�鏈夋寚绀虹伅{0}鍙樹负缁胯壊骞堕棯鐑侊紝杩涘叆閰嶇綉鐘舵�� ;鏂规偊鐜闈㈡澘鍏ョ綉鎿嶄綔鎸囩ず 21021=鎸変綇闈㈡澘鍔熻兘(function)鎸夐敭锛屾墍鏈夋寜閿畕0}鎸囩ず鐏寒璧凤紝鍒欓厤缃戞垚鍔� ;绐楀笜闈㈡澘鐨勫叆缃戞搷浣滄寚绀� @@ -1967,6 +1972,7 @@ 30037=S-one 30038=鏂规偊鏂伴灏忔ā鍧� 30039=Zigbee鍚搁《鐕冩皵浼犳劅鍣� +30040=PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄澶囨墍灞炵绫荤殑缈昏瘧鍚嶅瓧,浠�40000寮�濮嬧槄鈽呪槄鈽� 40000=閬槼 @@ -2030,6 +2036,7 @@ 50037=Zigbee鏅鸿兘闂ㄩ攣 50038=鏂伴鎺у埗灏忔ā鍧� 50039=Zigbee鍚搁《鐕冩皵浼犳劅鍣� +50040=PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄ā鍧桰D鐨勮澶囩被鍨嬪悕瀛�,浠�60000寮�濮�.娉�:瀹冨苟涓嶉渶瑕佸啀R.cs鏂囦欢涓畾涔夆槄鈽呪槄鈽� 60000=浼犳劅鍣� diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs index fa6b160..97dbff4 100755 --- a/ZigbeeApp/Shared/Common/Device.cs +++ b/ZigbeeApp/Shared/Common/Device.cs @@ -628,6 +628,9 @@ /// <param name="deleteRoom">鏄惁浠庢埧闂村垹闄�</param> public void DeleteMemmoryDevice(CommonDevice device, bool deleteRoom = true) { + //鍒犻櫎缂撳瓨璁惧鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂� + Phone.UserView.UserPage.Instance.RefreshForm = true; + if (deleteRoom == true) { //浠庢埧闂翠腑鍒犻櫎 @@ -2086,6 +2089,50 @@ #endregion + #region 鈻� 鑾峰彇璁惧鍦ㄧ嚎鐘舵�佸垪琛╛______________ + + /// <summary> + /// 鑾峰彇璁惧鍦ㄧ嚎鐘舵�佸垪琛�(娉ㄦ剰,涓�涓澶囧彧杩斿洖涓�涓洖璺�) + /// </summary> + /// <param name="gwId">缃戝叧id</param> + /// <returns></returns> + public List<CommonDevice> GetDeviceOnlineList(string gwId) + { + var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId); + int statu = 0; + var listDevice = this.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO); + if (statu == -1) + { + //褰撳嚭鐜板紓甯告椂,浣跨敤鍚庡鎿嶄綔,鐩存帴鑾峰彇鏈湴鐨勮澶囧垪琛� + listDevice = this.GetDeviceByGatewayID(gwId); + } + + var dicDevice = new Dictionary<string, CommonDevice>(); + foreach (var device in listDevice) + { + if (dicDevice.ContainsKey(device.DeviceAddr) == false) + { + dicDevice[device.DeviceAddr] = device; + continue; + } + //璁惧鏄惁澶勪簬鍦ㄧ嚎鐘舵�� + bool online = this.CheckDeviceIsOnline(device); + if (online == true) + { + //濡傛灉璁惧鍥炶矾鍦ㄧ嚎,鍒欎紭鍏堜娇鐢ㄥ湪绾跨殑鍥炶矾,鍚庢潵鐨勭洿鎺ヨ鐩� + dicDevice[device.DeviceAddr] = device; + } + } + var listReturn = new List<CommonDevice>(); + foreach (var device in dicDevice.Values) + { + listReturn.Add(device); + } + return listReturn; + } + + #endregion + #region 鈻� 涓�鑸柟娉昣__________________________ /// <summary> @@ -2673,6 +2720,9 @@ this.dicDeviceModelIdEnum["MBU01/M-ZB.10"] = "1305-1200-60000";//绱ф�ユ寜閿� this.dicDeviceModelIdEnum["MGCD01/ZB.10"] = "1306-1200-60000";//鍚搁《鐕冩皵浼犳劅鍣� + //PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� 銆愯璁惧灞炰簬绗笁鏂硅澶囷紝娌℃湁闀滃儚ID銆� + this.dicDeviceModelIdEnum["SZ_PM100"] = "1307-1200-60000";//PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� + //=========鈽呪槄缁х數鍣ㄧ被(2300-2499)鈽呪槄========= this.dicDeviceModelIdEnum["MPR0310-ZB.10"] = "2300-2300-60001";//3璺户鐢靛櫒灏忔ā鍧� this.dicDeviceModelIdEnum["MFA01-ZB.10"] = "2310-2300-60011";//鏂规偊鏂伴灏忔ā鍧� @@ -2864,6 +2914,11 @@ /// </summary> Sensor_CeilingGas = 1306, /// <summary> + /// PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� + /// </summary> + Sensor_PMTwoPointFive = 1307, + + /// <summary> /// 杩愬姩浼犳劅鍣� /// </summary> Sensor_Motion = -1306, diff --git a/ZigbeeApp/Shared/Common/House.cs b/ZigbeeApp/Shared/Common/House.cs index 871b61b..dbb051f 100755 --- a/ZigbeeApp/Shared/Common/House.cs +++ b/ZigbeeApp/Shared/Common/House.cs @@ -250,13 +250,6 @@ //褰撲綇瀹呬负绌烘椂鍏堟彁绀虹敤鎴锋柊寤轰綇瀹� var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.CurrentlyTheUserIshHouseIsEmptyPleaseBuildANewHouseFirst), Language.StringByID(R.MyInternationalizationString.Close), Language.StringByID(R.MyInternationalizationString.Confrim)); alert.Show(); - alert.ResultEventHandler += (sender, e) => - { - if (e) - { - // - } - }; } else { @@ -295,7 +288,7 @@ listHouse.Add(house); } //濡傛灉鍒囨崲浜嗚处鍙�,鎴栬�呭師鏉ョ殑id涓嶅瓨鍦�,鍒欓噸缃綇瀹匢D - if (UserCenterResourse.ResidenceOption.TheSameLoginAccount == false || + if (Config.Instance.TheSameLoginAccount == false || Config.Instance.HomeFilePathList.Find((obj) => obj == $"House_{Config.Instance.HomeId}.json") == null) { Config.Instance.HomeId = listHouse[0].Id; diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs index 51f374d..5b02be1 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs @@ -18,6 +18,8 @@ } public void Show() { + + #region 鐣岄潰鐨勫竷灞�浠g爜 TopView view = new TopView(); this.AddChidren(view.TopRowView()); @@ -72,6 +74,7 @@ UserView.HomePage.Instance.PageIndex += 1; roomAndDeviceView.IfType = LogicView.IfString.Condition_Logic; roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.devicestate)); + }; securityView.clickviewBtn.MouseUpEventHandler += (sender, e) => { diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs b/ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs index 8dbb478..c9f4318 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs @@ -387,6 +387,7 @@ break; case 40: { + openView.titleBtn.TextID = MyInternationalizationString.smokescreen; openView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; completeView.Show(1).AddChidren(openView.Show()); @@ -403,7 +404,7 @@ } break; case 43: - { + {//鍙厓璇寸殑 openView.titleBtn.TextID = MyInternationalizationString.gas; openView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; completeView.Show(1).AddChidren(openView.Show()); diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs index ec84597..e45f7e8 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs @@ -281,8 +281,8 @@ } - dialog.Close(); action(editTime.Text); + dialog.Close(); }; @@ -412,7 +412,6 @@ dialog.Close(); }; } - /// <summary> /// 闂敊鎻愮ず妗� /// </summary> diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs index cb77e0c..e4fff88 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs @@ -882,11 +882,13 @@ else if (LogicView.IfString._SoneLogic == if_logic) { //璺冲埌Sone闂ㄩ攣鑱斿姩浜嬩欢鍒楄〃鐣岄潰 - UserView.HomePage.Instance.RemoveViewByTag("SoneLogic");//绉婚櫎鎵�鏈夋爣璁癓ockListView鐣岄潰 - var soneLogicList = new SoneLogicList(); - UserView.HomePage.Instance.AddChidren(soneLogicList); - UserView.HomePage.Instance.PageIndex += 1; - soneLogicList.Show(); + //UserView.HomePage.Instance.RemoveViewByTag("SoneLogic");//绉婚櫎鎵�鏈夋爣璁癓ockListView鐣岄潰 + //var soneLogicList = new SoneLogicList(); + //UserView.HomePage.Instance.AddChidren(soneLogicList); + //UserView.HomePage.Instance.PageIndex += 1; + //soneLogicList.Show(); + + SoneLogicList.soneLogicList?.RefreshView(); } } diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs index adac499..a6cf276 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs @@ -245,7 +245,7 @@ }; fra.AddChidren(roomnameBtn); - if (i == 0)// + if (i == 0)//榛樿閫変腑绗竴涓埧闂� { roombjButton.IsSelected = false; roombjButton = roombjBtn; @@ -343,7 +343,17 @@ TextSize = 10, }; deviceRowLayout.AddChidren(devicetypename); - + + + //if (i == 0)//榛樿閫変腑绗竴涓澶囩被鍨� + //{ + // devicetypeButton.IsSelected = false; + // devicetypeButton = backgroundColor; + // backgroundColor.IsSelected = true; + // var list = Method.GetDeviceType(devicetypename.Text); + // ConditionDeviceView(list, devicelist); + //} + EventHandler<MouseEventArgs> devicetypeclick = (sender13, e13) => { devicetypeButton.IsSelected = false; @@ -361,6 +371,7 @@ ///鏄剧ず鎴块棿鎵�鏈夎澶� ConditionDeviceView(new List<DeviceType>(), devicelist); + } /// <summary> /// 鍔犺浇璇ョ被鍨嬭澶囪鍥炬柟娉� diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs index 432bf77..f2a23d6 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs @@ -242,8 +242,7 @@ logicScrolView.BeginHeaderRefreshingAction += () => { if (!Config.Instance.Home.IsVirtually) - { - //铏氭嫙鐨勪笉鑾峰彇缃戝叧閫昏緫鍒楄〃 + {//铏氭嫙鐨勪笉鑾峰彇缃戝叧閫昏緫鍒楄〃 //閲嶆柊鍒锋柊logic鍒楄〃 Common.Logic.LogicList.Clear(); Read(logicScrolView, no); @@ -262,6 +261,14 @@ /// <param name="logicScrolView"></param> private static async void Read(VerticalRefreshLayout logicScrolView, bool no) { + //if (Config.Instance.HomeId != UserCenter.UserCenterResourse.AccountOption.OldHomeStringId) + //{ + // //鍒囨崲浣忓畢娓呴櫎涔嬪墠缂撳瓨鏁版嵁; + // Common.Logic.LogicList.Clear(); + // Common.Logic.LockLogicList.Clear(); + // Common.Logic.SoneLogicList.Clear(); + //} + CommonPage.Loading.Start(); try { diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs index 26d0439..c78f7f4 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs @@ -8,34 +8,50 @@ { public class SoneLogicList : FrameLayout { - /// <summary> - /// 缁橲one闂ㄩ攣寰愭鏇存柊鐣岄潰鐢ㄧ殑 - /// </summary> - /// + + public static SoneLogicList soneLogicList; public SoneLogicList() { Tag = "SoneLogic"; + soneLogicList = this; } - /// <summary> - /// - /// </summary> - /// <param name="action">缁欏緪姊呭埛鏂扮晫闈㈢敤鐨�</param> - /// <param name="bool_If"></param> + /// 缁欏緪姊呭埛鏂扮晫闈㈢敤鐨� public Action<bool> action; + ///绗簩鍧楃涓�绾х埗鎺т欢 + FrameLayout fLayout = new FrameLayout(); + ///甯稿紑妯″紡鍥炬爣 + Button modeIconBtn = new Button(); + ///绗簩鍧楃浜岀骇鐖舵帶浠� + FrameLayout modeFl = new FrameLayout(); + Button button1 = new Button(); + Button button2= new Button(); + ///绗笁鍧楃涓�绾х埗鎺т欢 + FrameLayout listLogicFl = new FrameLayout(); + ///甯稿紑鑷姩鍖栧垪琛ㄤ笂涓嬫粦鍔ㄧ殑鎺т欢 + VerticalRefreshLayout verticalRefresh = new VerticalRefreshLayout(); + public async void Show() { - + #region 鐣岄潰鐨勫竷灞�浠g爜 UserView.HomePage.Instance.ScrollEnabled = false;//閿佷綇宸︽粦 TopView view = new TopView(); this.AddChidren(view.TopRowView()); - view.toptitleNameBtn.TextID = MyInternationalizationString.selection; + view.toptitleNameBtn.TextID = MyInternationalizationString.openmode; view.clickBtn.MouseDownEventHandler += (sender, e) => { UserView.HomePage.Instance.ScrollEnabled = true; - action(Send.CurrentDoorLock.IsDoorLockNormallyMode); - RemoveFromParent(); - + if (updateThread != null && updateThread.IsAlive) + { + updateThread.Abort(); + } + //鎶婇潤鎬佸彉閲忕殑杩欎釜涓滆タ缃┖ + soneLogicList = null; + this.RemoveFromParent(); + if (action != null) + { + action(Send.CurrentDoorLock.IsDoorLockNormallyMode); + } }; var middle = new FrameLayout @@ -49,7 +65,7 @@ #region 甯稿紑妯″紡鍥炬爣 鏃舵晥鎬у父寮�璁剧疆 ///绗簩鍧楃涓�绾х埗鎺т欢 - var fLayout = new FrameLayout + fLayout = new FrameLayout { Width = Application.GetRealWidth(1080), Height = Application.GetRealHeight(829 - 184), @@ -57,203 +73,35 @@ }; middle.AddChidren(fLayout); ///甯稿紑妯″紡鍥炬爣 - var modeIconBtn = new Button + modeIconBtn = new Button { X = Application.GetRealWidth(395), Y = Application.GetRealHeight(92), Width = Application.GetMinRealAverage(294), Height = Application.GetMinRealAverage(294), - UnSelectedImagePath = "ZigeeLogic/noMode.png", - SelectedImagePath = "ZigeeLogic/openMode.png", }; fLayout.AddChidren(modeIconBtn); - - if (Send.CurrentDoorLock.IsDoorLockNormallyMode) + ///绗簩鍧楃浜岀骇鐖舵帶浠� + modeFl = new FrameLayout { - /// 鏌ユ壘鏄惁瀛樺湪鏃舵晥鎬ц嚜鍔ㄥ寲锛涙湁鐨勮瘽灏辫繑鍥炶嚜鍔ㄥ寲瀵硅薄; - var logic = await SkipView.GetLogicIfon(); + }; + fLayout.AddChidren(modeFl); - fLayout.Height = Application.GetRealHeight(780);//鏀瑰彉楂樺害 - modeIconBtn.IsSelected = true;//鏀瑰彉鍥炬爣鐘舵�� - ///绗簩绾х埗鎺т欢 - var openModeFl = new FrameLayout - { - Y = Application.GetRealHeight(455), - Height = Application.GetRealHeight(127 + 199), - Width = Application.GetRealWidth(1080), - }; - fLayout.AddChidren(openModeFl); - ///鍏抽棴鏃舵晥鎬ц嚜鍔ㄥ寲 - Button closeBtn = new Button - { - X = Application.GetRealWidth(86), - Height = Application.GetRealHeight(127), - Width = Application.GetRealWidth(907), - Radius = (uint)Application.GetRealHeight(58), - BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, - TextID = MyInternationalizationString.closeUp, - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - TextSize = 16, - }; - openModeFl.AddChidren(closeBtn); - closeBtn.MouseUpEventHandler += async (sender, e) => - { - var result = await UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock); - if (result) - { - if (logic != null) - { - ///鏈夊彲鑳藉彧鏈夊父寮�妯″紡锛屾病鏈夋椂鏁堟�ц嚜鍔ㄥ寲 - ///娌℃湁鍒ゆ柇鐨勮瘽锛岄�昏緫浼氫负绌猴紝鎶涘嚭寮傚父; - Send.DelLogic(logic.LogicId); - } - Send.CurrentDoorLock.IsDoorLockNormallyMode = false; - this.RemoveFromParent(); - var soneLogicList = new SoneLogicList(); - UserView.HomePage.Instance.AddChidren(soneLogicList); - UserView.HomePage.Instance.PageIndex += 1; - soneLogicList.Show(); - action = soneLogicList.action; - - //娣诲姞鍘嗗彶璁板綍 - UserCenter.HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(Send.CurrentDoorLock, 9004, ""); - } - else - { - LogicView.TipView.ShowFlashTip("鍏抽棴澶辫触"); - } - - }; - - ///鏄剧ず澶辨晥璁剧疆鏃堕棿鏂囨湰鎺т欢 - var timeTextBtn = new Button - { - Y = Application.GetRealHeight(127 + 69), - X = Application.GetRealWidth(225), - Width = Application.GetRealWidth(634), - Height = Application.GetRealHeight(60), - TextSize = 15, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Text = "鏃舵晥鎬у父寮�璁剧疆12:20", - }; - if (logic != null) - { - ///鏈夋椂鏁堟�у父寮�鎵嶆樉绀烘椂闂存潯浠舵枃鏈� - openModeFl.AddChidren(timeTextBtn); - } - ///鏃舵晥鎬у父寮�鍙湁涓�涓潯浠�; - try - { - var y = DateTime.Now.ToString("yy");//閭d竴骞� - var m = DateTime.Now.ToString("mm");//閭d竴鏈� - var d = DateTime.Now.ToString("dd");//閭d竴澶� - var h = int.Parse(DateTime.Now.ToString("HH"));//褰撳墠绯荤粺鏃堕棿 - var me = DateTime.Now.ToLongDateString(); - var timeInt = int.Parse(logic.Conditions[0]["DoorLockOpenDelayTime"]); - int dayInt = (h + timeInt) / 24;//绠楀嚭鍑犲ぉ鍚庢墽琛� - int hour = (h + timeInt) % 24;//绠楀嚭鍑犲ぉ鍚庨偅涓椂闂存墽琛� - timeTextBtn.Text = "鏃舵晥鎬у父寮�璁剧疆" + y + "骞�" + m + "鏈�" + d + dayInt + "鍙�" + timeInt + "鏃�" + "鎵ц"; - } - catch { } - - } - else + button1 = new Button { - fLayout.Height = Application.GetRealHeight(645);//鏀瑰彉楂樺害 - modeIconBtn.IsSelected = false;//鏀瑰彉鍥炬爣鐘舵�� - ///绗簩绾х埗鎺т欢 - var modeFl = new FrameLayout - { - Y = Application.GetRealHeight(478), - X = Application.GetRealWidth(58), - Height = Application.GetRealHeight(138), - Width = Application.GetRealWidth(1022), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - fLayout.AddChidren(modeFl); - modeFl.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerTopLeft); - modeFl.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft); - ///鏃舵晥鎬у父寮�璁剧疆鏄剧ず鏂囨湰鎺т欢 - var modeTextBtn = new Button - { + }; + modeFl.AddChidren(button1); - Y = Application.GetRealHeight(40), - X = Application.GetRealWidth(58), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(60), - TextSize = 15, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - // Text = "鏃舵晥鎬у父寮�璁剧疆", - TextID = MyInternationalizationString.timeSetSone, - }; - modeFl.AddChidren(modeTextBtn); - ///涓嬩竴绾ц彍鍗曞浘鏍囨帶浠� - var nextIconBtn = new Button - { - Width = Application.GetMinRealAverage(104), - Height = Application.GetMinRealAverage(104), - X = Application.GetRealWidth(861), - Y = Application.GetRealHeight(17), - UnSelectedImagePath = "ZigeeLogic/nextIconSone.png", - }; - modeFl.AddChidren(nextIconBtn); - - - - nextIconBtn.MouseUpEventHandler += (sender, e) => - { - - LogicView.TipView.ShowConfrimTip(() => - - {///鍐嶆纭 - LogicView.TipView.ShowInputTip(true, async (str) => - {///纭鍙戦�佸懡浠� - try - { - ///xm - var result = await UserCenter.DoorLock.DoorLockCommonInfo.SetNormallyOpenModeFuncAsync(Send.CurrentDoorLock); - if (!result) - { - LogicView.TipView.ShowFlashTip("寮�鍚け璐�"); - return; - } - else - { - ///鍥犱负鏈夊父寮�妯″紡涓嬫墠鍙互鍒涘缓澶辨晥閫昏緫锛� - SkipView.GetLogicAll();//鍒犻櫎涔嬪墠鎵�鏈夊け鏁堥�昏緫 - var addResult = await SkipView.LockAddModifyLogic(int.Parse(str), Send.CurrentDoorLock);//娣诲姞涓�鏉″け鏁堥�昏緫 - if (!addResult) - { - ///鎻愮ず澶辫触 - LogicView.TipView.ShowFlashTip("娣诲姞澶辫触"); - return; - } - Send.CurrentDoorLock.IsDoorLockNormallyMode = true; - this.RemoveFromParent(); - var soneLogicList = new SoneLogicList(); - UserView.HomePage.Instance.AddChidren(soneLogicList); - UserView.HomePage.Instance.PageIndex += 1; - soneLogicList.Show(); - action = soneLogicList.action; - } - } - catch - { - - } - }); - - }); - - }; - } - + button2 = new Button + { + }; + modeFl.AddChidren(button2); + ModeView(); #endregion #region 甯稿紑鑷姩鍖� ///绗笁鍧楃涓�绾х埗鎺т欢 - var listLogicFl = new FrameLayout + listLogicFl = new FrameLayout { Y = fLayout.Bottom, X = Application.GetRealWidth(58), @@ -295,7 +143,16 @@ UnSelectedImagePath = "ZigeeLogic/add.png", }; addLogicfL.AddChidren(addIconBtn); - addIconBtn.MouseUpEventHandler += (sender, e) => + + var addIconclickBtn = new Button + { + Width = Application.GetRealWidth(90+69+63), + Height = Application.GetRealHeight(69), + X = Application.GetRealWidth(800), + Y = Application.GetRealHeight(60), + }; + addLogicfL.AddChidren(addIconclickBtn); + addIconclickBtn.MouseUpEventHandler += (sender, e) => { //璇诲彇绯荤粺褰撳墠鏃堕棿锛氭椂-鍒� @@ -333,7 +190,7 @@ }; ///甯稿紑鑷姩鍖栧垪琛ㄤ笂涓嬫粦鍔ㄧ殑鎺т欢 - var verticalRefresh = new VerticalRefreshLayout + verticalRefresh = new VerticalRefreshLayout { Y = addLogicfL.Bottom, @@ -345,17 +202,194 @@ verticalRefresh.BeginHeaderRefreshingAction += () => { Common.Logic.SoneLogicList.Clear(); - Read(verticalRefresh, false); + Read(false); verticalRefresh.EndHeaderRefreshing(); }; - Read(verticalRefresh, true); + Read(true); #endregion + } + /// <summary> + /// 甯稿紑妯″紡寮�鍏冲垏鎹㈠浘鏍囩晫闈� + /// </summary> + public async void ModeView() + { + + if (Send.CurrentDoorLock.IsDoorLockNormallyMode) + { + /// 鏌ユ壘鏄惁瀛樺湪鏃舵晥鎬ц嚜鍔ㄥ寲锛涙湁鐨勮瘽灏辫繑鍥炶嚜鍔ㄥ寲瀵硅薄; + var logic = await SkipView.GetLogicIfon(); + + fLayout.Height = Application.GetRealHeight(780);//鏀瑰彉楂樺害 + modeIconBtn.UnSelectedImagePath = "ZigeeLogic/openMode.png";//鏀瑰彉鍥炬爣鐘舵�� + modeFl.Y = modeIconBtn.Bottom + Application.GetRealHeight(64); + modeFl.X = Application.GetRealWidth(0); + modeFl.Height = Application.GetRealHeight(127 + 199); + modeFl.Width = Application.GetRealHeight(1080); + modeFl.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; + modeFl.SetCornerWithSameRadius(Application.GetRealHeight(0), HDLUtils.RectCornerBottomLeft); + + ///鍏抽棴鏃舵晥鎬ц嚜鍔ㄥ寲 + button1.Y = Application.GetRealHeight(0); + button1.X = Application.GetRealWidth(86); + button1.Width = Application.GetRealWidth(907); + button1.Height = Application.GetRealHeight(127); + button1.Radius = (uint)Application.GetRealHeight(58); + button1.BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor; + button1.TextAlignment = TextAlignment.Center; + button1.TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor; + button1.TextID = MyInternationalizationString.closeUp; + button1.TextSize = 16; + + button1.MouseUpEventHandler = async (sender, e) => + { + var result = await UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock); + if (result) + { + if (logic != null) + { + ///鏈夊彲鑳藉彧鏈夊父寮�妯″紡锛屾病鏈夋椂鏁堟�ц嚜鍔ㄥ寲 + ///娌℃湁鍒ゆ柇鐨勮瘽锛岄�昏緫浼氫负绌猴紝鎶涘嚭寮傚父; + Send.DelLogic(logic.LogicId); + } + Send.CurrentDoorLock.IsDoorLockNormallyMode = false; + ModeView(); + } + else + { + LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.closeFailed)); + } + + }; + if (logic != null) + { + ///鏄剧ず澶辨晥璁剧疆鏃堕棿鏂囨湰鎺т欢 + button2.Y = Application.GetRealHeight(127 + 69); + button2.X = Application.GetRealWidth(125); + button2.Width = Application.GetRealWidth(634 + 200); + button2.Height = Application.GetRealHeight(60); + button2.UnSelectedImagePath = "ZigeeLogic/1234.png"; + button2.TextSize = 15; + button2.TextColor = ZigbeeColor.Current.LogicTextBlackColor; + ///鏈夋椂鏁堟�у父寮�鎵嶆樉绀烘椂闂存潯浠舵枃鏈� + } + else + { + button2.Width = Application.GetRealWidth(0); + button2.Height = Application.GetRealHeight(0); + } + ///鏃舵晥鎬у父寮�鍙湁涓�涓潯浠�; + try + { + + var y = DateTime.Now.Year.ToString();//閭d竴骞� + var m = DateTime.Now.Month.ToString();//閭d竴鏈� + var d = DateTime.Now.ToString("dd");//閭d竴澶� + var h = int.Parse(DateTime.Now.ToString("HH"));//褰撳墠绯荤粺鏃堕棿 + var timeInt = int.Parse(logic.Conditions[0]["DoorLockOpenDelayTime"]); + int dayInt = (h + timeInt) / 24;//绠楀嚭鍑犲ぉ鍚庢墽琛� + int hour = (h + timeInt) % 24;//绠楀嚭鍑犲ぉ鍚庨偅涓椂闂存墽琛� + int days = int.Parse(d) + dayInt; + string text1 = Language.StringByID(MyInternationalizationString.timeSensitive); + string text2 = Language.StringByID(MyInternationalizationString.yearSone); + string text3 = Language.StringByID(MyInternationalizationString.monthSone); + string text4 = Language.StringByID(MyInternationalizationString.numberSone); + string text5 = Language.StringByID(MyInternationalizationString.executeSone); + button2.Text = text1 + y + text2 + m + text3 + days.ToString() + text4 + hour.ToString() + text5; + } + catch { } + + } + else + { + fLayout.Height = Application.GetRealHeight(645);//鏀瑰彉楂樺害 + modeIconBtn.UnSelectedImagePath = "ZigeeLogic/noMode.png";//鏀瑰彉鍥炬爣鐘舵�� + modeFl.Y = modeIconBtn.Bottom + Application.GetRealHeight(92); + modeFl.X = Application.GetRealWidth(58); + modeFl.Height = Application.GetRealHeight(138); + modeFl.Width = Application.GetRealHeight(1022); + modeFl.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; + modeFl.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft); + + ///鏃舵晥鎬у父寮�璁剧疆鏄剧ず鏂囨湰鎺т欢 + button1.Y = Application.GetRealHeight(40); + button1.X = Application.GetRealWidth(58); + button1.Width = Application.GetRealWidth(600); + button1.Height = Application.GetRealHeight(60); + button1.Radius = (uint)Application.GetRealHeight(0); + button1.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; + button1.TextAlignment = TextAlignment.CenterLeft; + button1.TextColor = ZigbeeColor.Current.LogicTextBlackColor; + // Text = "鏃舵晥鎬у父寮�璁剧疆", + button1.TextID = MyInternationalizationString.timeSetSone; + button1.TextSize = 15; + + + ///涓嬩竴绾ц彍鍗曞浘鏍囨帶浠� + button2.Width = Application.GetMinRealAverage(104); + button2.Height = Application.GetMinRealAverage(104); + button2.X = Application.GetRealWidth(861); + button2.Y = Application.GetRealHeight(17); + button2.UnSelectedImagePath = "ZigeeLogic/nextIconSone.png"; + button2.TextSize = 15; + button2.TextColor = ZigbeeColor.Current.LogicTextBlackColor; + button2.MouseUpEventHandler = (sender, e) => + { + + LogicView.TipView.ShowConfrimTip(() => + + {///鍐嶆纭 + LogicView.TipView.ShowInputTip(true, async (str) => + {///纭鍙戦�佸懡浠� + try + { + ///xm + var result = await UserCenter.DoorLock.DoorLockCommonInfo.SetNormallyOpenModeFuncAsync(Send.CurrentDoorLock); + if (!result) + { + LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.openFailed)); + return; + } + else + { + ///鍥犱负鏈夊父寮�妯″紡涓嬫墠鍙互鍒涘缓澶辨晥閫昏緫锛� + SkipView.GetLogicAll();//鍒犻櫎涔嬪墠鎵�鏈夊け鏁堥�昏緫 + var addResult = await SkipView.LockAddModifyLogic(int.Parse(str), Send.CurrentDoorLock);//娣诲姞涓�鏉″け鏁堥�昏緫 + if (!addResult) + { + ///鍙璇村鏋滃父寮�妯″紡寮�锛屽垱寤鸿嚜鍔ㄥ寲澶辫触锛岄偅涔堝皢瑕佸彂涓�鏉″父寮�妯″紡鍏抽棴鍛戒护; + UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock); + ///鎻愮ず澶辫触 + LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.addFailed)); + return; + } + Send.CurrentDoorLock.IsDoorLockNormallyMode = true; + ModeView(); + //娣诲姞App寮�鍚父寮�妯″紡鐨勫巻鍙茶褰� + UserCenter.HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(Send.CurrentDoorLock, 9001, string.Empty); + } + } + catch + { + + } + }); + + }); + + }; + } + + listLogicFl.Y = fLayout.Bottom; + listLogicFl.X = Application.GetRealWidth(58); + listLogicFl.Height = Application.GetRealHeight(Method.H - 184) - fLayout.Height; + listLogicFl.Width = Application.GetRealWidth(1022); + listLogicFl.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; } /// <summary> /// 璇诲彇鑷姩鍖栧垪琛ㄦ暟鎹紱 /// </summary> - /// <param name="verticalRefresh"></param> - private async void Read(VerticalRefreshLayout verticalRefresh, bool yes) + /// <param name="yes"></param> + private async void Read( bool yes) { if (yes) { @@ -386,41 +420,40 @@ var dd = e.Message; } //鑷姩鍖� - RefreshView(verticalRefresh); + RefreshView(); if (yes) { CommonPage.Loading.Hide(); } } + + RowLayout selectedRow = new RowLayout() { Tag = "0" };//璁板綍宸︽粦鐘舵�� + int a = 1; /// <summary> /// 鍔犺浇鑷姩鍖栧垪琛� /// </summary> - /// <param name="verticalRefresh"></param> - RowLayout selectedRow = new RowLayout() { Tag = "0" };//璁板綍宸︽粦鐘舵�� - int i = 1; - private void RefreshView(VerticalRefreshLayout verticalRefresh) + public void RefreshView() { verticalRefresh.RemoveAll(); foreach (var logic in Common.Logic.SoneLogicList) { #region 鑷姩鍖栧竷灞�View - ///鑷姩鍖栫埗鎺т欢 - var fLayout = new FrameLayout + var fLayoutLogic = new FrameLayout { Height = Application.GetRealHeight(184), }; - verticalRefresh.AddChidren(fLayout); + verticalRefresh.AddChidren(fLayoutLogic); ///宸﹀彸鍙粦鍔ㄦ帶浠� var logicRow = new RowLayout { LineColor = ZigbeeColor.Current.LogicBackgroundColor, BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, SubViewWidth = Application.GetRealWidth(184),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛� - Tag = i.ToString(), + Tag = a.ToString(), }; - fLayout.AddChidren(logicRow); + fLayoutLogic.AddChidren(logicRow); //宸︽粦鑿滃崟浜嬩欢 logicRow.OpenMenuAction += () => { @@ -430,7 +463,7 @@ } selectedRow = logicRow; }; - i++; + a++; ///鏄剧ず閫昏緫鍚嶇О鐨勬帶浠� var nameBtn = new Button { @@ -510,12 +543,12 @@ ///绾跨殑鎺т欢 var line = new Button { - Y = fLayout.Height - 1, + Y = fLayoutLogic.Height - 1, Height = 1, Width = Application.GetRealWidth(976), BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor, }; - fLayout.AddChidren(line); + fLayoutLogic.AddChidren(line); #endregion ///寮�鍏崇偣鍑讳簨浠� switchBtn.MouseUpEventHandler += (sender1, e1) => @@ -557,14 +590,39 @@ { Common.Logic.SoneLogicList.Remove(logic); //logicRow.Parent.RemoveFromParent(); - fLayout.RemoveFromParent(); + fLayoutLogic.RemoveFromParent(); Send.DelLogic(logic.LogicId); }; }; } - - } + + /// <summary> + /// 瀹氭椂鏇存柊甯稿紑妯″紡(闃叉閫氳繃闂ㄩ攣鍏抽棴娌″強鏃跺埛鏂扮姸鎬�) + /// </summary> + System.Threading.Thread updateThread; + public void UpdateModeIcon() + { + updateThread = new System.Threading.Thread(() => + { + while (this.Parent != null) + { + System.Threading.Thread.Sleep(1000); + Application.RunOnMainThread(() => + { + try + { + ModeView(); + } + catch { } + + }); + } + }); + updateThread.Start(); + } + + } } diff --git a/ZigbeeApp/Shared/Phone/Login/AccountLoginForm.cs b/ZigbeeApp/Shared/Phone/Login/AccountLoginForm.cs index 614f21d..b726d07 100755 --- a/ZigbeeApp/Shared/Phone/Login/AccountLoginForm.cs +++ b/ZigbeeApp/Shared/Phone/Login/AccountLoginForm.cs @@ -907,7 +907,7 @@ var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString()); var revertData = responseDataObj; //鏍囪涓婁竴娆℃槸涓嶆槸鍚屼竴涓处鍙风櫥闄� - UserCenter.UserCenterResourse.ResidenceOption.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid; + Config.Instance.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid; Config.Instance.Account = revertData.Account; Config.Instance.MD5PWD = revertData.MD5PWD; Config.Instance.Guid = revertData.Guid; @@ -1094,7 +1094,7 @@ var revertData = responseDataObj; Config.ReFresh(); //鏍囪涓婁竴娆℃槸涓嶆槸鍚屼竴涓处鍙风櫥闄� - UserCenterResourse.ResidenceOption.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid; + Config.Instance.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid; Config.Instance.Account = revertData.Account; Config.Instance.Password = i_psw; Config.Instance.MD5PWD = revertData.MD5PWD; diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceFreshAirDetailCardForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceFreshAirDetailCardForm.cs index a1a20dd..eb95779 100755 --- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceFreshAirDetailCardForm.cs +++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceFreshAirDetailCardForm.cs @@ -36,7 +36,6 @@ #endregion - #region 鈻� 鍒濆鍖朹____________________________ public override void InitMiddleFrameAfter(FrameLayout frameWhiteBack) { @@ -129,6 +128,13 @@ this.listControl.Add(btnHighSpeed); btnHighSpeed.ButtonClickEvent += (sender, e) => { + if (FreshAirDev.currentFanMode == 5) + { + var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AutoModeForbiddenOperate)); + msgContr.Show(); + return; + } + if (!btnHighSpeed.IsSelected) { this.SetFanComand(3); @@ -166,6 +172,12 @@ this.listControl.Add(btnLowSpeed); btnLowSpeed.ButtonClickEvent += (sender, e) => { + if (FreshAirDev.currentFanMode == 5) + { + var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AutoModeForbiddenOperate)); + msgContr.Show(); + return; + } if (!btnLowSpeed.IsSelected) { this.SetFanComand(1); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/ResidenceOption.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/ResidenceOption.cs index d623e7e..18d80cf 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/ResidenceOption.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/ResidenceOption.cs @@ -45,11 +45,6 @@ /// </summary> [Newtonsoft.Json.JsonIgnore] public int CategoryPageSwitchIndex = 0; - /// <summary> - /// 褰撳墠鐧诲綍鐨勮处鍙锋槸涓嶆槸涔嬪墠鐨勮处鍙� - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public bool TheSameLoginAccount = false; #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs index fcecdb3..e9c72d8 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs @@ -20,24 +20,27 @@ /// </summary> private bool hadRefresh = false; /// <summary> - /// 鍦ㄧ嚎鐘舵�� - /// </summary> - private bool m_isOnline = false; - /// <summary> /// 浼犳劅鍣ㄦ帹閫佷腑 /// </summary> private bool sensorPushing = false; /// <summary> /// 鍦ㄧ嚎鐘舵�� /// </summary> - public bool isOnline + private bool m_isOnline = true; + /// <summary> + /// 鍦ㄧ嚎鐘舵�� + /// </summary> + public bool IsOnline { get { return m_isOnline; } set { - m_isOnline = value; - //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥 - this.SetOnlineStatu(m_isOnline); + if (m_isOnline != value) + { + m_isOnline = value; + //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥 + this.SetOnlineStatu(m_isOnline); + } } } @@ -96,7 +99,7 @@ frameTable.AddBottomLine(); //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥 - this.isOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(listDevice[0]); + this.IsOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(listDevice[0]); } #endregion @@ -106,10 +109,10 @@ /// <summary> /// 璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥 /// </summary> - /// <param name="isOnline"></param> - private void SetOnlineStatu(bool isOnline) + /// <param name="i_isOnline"></param> + private void SetOnlineStatu(bool i_isOnline) { - if (isOnline == false) + if (i_isOnline == false) { btnDeviceName.TextColor = UserCenterColor.Current.TextGrayColor1; } @@ -143,8 +146,6 @@ btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]); //璁惧鎴块棿 btnDeviceRoom.Text = Common.LocalDevice.Current.GeteRealDeviceRoomName(listDevice[0]); - //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥 - this.isOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(listDevice[0]); } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs index 9dcce0d..f72e13c 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs @@ -26,18 +26,21 @@ /// <summary> /// 鍦ㄧ嚎鐘舵�� /// </summary> - private bool m_isOnline = false; + private bool m_isOnline = true; /// <summary> /// 鍦ㄧ嚎鐘舵�� /// </summary> - public bool isOnline + public bool IsOnline { get { return m_isOnline; } set { - m_isOnline = value; - //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥 - this.SetOnlineStatu(m_isOnline); + if (m_isOnline != value) + { + m_isOnline = value; + //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥 + this.SetOnlineStatu(m_isOnline); + } } } /// <summary> @@ -155,10 +158,10 @@ /// <summary> /// 璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥 /// </summary> - /// <param name="isOnline"></param> - private void SetOnlineStatu(bool isOnline) + /// <param name="i_isOnline"></param> + private void SetOnlineStatu(bool i_isOnline) { - if (isOnline == false) + if (i_isOnline == false) { btnDevie.TextColor = UserCenterColor.Current.TextGrayColor1; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs index b61989d..eaa2e2a 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs @@ -57,9 +57,12 @@ get { return m_IsOnline; } set { - m_IsOnline = value; - //鍙樻洿鐘舵�� - this.SetOnlineStatu(m_IsOnline); + if (m_IsOnline != value) + { + m_IsOnline = value; + //鍙樻洿鐘舵�� + this.SetOnlineStatu(m_IsOnline); + } } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs index 3e23033..2a1b88a 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs @@ -611,6 +611,9 @@ } //鍒囨崲缃戝叧,淇濆瓨缂撳瓨 this.SaveGatewayIdToLocation(gatewayId); + //鍒囨崲缃戝叧鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂� + UserView.UserPage.Instance.RefreshForm = true; + return true; } @@ -794,9 +797,8 @@ /// 鍒锋柊缃戝叧鐨勫湪绾跨姸鎬�(娉ㄦ剰,鍒锋柊鐨勬槸缂撳瓨,璇疯皟鐢–heckGatewayOnlineByFlag鏉ュ垽鏂槸鍚﹀湪绾�) /// </summary> /// <param name="listGateway"></param> - /// <param name="waitTime">灞�鍩熺綉鐨勬椂鍊�,鏃跺�欑瓑寰�3绉掑欢杩�</param> /// <returns></returns> - public void RefreshGatewayOnlineStatu(List<ZbGateway> listGateway, bool waitTime = true) + public void RefreshGatewayOnlineStatu(List<ZbGateway> listGateway) { var listRealWay = new List<ZbGateway>(); for (int i = 0; i < listGateway.Count; i++) @@ -811,29 +813,18 @@ { //铏氭嫙鐗╃悊缃戝叧 listRealWay.Add(listGateway[i]); - if (waitTime == false) - { - //涓嶇瓑寰呯殑璇�,鏍囪瘑鎸囧畾缃戝叧涓轰笉鍦ㄧ嚎 - this.SetGatewayNotOnLineFlag(listRealWay[i]); - } } - if (waitTime == true) - { - //鍙湁绛夊緟鐨勬椂鍊�,鎵嶆爣璇嗘寚瀹氱綉鍏充负涓嶅湪绾� - this.SetGatewayNotOnLineFlag(listRealWay[i]); - } + //鏍囪瘑鎸囧畾缃戝叧涓轰笉鍦ㄧ嚎 + listRealWay[i].GatewayOnlineFlage = false; } - if (waitTime == true) + //杩欐槸绗竴閬撳潕,寮哄埗妫�鏌IFI:绛夊緟2绉�(鍥犱负wifi鐨勬椂鍊欙紝瀹冧細鑷姩鍘诲埛鏂癴lage) + System.Threading.Thread.Sleep(2000); + //妫�鏌ユ槸鍚︽嫢鏈夌綉鍏冲瓨鍦ㄤ簬WIFi涓� + if (this.CheckHadGatewayInWifi(listRealWay) == false) { - //杩欐槸绗竴閬撳潕,寮哄埗妫�鏌IFI:绛夊緟2绉�(鍥犱负wifi鐨勬椂鍊欙紝瀹冧細鑷姩鍘诲埛鏂癴lage) - System.Threading.Thread.Sleep(2000); - //妫�鏌ユ槸鍚︽嫢鏈夌綉鍏冲瓨鍦ㄤ簬WIFi涓� - if (this.CheckHadGatewayInWifi(listRealWay) == false) - { - //绗簩閬撳潕锛氬湪杩滅▼鐨勬儏鍐典笅鍒锋柊缃戝叧鐨勫湪绾跨姸鎬� - this.RefreshGatewayOnlineOnRemode(listRealWay); - } + //绗簩閬撳潕锛氬湪杩滅▼鐨勬儏鍐典笅鍒锋柊缃戝叧鐨勫湪绾跨姸鎬� + this.RefreshGatewayOnlineOnRemode(listRealWay); } //鍒锋柊缂撳瓨鐨勫湪绾挎爣璇� @@ -845,7 +836,6 @@ continue; } this.dicGateway[gwID].GatewayOnlineFlage = zbway.GatewayOnlineFlage; - this.dicGateway[gwID].ReSave(); } } @@ -887,26 +877,11 @@ continue; } string strId = this.GetGatewayId(way); - if (dicDbGateway.ContainsKey(strId) == true //濡傛灉浜戠涓婇潰鏈夎繖涓綉鍏� - && dicDbGateway[strId].MqttOnlineStatus == true //濡傛灉浜戠涓婇潰杩欎釜缃戝叧鏄湪绾跨殑 - ) + if (dicDbGateway.ContainsKey(strId) == true) //濡傛灉浜戠涓婇潰鏈夎繖涓綉鍏� { - way.GatewayOnlineFlage = true; + way.GatewayOnlineFlage = dicDbGateway[strId].MqttOnlineStatus; } } - } - - /// <summary> - /// 鏍囪瘑鎸囧畾缃戝叧涓轰笉鍦ㄧ嚎 - /// </summary> - /// <param name="zbGateway"></param> - public void SetGatewayNotOnLineFlag(ZbGateway zbGateway) - { - if (zbGateway == null) - { - return; - } - zbGateway.GatewayOnlineFlage = false; } /// <summary> @@ -1924,272 +1899,6 @@ } } - #endregion - - #region 鈻� 缃戝叧鐩戣___________________________ - - #region 鈻� 鍙橀噺澹版槑___________________________ - - /// <summary> - /// 褰撳墠鐨勭綉缁滆繛鎺ユā寮� - /// </summary> - private GatewayConnectMode nowGwConnectMode = GatewayConnectMode.None; - /// <summary> - /// 鏄惁瀛樺湪缃戝叧姝e湪鍗囩骇 - /// </summary> - private bool hadGatewayUpdate = false; - - #endregion - - #region 鈻� 缃戝叧杩炴帴鏂瑰紡鍙樻洿___________________ - - /// <summary> - /// 褰撶綉鍏崇殑杩炴帴鏂瑰紡鏀瑰彉鏃�,妫�娴嬬綉鍏�,鐒跺悗鏄剧ず鐗规晥 - /// </summary> - /// <param name="connectMode">缃戝叧鍙樻洿鍚庣殑杩炴帴鏂瑰紡</param> - public void CheckGatewayByConnectChanged(GatewayConnectMode connectMode) - { - if (this.nowGwConnectMode == connectMode || this.hadGatewayUpdate == true) - { - //鐩稿悓鐨勮繛鎺ユā寮�,鎴栬�呮湁缃戝叧姝e湪鍗囩骇,鍒欎笉闇�瑕佹搷浣� - return; - } - - //娌℃湁缃戠粶 - if (connectMode == GatewayConnectMode.NoLine) - { - nowGwConnectMode = GatewayConnectMode.NoLine; - //鍦ㄨ繙绋嬬殑鏉′欢涓嬶紝妫�鏌ョ綉鍏崇殑鍦ㄧ嚎鐘舵��(缃戠粶鍙樻洿鏃惰Е鍙�) - } - //鍙互鍙�4G - else if (connectMode == GatewayConnectMode.Remote) - { - nowGwConnectMode = GatewayConnectMode.Remote; - //鍦ㄨ繙绋嬬殑鏉′欢涓嬶紝妫�鏌ョ綉鍏崇殑鍦ㄧ嚎鐘舵��(缃戠粶鍙樻洿鏃惰Е鍙�) - this.CheckGatewayStatuByRemote(); - } - //WIFI - else if (connectMode == GatewayConnectMode.WIFI) - { - nowGwConnectMode = GatewayConnectMode.WIFI; - //鍦╓IFI鐨勬潯浠朵笅锛屾鏌ョ綉鍏崇殑鍦ㄧ嚎鐘舵��(缃戠粶鍙樻洿鏃惰Е鍙�) - this.CheckGatewayStatuByWIFI(); - } - } - - #endregion - - #region 鈻� 妫�鏌ョ綉鍏�(WIFI)_____________________ - - /// <summary> - /// 鍦╓IFI鐨勬潯浠朵笅锛屾鏌ョ綉鍏崇殑鍦ㄧ嚎鐘舵��(缃戠粶鍙樻洿鏃惰Е鍙�) - /// </summary> - private void CheckGatewayStatuByWIFI() - { - if (this.dicGateway.Count == 0) - { - //濡傛灉鏈湴閮芥病鏈夌綉鍏崇殑璇濓紝涓嶉渶瑕佸鐞� - return; - } - - HdlThreadLogic.Current.RunThread(() => - { - var dicStatu = this.GetNowOnlineStatuBeforeCheck(); - //绛変釜3绉掞紝鍑嗗涓�涓� - System.Threading.Thread.Sleep(3000); - if (nowGwConnectMode != GatewayConnectMode.WIFI) - { - //缃戠粶涓存椂鍙樻洿锛燂紵 - return; - } - - //浠庣綉鍏宠幏鍙栧叏閮ㄧ殑缃戝叧 - List<ZbGateway> list = this.GetAllGatewayFromGateway(); - foreach (var way in list) - { - string gwId = this.GetGatewayId(way); - if (this.dicGateway.ContainsKey(gwId) == true) - { - //鍒锋柊涓�涓嬬紦瀛� - this.dicGateway[gwId].GatewayOnlineFlage = way.GatewayOnlineFlage; - } - if (this.CheckGatewayOnlineByFlag(way) == true) - { - //缃戝叧鍦ㄧ嚎 - dicStatu[gwId] = true; - } - } - //灏嗗彉鍖栫殑缃戝叧鎺ㄩ�佸埌鐣岄潰涓� - this.PushGatewayOnlineStatuToForm(dicStatu); - }); - } - - #endregion - - #region 鈻� 妫�鏌ョ綉鍏�(4G)_______________________ - - /// <summary> - /// 鍦ㄨ繙绋嬬殑鏉′欢涓嬶紝妫�鏌ョ綉鍏崇殑鍦ㄧ嚎鐘舵��(缃戠粶鍙樻洿鏃惰Е鍙�) - /// </summary> - private void CheckGatewayStatuByRemote() - { - if (this.dicGateway.Count == 0) - { - //濡傛灉鏈湴閮芥病鏈夌綉鍏崇殑璇濓紝涓嶉渶瑕佸鐞� - return; - } - - HdlThreadLogic.Current.RunThread(() => - { - //鍏堣幏鍙栫幇鍦ㄥ叏閮ㄧ殑缃戝叧锛屽垵鏈熷�よ缃负涓嶅湪绾� - var dicStatu = this.GetNowOnlineStatuBeforeCheck(); - - //鑾峰彇浜戠涓婇潰鐨勭綉鍏� - Dictionary<string, GatewayResult> dicDbGateway = HdlGatewayLogic.Current.GetGateWayListFromDataBase(); - if (nowGwConnectMode != GatewayConnectMode.Remote || dicDbGateway == null) - { - //缃戠粶涓存椂鍙樻洿锛燂紵 - return; - } - - bool hadOnline = false; - lock (dicGateway) - { - foreach (var way in this.dicGateway.Values) - { - //寰幆澶勭悊鏈湴鍏ㄩ儴鐨勭綉鍏冲垪琛� - string gwId = this.GetGatewayId(way); - if (dicDbGateway.ContainsKey(gwId) == true//濡傛灉浜戠涓婇潰鏈夎繖涓綉鍏� - && dicDbGateway[gwId].MqttOnlineStatus == true//濡傛灉浜戠涓婇潰杩欎釜缃戝叧鏄湪绾跨殑 - ) - { - dicGateway[gwId].GatewayOnlineFlage = true; - //瀹冩槸鍦ㄧ嚎鐨� - dicStatu[gwId] = true; - hadOnline = true; - } - } - } - - //灏嗗彉鍖栫殑缃戝叧鎺ㄩ�佸埌鐣岄潰涓� - this.PushGatewayOnlineStatuToForm(dicStatu); - - //濡傛灉娌℃湁缃戝叧鍦ㄧ嚎 - if (hadOnline == false) - { - //杩滅▼杩炴帴瓒呮椂,娌℃湁缃戝叧鍦ㄧ嚎 - string msg = Language.StringByID(R.MyInternationalizationString.uRemoteTimeOutAndNotGatewaiOnline); - //this.ShowTipMsg(msg); - } - }); - } - - #endregion - - #region 鈻� 妫�鏌ョ綉鍏�(鏃犵綉缁�)___________________ - - /// <summary> - /// 鍦ㄨ繙绋嬬殑鏉′欢涓嬶紝妫�鏌ョ綉鍏崇殑鍦ㄧ嚎鐘舵��(缃戠粶鍙樻洿鏃惰Е鍙�) - /// </summary> - private void CheckGatewayStatuByNotNet() - { - //褰撳墠鏃犵綉缁滆繛鎺�,璇风‘璁ょ綉缁� - string msg = Language.StringByID(R.MyInternationalizationString.uNowIsDonotNetworkAndCheckNetwork); - this.ShowTipMsg(msg); - } - - #endregion - - #region 鈻� 缃戝叧鎺ㄩ�乢__________________________ - - /// <summary> - /// 灏嗗彉鍖栫殑缃戝叧鎺ㄩ�佸埌鐣岄潰涓� - /// </summary> - /// <param name="dicStatu"></param> - private void PushGatewayOnlineStatuToForm(Dictionary<string, bool> dicStatu) - { - List<ZbGateway> listChange = new List<ZbGateway>(); - List<bool> listChangeStatu = new List<bool>(); - foreach (string gwid in dicStatu.Keys) - { - //缃戝叧涓嶅锛岀洿鎺ユ帹閫�,涓嶅垽鏂槸鍚︽敼鍙樹簡 - ZbGateway zbGateway = this.GetLocalGateway(gwid); - if (zbGateway != null) - { - listChange.Add(zbGateway); - listChangeStatu.Add(dicStatu[gwid]); - - zbGateway.GatewayOnlineFlage = dicStatu[gwid]; - } - } - - if (listChange.Count == 0) - { - return; - } - //淇濆瓨褰撳墠婵�娲荤殑鐣岄潰ID - var listId = new List<string>(); - listId.AddRange(UserCenterResourse.listActionFormId); - for (int i = 0; i < listId.Count; i++) - { - if (UserCenterResourse.DicActionForm.ContainsKey(listId[i]) == false) - { - continue; - } - //缃戝叧鍦ㄧ嚎鎺ㄩ�� - for (int j = 0; j < listChange.Count; j++) - { - UserCenterResourse.DicActionForm[listId[i]]?.GatewayOnlinePush(listChange[j], listChangeStatu[j]); - } - } - } - - #endregion - - #region 鈻� 涓�鑸柟娉昣__________________________ - - /// <summary> - /// 璁剧疆瀛樺湪缃戝叧姝e湪鍗囩骇鐨勬爣璇� - /// </summary> - /// <param name="update">鏄惁鏈夌綉鍏冲湪鍗囩骇</param> - public void SetHadGatewayUpdateFlage(bool update) - { - this.hadGatewayUpdate = update; - } - - /// <summary> - /// 鍦ㄧ綉缁滆繛鎺ュ彉鏇翠箣鍚庯紝缃戝叧杩炴帴妫�娴嬩箣鍓嶏紝璁剧疆鍏ㄩ儴缃戝叧涓虹绾跨姸鎬�(浠ユ湰鍦扮綉鍏充负鏍囧噯) - /// </summary> - /// <returns></returns> - private Dictionary<string, bool> GetNowOnlineStatuBeforeCheck() - { - //鍏堣幏鍙栫幇鍦ㄥ叏閮ㄧ殑缃戝叧 - List<ZbGateway> listOldGateway = this.GetAllGatewayFromGateway(); - var dicOldZb = new Dictionary<string, ZbGateway>(); - foreach (var zb in listOldGateway) - { - string gwID = this.GetGatewayId(zb); - dicOldZb[gwID] = zb; - } - - var dicStatu = new Dictionary<string, bool>(); - lock (dicGateway) - { - foreach (string gwId in this.dicGateway.Keys) - { - if (dicOldZb.ContainsKey(gwId) == true) - { - //鏍囪涓轰笉鍦ㄧ嚎 - this.SetGatewayNotOnLineFlag(dicOldZb[gwId]); - } - dicStatu[gwId] = false; - } - } - return dicStatu; - } - - #endregion - #endregion #region 鈻� 浠庝簯绔幏鍙栧叏閮ㄧ綉鍏冲垪琛↖D___________ @@ -2477,253 +2186,208 @@ #endregion - #region 鈻� 鎭㈠缃戝叧___________________________ + #region 鈻� 缃戝叧鐩戣___________________________ /// <summary> - /// 鎭㈠缃戝叧閰嶇疆 + /// 褰撳墠鐨勭綉缁滆繛鎺ユā寮� /// </summary> - /// <param name="zbGateway">缃戝叧瀵硅薄</param> - /// <param name="listGatewayFile">缃戝叧閲岄潰鎷ユ湁鐨勬枃浠�</param> - /// <param name="backDirectory">浜戠涓嬭浇鐨勫浠芥暟鎹殑鏂囦欢澶瑰悕瀛�</param> - /// <returns></returns> - public async Task<bool> RecoverGatewaySettion(ZbGateway zbGateway, List<string> listGatewayFile, string backDirectory) + private GatewayConnectMode nowGwConnectMode = GatewayConnectMode.None; + /// <summary> + /// 鏄惁瀛樺湪缃戝叧姝e湪鍗囩骇 + /// </summary> + private bool hadGatewayUpdate = false; + + /// <summary> + /// 褰撶綉鍏崇殑杩炴帴鏂瑰紡鏀瑰彉鏃�,璁板綍褰撳墠鐨勮繛鎺ユ柟寮� + /// </summary> + /// <param name="connectMode">缃戝叧鍙樻洿鍚庣殑杩炴帴鏂瑰紡</param> + public void CheckGatewayByConnectChanged(GatewayConnectMode connectMode) { - //鑾峰彇浠庝簯绔偅閲屽緱鏉ョ殑鍏ㄩ儴鏂囦欢 - var listBackFile = HdlAutoBackupLogic.GetFileFromDirectory(UserCenterLogic.CombinePath(backDirectory)); - listBackFile.Sort(); - //娣诲姞闄勫姞鎯呮姤:杩樺師璁惧閰嶇疆 - ProgressBar.SetAppendText(Language.StringByID(R.MyInternationalizationString.uRecoverDeviceSettion)); - ProgressBar.SetMaxValue(listBackFile.Count); - ProgressBar.Show(); - - var listSaveFile = new HashSet<string>(); - foreach (string fileName in listBackFile) - { - if (fileName.Length < 10 || fileName.StartsWith("Device_") == false) - { - //涓嶆槸璁惧澶囦唤鏂囦欢 - continue; - } - //鎭㈠璁惧閰嶇疆 - var result = await this.RecoverDeviceSettion(backDirectory, fileName); - if (result == -1) - { - ProgressBar.Close(); - return false; - } - if (result == 1 || result == 2) - { - listSaveFile.Add(fileName); - } - - ProgressBar.SetValue(1); - listGatewayFile.Remove(fileName); - } - //娣诲姞闄勫姞鎯呮姤:瑕嗙洊缃戝叧澶囦唤涓� - ProgressBar.SetAppendText(Language.StringByID(R.MyInternationalizationString.uGatewayBackupDataIsCovering)); - foreach (var file in listSaveFile) - { - //鍒涘缓鏂囦欢瀵硅薄 - var result = await zbGateway.CreateFileAsync(file); - if (result == null || result.Result != 0) - { - Application.RunOnMainThread(() => - { - //瑕嗙洊缃戝叧澶囦唤澶辫触 - string msg = Language.StringByID(R.MyInternationalizationString.uCoverGatewayBackupDataFail); - var control = new ShowMsgControl(ShowMsgType.Tip, msg); - control.Show(); - }); - ProgressBar.Close(); - return false; - } - //鍙戦�佹暟鎹祦 - var byteData = Shared.Common.Global.ReadFileByDirectory(backDirectory, file); - var result2 = await zbGateway.SendFileAsync(byteData); - if (result2 == null || result2.Result != 0) - { - Application.RunOnMainThread(() => - { - //瑕嗙洊缃戝叧澶囦唤澶辫触 - string msg = Language.StringByID(R.MyInternationalizationString.uCoverGatewayBackupDataFail); - var control = new ShowMsgControl(ShowMsgType.Tip, msg); - control.Show(); - }); - ProgressBar.Close(); - return false; - } - } - //鍒犻櫎澶氫綑鐨勬枃浠� - foreach (var deleteFile in listGatewayFile) - { - if (deleteFile.Length > 12) - { - string deviceFileName = deleteFile.Substring(5); - if (deviceFileName.StartsWith("Device_") == false) - { - //涓嶆槸璁惧鏂囦欢 - continue; - } - string[] strArry = deviceFileName.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries); - if (strArry.Length < 4 || listSaveFile.Contains(deleteFile) == true) - { - //鎴戜篃涓嶇煡閬撳畠鏄粈涔堟枃浠�,鎴栬�呰繖涓枃浠舵槸瑕嗙洊鐨� - continue; - } - //杩欎釜鎴栬鍙互涓嶇悊浠� - var result = await zbGateway.DelFileOrDirAsync("/etc/hdlDat/" + deleteFile); - } - } - ProgressBar.Close(); - - return true; + this.nowGwConnectMode = connectMode; } /// <summary> - /// 鎭㈠璁惧閰嶇疆 + /// 寮�鍚娴嬬綉鍏冲湪绾跨姸鎬佺殑绾跨▼(姝ゆ柟娉曟槸缁欒澶囧垪琛ㄧ晫闈㈢敤鐨�) /// </summary> - /// <param name="backDirectory">浜戠涓嬭浇鐨勫浠芥暟鎹殑鏂囦欢澶瑰悕瀛�</param> - /// <param name="backFileName">缃戝叧鐨勮澶囧浠藉悕瀛�</param> - /// <returns></returns> - private async Task<int> RecoverDeviceSettion(string backDirectory, string backFileName) + /// <param name="frameLayout">鐣岄潰瀵硅薄</param> + public void StartCheckGatewayOnlineThread(EditorCommonForm frameLayout) { - string deviceFileName = backFileName.Substring(0, backFileName.Length - 5); - string[] strArry = deviceFileName.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries); - if (strArry.Length < 4) + HdlThreadLogic.Current.RunThread(() => { - //鎴戜篃涓嶇煡閬撳畠鏄粈涔堟枃浠� - return 0; - } - var device = Common.LocalDevice.Current.GetDevice(strArry[2], Convert.ToInt32(strArry[3])); - if (device == null) - { - //杩欎釜璁惧涓嶈浜� - return 2; - } - - var byteData = Shared.Common.Global.ReadFileByDirectory(backDirectory, backFileName); - var backType = (GatewayBackupEnum)Convert.ToInt32(backFileName.Substring(backFileName.Length - 5, 5)); - - bool result = true; - if (backType == GatewayBackupEnum.AMac鍚嶇О) - { - var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(System.Text.Encoding.UTF8.GetString(byteData)); - result = await Common.LocalDevice.Current.ReMacName(new List<CommonDevice>() { device }, recoverData); - } - else if (backType == GatewayBackupEnum.A绔偣鍚嶇О) - { - var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(System.Text.Encoding.UTF8.GetString(byteData)); - result = await Common.LocalDevice.Current.ReName(device, recoverData); - } - else if (backType == GatewayBackupEnum.APir鐏厜閰嶇疆) - { - var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<IASZone.ConfigureParamates>(System.Text.Encoding.UTF8.GetString(byteData)); - result = await HdlDevicePirSensorLogic.Current.SetPirSensorSettion((IASZone)device, recoverData); - } - else if (backType == GatewayBackupEnum.A骞叉帴鐐归鑹茶皟鑺�) - { - var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel.KeyColorData>(System.Text.Encoding.UTF8.GetString(byteData)); - result = await HdlDevicePanelLogic.Current.SetPanelEpointColorInfo((Panel)device, recoverData); - } - else if (backType == GatewayBackupEnum.A骞叉帴鐐逛寒搴﹁皟鑺�) - { - var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<Newtonsoft.Json.Linq.JObject>(System.Text.Encoding.UTF8.GetString(byteData)); - int directionsLevel = Convert.ToInt32(recoverData["directionsLevel"]); - int backlightLevel = Convert.ToInt32(recoverData["backlightLevel"]); - result = await HdlDevicePanelLogic.Current.SetDeviceLightSettion((Panel)device, directionsLevel, backlightLevel); - } - else if (backType == GatewayBackupEnum.A骞叉帴鐐硅妭鑳芥ā寮�) - { - var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<Newtonsoft.Json.Linq.JObject>(System.Text.Encoding.UTF8.GetString(byteData)); - bool modeEnable = Convert.ToBoolean(recoverData["modeEnable"]); - int modeTime = Convert.ToInt32(recoverData["modeTime"]); - int level = Convert.ToInt32(recoverData["level"]); - result = await HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode((Panel)device, modeEnable, modeTime, level); - } - else if (backType == GatewayBackupEnum.A骞叉帴鐐圭涓夌骇鍒鏈夊睘鎬�) - { - var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(System.Text.Encoding.UTF8.GetString(byteData)); - result = await HdlDevicePanelLogic.Current.EditorDryContactThirdFunction((Panel)device, recoverData); - } - else if (backType == GatewayBackupEnum.A绐楀笜鏂瑰悜) - { - var statu = Newtonsoft.Json.JsonConvert.DeserializeObject<bool>(System.Text.Encoding.UTF8.GetString(byteData)); - result = await HdlDeviceCurtainLogic.Current.SetCurtainDirection((Rollershade)device, statu); - } - else if (backType == GatewayBackupEnum.A绐楀笜鎵嬫媺鎺у埗) - { - var statu = Newtonsoft.Json.JsonConvert.DeserializeObject<bool>(System.Text.Encoding.UTF8.GetString(byteData)); - result = await HdlDeviceCurtainLogic.Current.SetHandPullControl((Rollershade)device, statu); - } - else if (backType == GatewayBackupEnum.A绐楀笜涓婁笅闄愪綅) - { - var curtainDevice = (Rollershade)device; - var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<Newtonsoft.Json.Linq.JObject>(System.Text.Encoding.UTF8.GetString(byteData)); - int upLimit = Convert.ToInt32(recoverData["upLimit"]); - int downLimit = Convert.ToInt32(recoverData["downLimit"]); - //鍏堥噸缃獥甯� - result = await HdlDeviceCurtainLogic.Current.RestoreCurtain(curtainDevice); - if (result == false) { return -1; } - await Task.Delay(5000); - //閲嶇疆涓婇檺浣� - result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.UpLimit); - if (result == false) { return -1; } - //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣� - curtainDevice.WcdGoToTiltValue(upLimit); - await Task.Delay(3000); - //鎵ц纭鍙婅鐩栫獥甯橀檺浣嶇偣 - result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit, -1, -1); - if (result == false) { return -1; } - - await Task.Delay(2000); - //閲嶇疆涓嬮檺浣� - result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.DownLimit); - if (result == false) { return -1; } - //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣� - curtainDevice.WcdGoToTiltValue(downLimit); - await Task.Delay(3000); - //鎵ц纭鍙婅鐩栫獥甯橀檺浣嶇偣 - result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit, -1, -1); - } - else if (backType == GatewayBackupEnum.A绌鸿皟鑷畾涔夋ā寮�) - { - var data = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(System.Text.Encoding.UTF8.GetString(byteData)); - result = await HdlDeviceAirConditionerLogic.Current.SetAcModeSupport((AC)device, data); - if (result == true) + int waitCount = 0; + //濡傛灉浣忓畢ID鍙樻洿浜�,鍒欎笉鍐嶅鐞� + while (frameLayout.Parent != null) { - //杞崲涓轰簩杩涘埗 - var value = Convert.ToString(data, 2).PadLeft(16, '0'); - //杩欎簲涓缃槸鏀惧湪鍚庨潰鐨� - var fixValue = value.Substring(0, value.Length - 5); - var reportValue = value.Substring(fixValue.Length); - //鏇存敼缂撳瓨 - for (int i = 0; i < reportValue.Length; i++) + System.Threading.Thread.Sleep(1000); + if (this.hadGatewayUpdate == true) { - ((AC)device).listSupportMode[i] = Convert.ToInt32(reportValue[i]); + //缃戝叧姝e湪鍗囩骇,涓嶉渶瑕佹搷浣� + continue; } - device.ReSave(); + + waitCount++; + if (this.nowGwConnectMode == GatewayConnectMode.Remote) + { + //杩滅▼姣�10绉掓娴嬩竴娆� + if (waitCount < 10) { continue; } + } + else if (this.nowGwConnectMode == GatewayConnectMode.WIFI) + { + //灞�鍩熺綉姣�3绉掓娴嬩竴娆� + if (waitCount < 3) { continue; } + } + waitCount = 0; + + //鑾峰彇鍓嶅洖缃戝叧鐨勫湪绾跨姸鎬� + Dictionary<string, bool> dicOldOnline = this.GetOldGatewayOnlineStatu(); + if (dicOldOnline == null) + { + //鍒欎笉澶勭悊 + continue; + } + //鍙互鍙�4G + if (this.nowGwConnectMode == GatewayConnectMode.Remote) + { + //鍦ㄨ繙绋嬬殑鏉′欢涓嬶紝妫�鏌ョ綉鍏崇殑鍦ㄧ嚎鐘舵�� + this.CheckGatewayStatuByRemote(dicOldOnline); + } + //WIFI + else if (this.nowGwConnectMode == GatewayConnectMode.WIFI) + { + //鍦╓IFI鐨勬潯浠朵笅锛屾鏌ョ綉鍏崇殑鍦ㄧ嚎鐘舵�� + this.CheckGatewayStatuByWIFI(dicOldOnline); + } + } + }, ShowErrorMode.NO); + } + + /// <summary> + /// 鍦╓IFI鐨勬潯浠朵笅锛屾鏌ョ綉鍏崇殑鍦ㄧ嚎鐘舵�� + /// </summary> + private void CheckGatewayStatuByWIFI(Dictionary<string, bool> dicOldOnline) + { + //浠庣綉鍏宠幏鍙栧叏閮ㄧ殑缃戝叧 + List<ZbGateway> list = this.GetAllGatewayFromGateway(); + foreach (var way in list) + { + //灏嗘爣璇嗙疆涓篺alse + way.GatewayOnlineFlage = false; + } + //绛変釜2绉� + System.Threading.Thread.Sleep(2000); + + foreach (var way in list) + { + string gwId = this.GetGatewayId(way); + if (dicOldOnline.ContainsKey(gwId) == true) + { + //缃戝叧涔熶笉澶�,鐩存帴鎺ㄩ�佸惂 + this.PushGatewayOnlineStatuToForm(gwId, way.GatewayOnlineFlage); + } + else + { + //娌℃湁鍖呭惈,榛樿涓篺alse + this.PushGatewayOnlineStatuToForm(gwId, false); } } - return result == true ? 1 : -1; + } + + /// <summary> + /// 鍦ㄨ繙绋嬬殑鏉′欢涓嬶紝妫�鏌ョ綉鍏崇殑鍦ㄧ嚎鐘舵�� + /// </summary> + private void CheckGatewayStatuByRemote(Dictionary<string, bool> dicOldOnline) + { + //鑾峰彇浜戠涓婇潰鐨勭綉鍏� + Dictionary<string, GatewayResult> dicDbGateway = HdlGatewayLogic.Current.GetGateWayListFromDataBase(); + if (dicDbGateway == null) + { + //濡傛灉缃戠粶涓嶉��,鍒欎篃寰�涓嬭蛋 + dicDbGateway = new Dictionary<string, GatewayResult>(); + } + + foreach (var gwId in dicOldOnline.Keys) + { + //濡傛灉浜戠涓婇潰鏈夎繖涓綉鍏� + if (dicDbGateway.ContainsKey(gwId) == true) + { + //缃戝叧涔熶笉澶�,鐩存帴鎺ㄩ�� + this.PushGatewayOnlineStatuToForm(gwId, dicDbGateway[gwId].MqttOnlineStatus); + } + else + { + //浜戠涓嶅寘鍚殑,褰撲笉鍦ㄧ嚎澶勭悊 + this.PushGatewayOnlineStatuToForm(gwId, false); + } + } + + + } + + /// <summary> + /// 鑾峰彇鍓嶅洖缃戝叧鐨勫湪绾跨姸鎬� + /// </summary> + /// <returns></returns> + private Dictionary<string, bool> GetOldGatewayOnlineStatu() + { + if (this.dicGateway.Count == 0) + { + //娌℃湁缃戝叧,鍒欎笉澶勭悊 + return null; + } + + try + { + var dicOldOnline = new Dictionary<string, bool>(); + //濡傛灉鍦ㄥ惊鐜殑杩囩▼涓�,鍔ㄤ簡閲岄潰鐨勪笢瑗�,鎶ラ敊鍒欎笉鐞嗗畠,涓嬩竴鍥炲悎 + foreach (var zbway in this.dicGateway.Values) + { + //鑾峰彇鍓嶅洖鐨勫湪绾跨姸鎬� + string gwId = this.GetGatewayId(zbway); + dicOldOnline[gwId] = zbway.GatewayOnlineFlage; + } + return dicOldOnline; + } + catch { return null; } + } + + /// <summary> + /// 灏嗗彉鍖栫殑缃戝叧鎺ㄩ�佸埌鐣岄潰涓� + /// </summary> + /// <param name="gwId"></param> + /// <param name="online"></param> + private void PushGatewayOnlineStatuToForm(string gwId, bool online) + { + try + { + for (int i = 0; i < UserCenterResourse.listActionFormId.Count; i++) + { + string formId = UserCenterResourse.listActionFormId[i]; + if (UserCenterResourse.DicActionForm.ContainsKey(formId) == false) + { + continue; + } + //缃戝叧鍦ㄧ嚎鎺ㄩ�� + var zbway = this.GetLocalGateway(gwId); + zbway.GatewayOnlineFlage = online; + + UserCenterResourse.DicActionForm[formId]?.GatewayOnlinePush(zbway, online); + } + } + catch { } + } + + /// <summary> + /// 璁剧疆瀛樺湪缃戝叧姝e湪鍗囩骇鐨勬爣璇� + /// </summary> + /// <param name="update">鏄惁鏈夌綉鍏冲湪鍗囩骇</param> + public void SetHadGatewayUpdateFlage(bool update) + { + this.hadGatewayUpdate = update; } #endregion - #region 鈻� 涓�鑸柟娉昣__________________________ - - /// <summary> - /// 寮瑰嚭缃戝叧涓嶅湪绾跨殑 - /// </summary> - private void ShowGatewayNotOnlineMsg() - { - Application.RunOnMainThread(() => - { - //缃戝叧杩炴帴澶辫触,璇风‘璁ょ綉缁� - string msg = Language.StringByID(R.MyInternationalizationString.uGatewayIsNotLinkAndCheckNetwork); - var control = new ShowMsgControl(ShowMsgType.Tip, msg); - control.Show(); - }); - } + #region 鈻� 涓�鑸柟娉昣__________________________ /// <summary> /// 鏄剧ず閿欒淇℃伅绐楀彛 diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs index c4d3d74..0e0fbce 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs @@ -582,13 +582,18 @@ tempDevice.IsOnline = Convert.ToInt32(receiveData["Data"]["IsOnline"].ToString()); //澶勭悊缃戝叧涓婃姤鐨勬暟鎹�,鐒跺悗鍙樻洿鏈湴缂撳瓨 - var locadevice = Common.LocalDevice.Current.GetDevice(tempDevice.DeviceAddr, tempDevice.DeviceEpoint); - if (locadevice != null) + var locadevice = Common.LocalDevice.Current.GetDevicesByMac(tempDevice.DeviceAddr); + for (int i = 0; i < locadevice.Count; i++) { - locadevice.IsOnline = tempDevice.IsOnline; + bool onlineChanged = locadevice[i].IsOnline != tempDevice.IsOnline; + locadevice[i].IsOnline = tempDevice.IsOnline; //璁板綍鍥炲鏃堕棿 - locadevice.LastDateTime = DateTime.Now; - locadevice.ReSave(); + locadevice[i].LastDateTime = DateTime.Now; + if (onlineChanged == true) + { + //鍦ㄧ嚎鐘舵�佸彉鏇翠簡,鎵嶄繚瀛� + locadevice[i].ReSave(); + } } this.DeviceReportPush(tempDevice, ReceiveComandDiv.A璁惧鍦ㄧ嚎涓婃姤); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs index d141bc1..76799e9 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs @@ -869,7 +869,7 @@ UserCenterResourse.ResidenceOption = UserCenterResourse.ResidenceOption.Load(); //鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅 - var hadNet = await InitUserAccoutInfo(); + var hadNet = await InitUserAccoutInfo(true); //濡傛灉鏈夌綉缁滅殑璇� if (hadNet == true) { @@ -990,14 +990,18 @@ /// <summary> /// 鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅 /// </summary> + /// <param name="reLoad">鏄惁浠庢柊浠庢湰鍦板姞杞�(閲嶆柊鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅,涓嶉渶瑕侀噸鏂板姞杞�)</param> /// <returns></returns> - private async static Task<bool> InitUserAccoutInfo() + private async static Task<bool> InitUserAccoutInfo(bool reLoad) { //鍒濆鍖栦釜浜轰俊鎭殑鏍囪瘑 UserCenterResourse.UserInfo.InitUserInfoSuccess = false; - //鑾峰彇鏈湴璁板綍鐨勭敤鎴蜂俊鎭� - UserCenterResourse.UserInfo = GetUserInformationFromLocation(); - UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png"); + if (reLoad == true) + { + //鑾峰彇鏈湴璁板綍鐨勭敤鎴蜂俊鎭� + UserCenterResourse.UserInfo = GetUserInformationFromLocation(); + UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png"); + } //鑾峰彇鐧诲綍璐﹀彿鐨勪俊鎭� var pra = new AccountInfoPra(); @@ -1120,7 +1124,7 @@ private async static Task<bool> ReInitUserAccoutInfo() { //閲嶆柊鍒濆鍖栬处鍙蜂俊鎭� - var result = await InitUserAccoutInfo(); + var result = await InitUserAccoutInfo(false); if (result == false) { return result; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs index cfdf0b0..774d509 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs @@ -45,6 +45,9 @@ listNewDevice.Add(Common.LocalDevice.Current.GetOTADevice(deviceMac)); } + //娣诲姞鏂拌澶囩殑璇�,涓婚〉闇�瑕侀噸鏂板埛鏂� + UserView.UserPage.Instance.RefreshForm = true; + //璁剧疆鏍囬淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs index 4d4c692..b98b37a 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs @@ -30,10 +30,6 @@ /// </summary> private Dictionary<string, DeviceObjRowInfo> dicRowInfo = new Dictionary<string, DeviceObjRowInfo>(); /// <summary> - /// 閲嶆柊鑾峰彇璁惧鐨勫湪绾跨姸鎬� - /// </summary> - private bool reGetDeviceOnlineStatu = false; - /// <summary> /// 褰撳墠姝e湪鎿嶄綔鐨勮澶囧璞ac鍦板潃(璁惧淇℃伅缂栬緫鐣岄潰鐢�) /// </summary> private string nowActionDeviceMac = null; @@ -65,15 +61,28 @@ //鍒濆鍖栦腑閮ㄦ帶浠� this.InitMiddleFrame(); + + //寮�鍚紶鎰熷櫒鎶ヨ鐩戣 + this.StartCheckDeviceAlarm(); + //娣诲姞鎺ユ敹璁惧鍦ㄧ嚎涓婃姤鐨勭洃鍚� + HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceListFormReceivePushOnline", ReceiveComandDiv.A璁惧鍦ㄧ嚎涓婃姤, (report) => + { + HdlThreadLogic.Current.RunMain(() => + { + //鎺ュ彈璁惧鐘舵�� + this.ReceiveDeviceStatu(report); + + }, ShowErrorMode.NO); + }); + //寮�鍚娴嬬綉鍏冲湪绾跨姸鎬佺殑绾跨▼ + HdlGatewayLogic.Current.StartCheckGatewayOnlineThread(this); } /// <summary> /// 鍒濆鍖栦腑閮ㄦ帶浠�(澶栭儴鍙互璋冪敤) /// </summary> - /// <param name="i_reGetDeviceOnlineStatu">閲嶆柊鑾峰彇璁惧鐨勫湪绾跨姸鎬�</param> - public void InitMiddleFrame(bool i_reGetDeviceOnlineStatu = true) + public void InitMiddleFrame() { - this.reGetDeviceOnlineStatu = i_reGetDeviceOnlineStatu; //娓呯┖bodyFrame this.ClearBodyFrame(); @@ -125,6 +134,9 @@ frame.AddChidren(listView); listView.BeginHeaderRefreshingAction += () => { + //鍒锋柊璁惧鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂� + UserView.UserPage.Instance.RefreshForm = true; + HdlThreadLogic.Current.RunThread(() => { //涓嬫媺鍒锋柊 @@ -348,8 +360,7 @@ //鍙崇澶� rowDevice.frameTable.AddRightArrow(); //鍦ㄧ嚎鐘舵�� - rowDevice.isOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(device); - + rowDevice.IsOnline = rowInfo.MenuRow.IsOnline; //淇濆瓨鎺т欢 string maikey = Common.LocalDevice.Current.GetDeviceMainKeys(device); rowInfo.dicDetailRow[maikey] = rowDevice; @@ -646,7 +657,7 @@ if (result != -1) { //閲嶆柊鍒锋柊鐣岄潰 - this.InitMiddleFrame(false); + this.InitMiddleFrame(); } }); } @@ -676,9 +687,10 @@ if (this.gatewayViewRow != null && this.gatewayViewRow.zbGatewayId == selectGwId) { bool online = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbGateway); - this.gatewayViewRow.RefreshControl(); - //寮�鍚澶囧湪绾跨嚎绋� - this.StartDeviceListControlThread(online); + //鍒锋柊鎺т欢鍦ㄧ嚎鐘舵�� + this.gatewayViewRow?.RefreshOnlineStatu(); + //鏍规嵁缃戝叧鍦ㄧ嚎鐘舵�佸埛鏂拌澶囧湪绾跨姸鎬� + this.RefreshDeviceOnlineStatuByGatewayOnline(online); } }); }); @@ -699,7 +711,14 @@ { Application.RunOnMainThread(() => { - this.gatewayViewRow?.RefreshControl(); + //鐩稿悓鐨勭姸鎬�,涓嶉渶瑕佸啀娆″埛鏂� + if (this.gatewayViewRow.isOnline != online) + { + //鏍规嵁缃戝叧鍦ㄧ嚎鐘舵�佸埛鏂拌澶囧湪绾跨姸鎬� + this.RefreshDeviceOnlineStatuByGatewayOnline(online); + } + //鍒锋柊鎺т欢鍦ㄧ嚎鐘舵�� + this.gatewayViewRow?.RefreshOnlineStatu(); }); } } @@ -709,52 +728,43 @@ #region 鈻� 璁惧鍦ㄧ嚎妫�娴媉______________________ /// <summary> - /// 寮�鍚澶囧湪绾跨嚎绋� + /// 鏍规嵁缃戝叧鍦ㄧ嚎鐘舵�佸埛鏂拌澶囧湪绾跨姸鎬� /// </summary> /// <param name="gatewayOnline">缃戝叧鐨勫湪绾跨姸鎬�</param> - private void StartDeviceListControlThread(bool gatewayOnline) + private void RefreshDeviceOnlineStatuByGatewayOnline(bool gatewayOnline) { if (gatewayOnline == false) { //璁剧疆鍏ㄩ儴璁惧绂荤嚎 this.SetAllDeviceOffLine(); - return; } - //寮�鍚紶鎰熷櫒鎶ヨ鐩戣 - this.StartCheckDeviceAlarm(); - //寮�鍚澶囧湪绾跨洃娴� - this.StartCheckDeviceOnline(); + else + { + //鍒锋柊璁惧鍦ㄧ嚎鐘舵�� + this.RefreshDeviceOnlineStatu(); + } } /// <summary> - /// 寮�鍚澶囧湪绾跨洃娴� + /// 鍒锋柊璁惧鍦ㄧ嚎鐘舵�� /// </summary> - private void StartCheckDeviceOnline() + private void RefreshDeviceOnlineStatu() { - //澶栭儴璋冪敤鐨勮瘽,涓嶅啀閲嶆柊鑾峰彇璁惧鐘舵�� - if (this.reGetDeviceOnlineStatu == false) - { - return; - } - - //娣诲姞鎺ユ敹璁惧鍦ㄧ嚎涓婃姤鐨勭洃鍚� - HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceListFormReceivePushOnline", ReceiveComandDiv.A璁惧鍦ㄧ嚎涓婃姤, this.ReceiveDeviceStatu); - string gwId = GatewayResourse.NowSelectGatewayId; HdlThreadLogic.Current.RunThread(() => { + System.Threading.Thread.Sleep(2000); //杩欓噷涓昏鍙槸鑾峰彇鍦ㄧ嚎鐘舵�� - var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId); - int statu = 0; - var list = LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO); - if (statu != -1) + var list = LocalDevice.Current.GetDeviceOnlineList(gwId); + HdlThreadLogic.Current.RunMain(() => { for (int i = 0; i < list.Count; i++) { //璁剧疆璁惧鍦ㄧ嚎鐘舵�� this.ReceiveDeviceStatu(list[i]); } - } + + }, ShowErrorMode.NO); }); } @@ -788,20 +798,14 @@ localDevice.ReSave(); } - HdlThreadLogic.Current.RunMain(() => + rowInfo.MenuRow.IsOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(device); + if (rowInfo.dicDetailRow != null) { - if (rowInfo != null) + foreach (var detailRow in rowInfo.dicDetailRow.Values) { - rowInfo.MenuRow.isOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(device); - if (rowInfo.dicDetailRow != null) - { - foreach (var detailRow in rowInfo.dicDetailRow.Values) - { - detailRow.isOnline = rowInfo.MenuRow.isOnline; - } - } + detailRow.IsOnline = rowInfo.MenuRow.IsOnline; } - }); + } } /// <summary> @@ -809,17 +813,20 @@ /// </summary> private void SetAllDeviceOffLine() { - lock (dicRowInfo) + foreach (var rowInfo in this.dicRowInfo.Values) { - foreach (var rowInfo in this.dicRowInfo.Values) + //鑿滃崟 + if (rowInfo.MenuRow != null) { - Application.RunOnMainThread(() => + rowInfo.MenuRow.IsOnline = false; + } + //鏄庣粏 + if (rowInfo.dicDetailRow != null) + { + foreach (var detailRow in rowInfo.dicDetailRow.Values) { - if (rowInfo.MenuRow != null) - { - rowInfo.MenuRow.isOnline = false; - } - }); + detailRow.IsOnline = false; + } } } } @@ -1082,6 +1089,10 @@ /// 缃戝叧鍚嶅瓧鎺т欢 /// </summary> private NormalViewControl btnName = null; + /// <summary> + /// 鍦ㄧ嚎鐘舵�� + /// </summary> + public bool isOnline = false; /// <summary> /// 鑷畾涔夌綉鍏虫帶浠� @@ -1124,7 +1135,9 @@ if (zbway != null) { btnName.Text = HdlGatewayLogic.Current.GetGatewayName(zbway); - if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway) == false) + //鍦ㄧ嚎鐘舵�� + this.isOnline = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway); + if (this.isOnline == false) { btnName.TextColor = UserCenterColor.Current.TextGrayColor1; } @@ -1176,13 +1189,34 @@ return; } btnName.Text = HdlGatewayLogic.Current.GetGatewayName(zbway); - if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway) == false) + //鍒锋柊鎺т欢鍦ㄧ嚎鐘舵�� + this.RefreshOnlineStatu(); + } + + /// <summary> + /// 鍒锋柊鎺т欢鍦ㄧ嚎鐘舵�� + /// </summary> + public void RefreshOnlineStatu() + { + //鑾峰彇鏈湴缃戝叧瀵硅薄 + ZbGateway zbway = HdlGatewayLogic.Current.GetLocalGateway(zbGatewayId); + if (zbway == null) { - btnName.TextColor = UserCenterColor.Current.TextGrayColor1; + return; } - else + //鍦ㄧ嚎鐘舵�� + bool statu = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway); + if (this.isOnline != statu) { - btnName.TextColor = UserCenterColor.Current.TextColor1; + this.isOnline = statu; + if (this.isOnline == false) + { + btnName.TextColor = UserCenterColor.Current.TextGrayColor1; + } + else + { + btnName.TextColor = UserCenterColor.Current.TextColor1; + } } } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueFreshAirDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueFreshAirDirectionForm.cs index 3c20826..e9cd5b9 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueFreshAirDirectionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueFreshAirDirectionForm.cs @@ -51,8 +51,9 @@ btnSecond.TextID = R.MyInternationalizationString.uPressAndHoldThisKey; framePic.AddChidren(btnSecond); - //闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁裤�侀棯鐑� - //杩涘叆閰嶇綉鐘舵�併�傜豢鐏揩闂�3绉掑垯閰嶇綉鎴愬姛 + //鎸変綇闈㈡澘妯″紡鎸夐敭5绉掞紝缁胯壊鎸囩ず鐏棯鐑� + //杩涘叆閰嶇綉鐘舵�侊紱闂儊鍋滄 + //鎸囩ず鐏彉鐧借壊琛ㄧず閰嶇綉鎴愬姛 string[] msgArry = Language.StringByID(R.MyInternationalizationString.AddFreshAirPanelMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); @@ -61,6 +62,7 @@ msg1.TextColor = UserCenterColor.Current.TextGrayColor3; msg1.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg1); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg2.Y = msg1.Bottom; if (msgArry.Length > 1) @@ -70,6 +72,17 @@ msg2.TextColor = UserCenterColor.Current.TextGrayColor3; msg2.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg2); + + var msg3 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg3.Y = msg2.Bottom; + if (msgArry.Length > 2) + { + msg3.Text = msgArry[2]; + } + msg3.TextColor = UserCenterColor.Current.TextGrayColor3; + msg3.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg3); + } #endregion } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs index 7cf4f1f..d3de465 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs @@ -49,10 +49,6 @@ /// 鍏朵粬娑堟伅鐨勪富閿�,瀹冨瓨鍦ㄥ彟澶栫殑涓�寮犳暟鎹簱琛ㄤ腑 /// </summary> private List<string> listOtherMsgId = new List<string>(); - /// <summary> - /// 鏃犳硶璇嗗埆鐨勫紑閿佽褰曠殑鐢ㄦ埛ID(鍥犱负閭d釜瀵嗙爜鏈夊彲鑳芥病鏈夊垎閰嶇粰鎴愬憳) - /// </summary> - private List<string> listOtherUserId = new List<string>(); #endregion @@ -69,33 +65,37 @@ //璁剧疆澶撮儴淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uHistoryLog)); - //鍒犻櫎 - var btnDelete = new MostRightIconControl(69, 69); - btnDelete.UnSelectedImagePath = "Item/DeleteIcon2Selected.png"; - topFrameLayout.AddChidren(btnDelete); - btnDelete.InitControl(); - btnDelete.ButtonClickEvent += (sender, e) => + //鎴愬憳涓嶅厑璁告竻绌鸿褰� + if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2) { - var form = new TopRightMenuControl(1, 2); - //娓呯┖璁板綍 - form.AddRowMenu(Language.StringByID(R.MyInternationalizationString.uClearLog), "Item/DeleteIcon2.png", "Item/DeleteIcon2Selected.png", () => + //鍒犻櫎 + var btnDelete = new MostRightIconControl(69, 69); + btnDelete.UnSelectedImagePath = "Item/DeleteIcon2Selected.png"; + topFrameLayout.AddChidren(btnDelete); + btnDelete.InitControl(); + btnDelete.ButtonClickEvent += (sender, e) => { - if (this.listView.frameTable.ChildrenCount == 0) + var form = new TopRightMenuControl(1, 2); + //娓呯┖璁板綍 + form.AddRowMenu(Language.StringByID(R.MyInternationalizationString.uClearLog), "Item/DeleteIcon2.png", "Item/DeleteIcon2Selected.png", () => { - //鏃犳暟鎹彲鍒� - return; - } - //纭娓呯┖褰撳墠璁板綍锛� - this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uConfirmClearNowLog), () => - { - HdlThreadLogic.Current.RunThread(() => + if (this.listView.frameTable.ChildrenCount == 0) { - //娓呯┖鎵�鏈夎褰� - this.ClearAllHistoryLog(); + //鏃犳暟鎹彲鍒� + return; + } + //纭娓呯┖褰撳墠璁板綍锛� + this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uConfirmClearNowLog), () => + { + HdlThreadLogic.Current.RunThread(() => + { + //娓呯┖鎵�鏈夎褰� + this.ClearAllHistoryLog(); + }); }); }); - }); - }; + }; + } //鍒濆鍖栦腑閮ㄤ俊鎭� this.InitMiddleFrame(); @@ -493,7 +493,6 @@ //鍘嗗彶璁板綍澶夯鐑︿簡,瀛樺湪涓嶅悓鐨勬暟鎹簱琛ㄩ噷,骞朵笖鏁版嵁杩樹笉涓�鏍�,鍙兘杩欐牱涓�涓釜鍒ゆ柇浜� var listScreeningData = new List<HistoryInfo>(); //娓呴櫎鎺変箣鍓嶇殑璁板綍 - this.listOtherUserId = new List<string>(); this.listOtherMsgId = new List<string>(); //鏄惁閫夋嫨鍏ㄩ�夌敤鎴� @@ -573,12 +572,6 @@ //鍏朵粬娑堟伅鐨勪富閿�,瀹冨瓨鍦ㄥ彟澶栫殑涓�寮犳暟鎹簱琛ㄤ腑 this.listOtherMsgId.Add(info.MsgKeyId); } - } - if (info.CloudAccountId != string.Empty && dicMemberName.ContainsKey(info.CloudAccountId) == false - && this.listOtherUserId.Contains(info.CloudAccountId) == false) - { - //鏃犳硶璇嗗埆鐨勫紑閿佽褰曠殑鐢ㄦ埛ID(鍥犱负閭d釜瀵嗙爜鏈夊彲鑳芥病鏈夊垎閰嶇粰鎴愬憳) - this.listOtherUserId.Add(info.CloudAccountId); } return true; @@ -877,7 +870,7 @@ /// </summary> private async void ClearAllHistoryLog() { - //鑾峰彇璁块棶浜戠鎺ュ彛鐨勫惎鍔ㄥ弬鏁� + //鑾峰彇璁块棶浜戠鎺ュ彛鐨勫惎鍔ㄥ弬鏁�(2020.05.08:鍏ㄩ儴娓呯┖) var pra = this.GetDeleteDataPra(); //鎵撳紑杩涘害鏉� @@ -912,7 +905,6 @@ //娓呯┖ this.listOtherMsgId = new List<string>(); - this.listOtherUserId = new List<string>(); this.listHistoryInfo = null; HdlThreadLogic.Current.RunMain(() => @@ -954,34 +946,11 @@ DateTime dateFrom = new DateTime(dateFromControl.Year, dateFromControl.Month, dateFromControl.Day, 0, 0, 0); DateTime dateTo = new DateTime(dateToControl.Year, dateToControl.Month, dateToControl.Day, 23, 59, 59); - List<string> listUser = null; - //鎸囧畾鐢ㄦ埛 - if (listSearchUserId.Contains("-1") == false) - { - listUser = new List<string>(); - listUser.AddRange(listSearchUserId); - //濡傛灉鎸囧畾鏈夊叾浠� - if (listSearchUserId.Contains("-9999") == true) - { - listUser.AddRange(this.listOtherUserId); - } - } - - //鍏ㄩ�夊垯涓簄ull - List<int> listLock = null; - if (listSearchLockId.Contains(-1) == false) - { - listLock = new List<int>(); - listLock.AddRange(listSearchLockId); - } - var pra = new DeleteHistoryDataPra(); pra.UnlockTimeBegin = dateFrom.ToUniversalTime().ToString(); pra.UnlockTimeEnd = dateTo.ToUniversalTime().ToString(); pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); pra.DoorLockId = this.DeviceDoor.DeviceAddr + "_" + this.DeviceDoor.DeviceEpoint; - pra.CloudAccountIds = listUser; - pra.OpenLockModes = listLock; return pra; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs index 51837e9..49ce8de 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs @@ -37,6 +37,22 @@ /// PM鐩爣鍚嶅瓧 /// </summary> private string bindPmName = string.Empty; + /// <summary> + /// 琚粦鐩爣鏄柊椋� + /// </summary> + private CommonDevice bindFreshAirDev; + /// <summary> + /// 琚粦鐩爣鏄俯搴� + /// </summary> + private CommonDevice bindTemperatureDev; + /// <summary> + /// 琚粦鐩爣鏄箍搴� + /// </summary> + private CommonDevice bindHumidityDev; + /// <summary> + /// 琚粦鐩爣鏄疨M2.5 + /// </summary> + private CommonDevice bindPMDev; #endregion @@ -188,7 +204,7 @@ rowNewWind.ButtonClickEvent += (sender, e) => { - var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, 1); + var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindFreshAirDev, 1); Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; addDevicePage.Show(); @@ -208,8 +224,6 @@ }); }; - //var form = new PanelFangyueFreshAirTargetForm(); - //form.AddForm(this.deviceObj, string.Empty, 3); }; } #endregion @@ -242,19 +256,32 @@ continue; } bindFreshAirName = device.DeviceEpointName; + bindFreshAirDev = device; } if (device.Type == DeviceType.TemperatureSensor) { - bindTemperatureName = device.DeviceEpointName; + var bD = device as TemperatureSensor; + if (bD.SensorDiv == 1) + { + bindTemperatureName = device.DeviceEpointName; + bindTemperatureDev = device; + } + if (bD.SensorDiv == 2) + { + bindHumidityName = device.DeviceEpointName; + bindHumidityDev = device; + } } if (device.Type == DeviceType.FreshAirHumiditySensor) { bindHumidityName = device.DeviceEpointName; + bindHumidityDev = device; } - //if (device.Type == DeviceType.FreshAir) - //{ - // bindPmName = device.DeviceEpointName; - //} + if (device.Type == DeviceType.PMSensor) + { + bindPmName = device.DeviceEpointName; + bindPMDev = device; + } } result = true; } @@ -283,7 +310,7 @@ var btnPMStatu = rowPM.AddMostRightView(msg, 700); rowPM.ButtonClickEvent += (sender, e) => { - var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, 4); + var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindPMDev, 4); Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; addDevicePage.Show(); @@ -328,7 +355,7 @@ var btnTemperatureStatu = rowTemPerature.AddMostRightView(msg, 700); rowTemPerature.ButtonClickEvent += (sender, e) => { - var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, 2); + var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindTemperatureDev, 2); Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; addDevicePage.Show(); @@ -373,7 +400,7 @@ var btnHumidityStatu = rowHumidity.AddMostRightView(msg, 700); rowHumidity.ButtonClickEvent += (sender, e) => { - var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, 3); + var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindHumidityDev, 3); Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; addDevicePage.Show(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs index 427baf6..1d62a62 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs @@ -16,23 +16,25 @@ /// 鏋勯�犲嚱鏁� /// </summary> /// <param name="device"></param> - /// <param name="deviceBindType">1:鏂伴;2:娓╁害浼犳劅鍣�;3:婀垮害浼犳劅鍣�</param> - public PanelFangyueFreshAirTargetsForm(CommonDevice device, int deviceBindType) + /// <param name="deviceBindType">1:鏂伴;2:娓╁害浼犳劅鍣�;3:婀垮害浼犳劅鍣�;4:PM2.5浼犳劅鍣�</param> + /// <param name="bindDev">缁戝畾鐩爣 </param> + public PanelFangyueFreshAirTargetsForm(CommonDevice device, CommonDevice bindDev, int deviceBindType) { this.curControlDev = device as FreshAir; + this.curBindDevice = bindDev; this.curDeviceBindType = deviceBindType; } #endregion - #region 鍙橀噺鐢虫槑 - /// <summary> - /// 褰撳墠鎺у埗璁惧 - /// </summary> - //CommonDevice currentControlDevice; + #region 鍙橀噺鐢虫槑 /// <summary> /// 褰撳墠鏂伴闈㈡澘銆愭帶鍒惰澶囥�� /// </summary> FreshAir curControlDev; + /// <summary> + /// 褰撳墠琚粦璁惧 + /// </summary> + CommonDevice curBindDevice; /// <summary> /// 鏄剧ず琚粦瀹氳澶囨垨鍦烘櫙鐨剉iew /// </summary> @@ -318,6 +320,19 @@ curentOldRoom = btnRoom; curentOldRoomFrameLayout = btnRoomFrameLayout; } + + //琚粦瀹氱殑鐩爣杩樻湭鍒嗛厤鍖哄煙锛岄粯璁ゆ槸绗竴涓� + if (string.IsNullOrEmpty(curControlDev.currentSelectRoomId)) + { + if (index == 0) + { + btnRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; + btnRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite; + curentOldRoom = btnRoom; + curentOldRoomFrameLayout = btnRoomFrameLayout; + } + } + EventHandler<MouseEventArgs> eHandlerRoom = (sender, e) => { if (!btnRoom.IsSelected) @@ -450,6 +465,21 @@ line2.Visible = false; } + switch (curDeviceBindType) + { + case 1: + devicePic.UnSelectedImagePath = "Device/FreshAirEpoint.png"; + break; + case 2: + devicePic.UnSelectedImagePath = "Device/SensorTemperature.png"; + break; + case 3: + devicePic.UnSelectedImagePath = "Device/SensorHumidity.png"; + break; + case 4: + devicePic.UnSelectedImagePath = "Device/FreshAirEpoint.png"; + break; + } #endregion string mianKey = device.DeviceAddr + device.DeviceEpoint; @@ -608,7 +638,7 @@ btnFloorText.Text = dicFloorList[floorId]; //鑾峰彇妤煎眰涓埧闂村垪琛� - supportRoomList = GetFloorRoomList(curFloorId); + supportRoomList = GetFloorRoomList(); if (!btnMethodText.IsSelected) { if (oldbutton != null) @@ -665,11 +695,13 @@ { CommonPage.Loading.Start(""); }); + //鑾峰彇琚粦鐩爣绛変俊鎭� + BindDevInfo(curBindDevice); //鑾峰彇妤煎眰 dicFloorList = HdlRoomLogic.Current.GetFloorSortList(); //鑾峰彇妤煎眰涓埧闂村垪琛� - supportRoomList = GetFloorRoomList(curControlDev.currentSelectFloorId); + supportRoomList = GetFloorRoomList(); //鑾峰彇鎵�鏈夋埧闂翠腑鍖归厤鐨勮兘缁戠殑鐩爣 currentPanelSupportBindDeviceList = GetAllRoomSupportDeviceList(); @@ -725,11 +757,24 @@ case 2: if (device.Type == DeviceType.TemperatureSensor) { - targetList.Add(device); - oldTargetList.Add(device); + var bDev = device as TemperatureSensor; + if (bDev.SensorDiv == 1) + { + targetList.Add(device); + oldTargetList.Add(device); + } } break; case 3: + if (device.Type == DeviceType.TemperatureSensor) + { + var bDev = device as TemperatureSensor; + if (bDev.SensorDiv == 2) + { + targetList.Add(device); + oldTargetList.Add(device); + } + } if (device.Type == DeviceType.FreshAirHumiditySensor) { targetList.Add(device); @@ -759,6 +804,7 @@ if (targetList.Count == 0) { curControlDev.currentSelectFloorId = BindInfo.GetCurrentSelectFloorId(); + curControlDev.currentSelectRoomId = null; if (BindInfo.GetCurrentSelectFloorIdName() != null) { Application.RunOnMainThread(() => @@ -966,31 +1012,32 @@ { 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) + var delDevice = DelBindDevice(bd); + var delResult = new DelDeviceBindResponseAllData(); + delResult = await curControlDev.DelDeviceBindAsync(delDevice); + if (delResult != null && delResult.removeBindResultResponseData != null) { - case 1: - removeDevice.BindCluster = 514; - break; - case 2: - removeDevice.BindCluster = 1026; - break; - case 3: - removeDevice.BindCluster = 1029; - break; - case 4: - //PM2.5 - break; + 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; + } } - removeDevice.BindMacAddr = bd.DeviceAddr; - removeDevice.BindEpoint = bd.DeviceEpoint; - delDevice.RemoveBindList.Add(removeDevice); - + } + } + else + { + //妫�娴嬪凡缁忕粦瀹氱殑鐩爣鏄惁涓嶅湪鏈湴鎴栬�呮病鏈夊垎閰嶅埌浠讳綍鎴块棿涓� + //姝ゆ椂闇�瑕佸垹闄ゅ凡缁忚缁戝畾鍒扮洰鏍囷紝鎵嶈兘缁х画缁戝畾鏂扮洰鏍� + if (curBindDevice != null) + { + var delDevice = DelBindDevice(curBindDevice); var delResult = new DelDeviceBindResponseAllData(); delResult = await curControlDev.DelDeviceBindAsync(delDevice); if (delResult != null && delResult.removeBindResultResponseData != null) @@ -1141,6 +1188,31 @@ } /// <summary> + /// 褰撳墠琚粦瀹氳澶囨墍灞炴ゼ灞傚拰鎴块棿 + /// </summary> + /// <param name="bindDev"></param> + void BindDevInfo(CommonDevice bindDev) + { + if (bindDev == null) + { + return; + } + //鑾峰彇鏈湴璁惧鍒楄〃 + var localDeviceList = Shared.Common.LocalDevice.Current.listAllDevice; + var tempDev = localDeviceList.Find(obj => obj.DeviceAddr == bindDev.DeviceAddr && obj.DeviceEpoint == bindDev.DeviceEpoint); + if (tempDev != null) + { + //鑾峰彇璁惧鎵�灞炴埧闂� + var tempDevRoom = HdlRoomLogic.Current.GetRoomByDevice(tempDev); + if (tempDevRoom != null) + { + curControlDev.currentSelectRoomId = tempDevRoom.Id; + curControlDev.currentSelectFloorId = tempDevRoom.FloorId; + } + } + } + + /// <summary> /// 妫�娴嬬洰鏍囨槸鍚﹁缁戝畾杩� /// </summary> /// <returns></returns> @@ -1161,6 +1233,39 @@ } } return exist; + } + + /// <summary> + /// 妫�娴嬪凡缁忕粦瀹氱殑鐩爣鏄惁涓嶅湪鏈湴鎴栬�呮病鏈夊垎閰嶅埌浠讳綍鎴块棿涓� + /// </summary> + /// <returns></returns> + private DelDeviceBindData DelBindDevice(CommonDevice bd) + { + 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); + return delDevice; } /// <summary> @@ -1211,19 +1316,10 @@ } 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); - } - } - } + roomIncludeMatchDevice = GetMatchTemperatureSensorDevice(room); break; case 3: + roomIncludeMatchDevice = GetMatchHumiditySensorDevice(room); foreach (var de in room.ListDevice) { var device = LocalDevice.Current.GetDevice(de); @@ -1244,30 +1340,80 @@ { continue; } - } - if (!string.IsNullOrEmpty(room.FloorId)) - { - //鏈夋ゼ灞� - if (room.FloorId == curControlDev.currentSelectFloorId) + if (!string.IsNullOrEmpty(room.FloorId)) { + //鏈夋ゼ灞� + if (room.FloorId == curControlDev.currentSelectFloorId) + { + roomTempList.Add(room); + } + } + else + { + //娌℃湁妤煎眰 roomTempList.Add(room); } - } - else - { - //娌℃湁妤煎眰 - roomTempList.Add(room); } } return roomTempList; } /// <summary> + /// 鍖归厤娓╁害浼犳劅鍣� + /// </summary> + /// <param name="room"></param> + List<CommonDevice> GetMatchTemperatureSensorDevice(Room room) + { + List<CommonDevice> roomIncludeMatchTempDevice = new List<CommonDevice>(); + foreach (var de in room.ListDevice) + { + var device = LocalDevice.Current.GetDevice(de); + if (device != null) + { + if (device.Type == DeviceType.TemperatureSensor) + { + var dev = device as TemperatureSensor; + if (dev.SensorDiv == 1) + { + roomIncludeMatchTempDevice.Add(device); + } + } + } + } + return roomIncludeMatchTempDevice; + } + + /// <summary> + /// 鍖归厤婀垮害浼犳劅鍣� + /// </summary> + /// <param name="room"></param> + List<CommonDevice> GetMatchHumiditySensorDevice(Room room) + { + List<CommonDevice> roomIncludeMatchHumpDevice = new List<CommonDevice>(); + foreach (var de in room.ListDevice) + { + var device = LocalDevice.Current.GetDevice(de); + if (device != null) + { + if (device.Type == DeviceType.TemperatureSensor) + { + var dev = device as TemperatureSensor; + if (dev.SensorDiv == 2) + { + roomIncludeMatchHumpDevice.Add(device); + } + } + } + } + return roomIncludeMatchHumpDevice; + } + + /// <summary> /// 鑾峰彇妤煎眰瀵瑰簲鐨勬埧闂村垪琛� /// </summary> /// <returns></returns> - private List<Room> GetFloorRoomList(string floorId) + private List<Room> GetFloorRoomList() { supportRoomList.Clear(); var supportRoomListTemp = new List<Room>(); @@ -1279,10 +1425,6 @@ { if (string.IsNullOrEmpty(room.FloorId)) { - if (room.FloorId != floorId) - { - continue; - } if (room.IsLove) { continue; @@ -1350,16 +1492,10 @@ { continue; } - foreach (var deviceKeys in r.ListDevice) + var deviceListTemp = GetMatchTemperatureSensorDevice(r); + foreach (var dev in deviceListTemp) { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device != null) - { - if (device.Type == DeviceType.TemperatureSensor) - { - currentPanelBindSupportDeviceListTemp.Add(device); - } - } + currentPanelBindSupportDeviceListTemp.Add(dev); } } break; @@ -1369,6 +1505,11 @@ if (r.ListDevice.Count == 0) { continue; + } + var deviceListTemp = GetMatchHumiditySensorDevice(r); + foreach (var dev in deviceListTemp) + { + currentPanelBindSupportDeviceListTemp.Add(dev); } foreach (var deviceKeys in r.ListDevice) { @@ -1420,19 +1561,10 @@ } 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); - } - } - } + curRoomDeviceListTemp = GetMatchTemperatureSensorDevice(curRoom); break; case 3: + curRoomDeviceListTemp = GetMatchHumiditySensorDevice(curRoom); foreach (var deviceKeys in curRoom.ListDevice) { var device = LocalDevice.Current.GetDevice(deviceKeys); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs index 49dee07..b5e90d4 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs @@ -165,7 +165,7 @@ /// <param name="doorLockMessType">瀵艰嚧闂ㄩ攣澶辨晥鐨勬搷浣滅被鍨�</param> /// <param name="haveLogic">缃戝叧涓槸鍚﹀瓨鍦ㄩ�昏緫甯稿紑妯″紡</param> /// <param name="action">鍥炶皟澶勭悊鏇存柊鍐呭</param> - public static async void NomallyOpenModeInvalidDialog(ZigBee.Device.DoorLock doorLock, DoorLockMessType doorLockMessType, bool haveLogic, Action action = null) + public static async void NomallyOpenModeInvalidDialog(ZigBee.Device.DoorLock doorLock, DoorLockMessType doorLockMessType, bool haveLogic, Action<bool> action = null) { //甯稿紑妯″紡鍙兘涓讳汉鎿嶄綔 if (UserCenterResourse.UserInfo.AuthorityNo != 1) @@ -202,7 +202,8 @@ //淇濇寔甯稿紑 NormallyOpenModeValue(doorLock, true); } - action?.Invoke(); + action?.Invoke(doorLock.IsDoorLockNormallyMode); + action = null; }; alert.CancelClickEvent += async () => @@ -226,7 +227,8 @@ NormallyOpenModeValue(doorLock, false); CommonPage.Loading.Hide(); }); - action?.Invoke(); + action?.Invoke(doorLock.IsDoorLockNormallyMode); + action = null; return; } if (result.defaultControlResponseData.status != 0) @@ -238,7 +240,8 @@ NormallyOpenModeValue(doorLock, false); CommonPage.Loading.Hide(); }); - action?.Invoke(); + action?.Invoke(doorLock.IsDoorLockNormallyMode); + action = null; return; } else @@ -259,7 +262,8 @@ //app鎿嶄綔涓嶅彇娑堚�滃父寮�妯″紡鈥� DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true); } - action?.Invoke(); + action?.Invoke(doorLock.IsDoorLockNormallyMode); + action = null; }; alert.ConfirmClickEvent += async () => @@ -271,6 +275,7 @@ { //娓╁眳鍩庢柟娉曪紵锛燂紵 //姝ゅ鏄惁瑕佸垹闄ゆ俯灞呭煄鐨勭壒娈婇�昏緫 + var resTemp1 = await Shared.Phone.Device.Logic.SkipView.GetLogicAll(); } } else @@ -285,7 +290,8 @@ ShowTipMsg(Language.StringByID(R.MyInternationalizationString.GwResponseOvertime)); CommonPage.Loading.Hide(); }); - action?.Invoke(); + action?.Invoke(doorLock.IsDoorLockNormallyMode); + action = null; return; } if (result.defaultControlResponseData.status != 0) @@ -296,7 +302,8 @@ ShowTipMsg(msg1); CommonPage.Loading.Hide(); }); - action?.Invoke(); + action?.Invoke(doorLock.IsDoorLockNormallyMode); + action = null; return; } else @@ -308,7 +315,7 @@ //鍒犻櫎璁剧疆甯稿紑妯″紡鍒涘缓鐨勯�昏緫 if (haveLogic) { - var resTemp1 = await Shared.Phone.Device.Logic.SkipView.Exist(3); + var resTemp1 = await Shared.Phone.Device.Logic.SkipView.GetLogicAll(); //娓╁眳鍩庢柟娉曪紵锛燂紵 //姝ゅ鏄惁瑕佸垹闄ゆ俯灞呭煄鐨勭壒娈婇�昏緫 } @@ -320,7 +327,8 @@ }); } } - action?.Invoke(); + action?.Invoke(doorLock.IsDoorLockNormallyMode); + action = null; }; } @@ -359,7 +367,7 @@ public static async System.Threading.Tasks.Task<bool> SetNormallyOpenModeFuncAsync(ZigBee.Device.DoorLock doorLock) { //app璁剧疆鈥滃父寮�妯″紡鈥濆け璐� - var result = await doorLock.SetNormallyOpenModeFuncAsync(false); + var result = await doorLock.SetNormallyOpenModeFuncAsync(true); if (result == null || result.defaultControlResponseData == null || result.defaultControlResponseData.status != 0) { return false; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs index 37945a5..2364376 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs @@ -73,7 +73,7 @@ EventHandler<MouseEventArgs> eHandlerBack = (sender, e) => { RemoveFromParent(); - + UserDoorLockPage.canShowDialog = true; //鏆傛椂涓嶈�冭檻涓嬬骇鐣岄潰绛夋帹閫佸鑷村父寮�妯″紡澶辨晥鐨勯棶棰� //var userDoorLockPage = new UserDoorLockPage(currentRoom, deviceUI); //HomePage.Instance.AddChidren(userDoorLockPage); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs index 8a521d7..89f9c6e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs @@ -462,8 +462,8 @@ var btnChoose = new Button() { - Width = Application.GetRealWidth(60), - Height = Application.GetRealHeight(60), + Width = Application.GetMinRealAverage(60), + Height = Application.GetMinRealAverage(60), X = Application.GetRealWidth(861 + 81), Y = Application.GetRealHeight(35), SelectedImagePath = "DoorLock/SelectedIcon.png", diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs index 93c7a9f..2fc442e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs @@ -41,7 +41,13 @@ /// <summary> /// 閫昏緫涓槸鍚︽湁甯稿紑妯″紡 /// </summary> - private bool HaveLogicNormallyOpenMode = false; + private bool haveLogicNormallyOpenMode = false; + + /// <summary> + /// 闂ㄩ攣娣卞害鎺у埗涓婃姤绐楀彛鏄惁寮瑰嚭 + /// </summary> + public static bool canShowDialog = true; + /// <summary> /// 褰撳墠鐢甸噺 /// </summary> @@ -609,7 +615,14 @@ { if (canOpenNormallyMode) { - Application.RunOnMainThread(() => { NomallyOpenModeInvalidDialog(true); }); + Application.RunOnMainThread(() => + { + Action<bool> action = (obj) => + { + UpdateNomallyOpenStatus(); + }; + DoorLockCommonInfo.NomallyOpenModeInvalidDialog(doorLock, DoorLockCommonInfo.DoorLockMessType.ServicePush, haveLogicNormallyOpenMode, action); + }); } } } @@ -687,11 +700,11 @@ var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(2); if (resTemp == 1) { - HaveLogicNormallyOpenMode = true; + haveLogicNormallyOpenMode = true; } else if (resTemp == 0) { - HaveLogicNormallyOpenMode = false; + haveLogicNormallyOpenMode = false; } }); } @@ -784,14 +797,11 @@ //璁剧疆 EventHandler<MouseEventArgs> btnFuncSetHander = (sender, e) => { - //鎵撳紑鍏朵粬鐣岄潰鏃跺墠绉婚櫎銆愭殏鏃朵笉绉婚櫎銆� - //RemoveFromParent(); - var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(currentRoom, doorLock); Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; functionSetting.Show(); - + canShowDialog = false; functionSetting.devicNameAction += (deviceRename) => { if (!string.IsNullOrEmpty(deviceRename)) @@ -822,6 +832,7 @@ //鍘嗗彶璁板綍 ---- stan var form = new DeviceDoorLock.DoorLockHistoryLogForm(); form.AddForm(this.doorLock.DeviceAddr); + canShowDialog = false; }; btnRecordFrameLayout.MouseDownEventHandler += handerRecord; btnRecord.MouseDownEventHandler += handerRecord; @@ -849,7 +860,14 @@ { if (canOpenNormallyMode) { - NomallyOpenModeInvalidDialog(false); + Application.RunOnMainThread(() => + { + Action<bool> action = (obj) => + { + UpdateNomallyOpenStatus(); + }; + DoorLockCommonInfo.NomallyOpenModeInvalidDialog(doorLock, DoorLockCommonInfo.DoorLockMessType.AppOperate, haveLogicNormallyOpenMode, action); + }); } else { @@ -875,7 +893,14 @@ { if (doorLock.IsDoorLockNormallyMode) { - NomallyOpenModeInvalidDialog(); + Application.RunOnMainThread(() => + { + Action<bool> action = (obj) => + { + UpdateNomallyOpenStatus(); + }; + DoorLockCommonInfo.NomallyOpenModeInvalidDialog(doorLock, DoorLockCommonInfo.DoorLockMessType.AppOperate, haveLogicNormallyOpenMode, action); + }); } } else @@ -1066,80 +1091,18 @@ }; HdlCheckLogic.Current.CheckSecondarySecurity(action); #endregion - - #region 鏆傛椂鐗堟湰 (鏈�缁堝幓鎺夛級 - if (!btnNormallyOpen.IsSelected) - { - if (UserCenterResourse.UserInfo.AuthorityNo != 1) - { - this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate)); - return; - } + } - if (!UserCenterResourse.AccountOption.DoorUnLockByRemote) - { - SystemSecondAuthentication(); - return; - } - - action = () => - { - string msg = Language.StringByID(R.MyInternationalizationString.SetDoorLockNomallyOpen).Replace("{0}", "\r\n"); - var confirm = Language.StringByID(R.MyInternationalizationString.Confrim); - var alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.Confirm, msg, confirm); - alert.Show(); - - alert.ConfirmClickEvent += async () => - { - Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); - var result = await doorLock.SetNormallyOpenModeFuncAsync(true); - if (result == null || result.defaultControlResponseData == null) - { - string msg0 = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); - this.ShowTipMsg(msg0); - return; - } - if (result.defaultControlResponseData.status != 0) - { - string msg1 = Language.StringByID(R.MyInternationalizationString.OpenNormallyOpenModeFailed); - this.ShowTipMsg(msg1); - return; - } - else - { - //娣诲姞App寮�鍚父寮�妯″紡鐨勫巻鍙茶褰� - HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(this.doorLock, 9001, string.Empty); - - //姣忔閲嶆柊璁剧疆甯稿紑锛岄粯璁ゆ椂闂撮兘鏄�12灏忔椂 - DoorLockCommonInfo.NormallyOpenModeInvalidTime = 12; - DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true); - Application.RunOnMainThread(() => - { - UpdateNomallyOpenStatus(); - CommonPage.Loading.Hide(); - }); - - //甯稿紑妯″紡寮�鍚彁绀� - AlreadyOpenNormallyMode(); - } - }; - - }; - HdlCheckLogic.Current.CheckSecondarySecurity(action); - } - else - { - NomallyOpenModeInvalidDialog(); - } - - #endregion - } - - /// <summary> - /// 甯稿紑妯″紡澶辨晥澶勭悊 - /// </summary> + /// <summary> + /// 甯稿紑妯″紡澶辨晥澶勭悊 + /// </summary> public void NomallyOpenModeInvalidDialog(bool IsFromReport = false) { + if (!canShowDialog) + { + return; + } + if (UserCenterResourse.UserInfo.AuthorityNo != 1) { this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate)); @@ -1148,7 +1111,7 @@ string msg = Language.StringByID(R.MyInternationalizationString.NomallyModeIsCanceled).Replace("{0}", "\r\n"); var confirm = Language.StringByID(R.MyInternationalizationString.SureCancel); var alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.NomallyOpenMode, msg, confirm); - if (HaveLogicNormallyOpenMode) + if (haveLogicNormallyOpenMode) { //鏈夐�昏緫璁剧疆鐨勫脊绐� alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.CancelNomallyOpenModeWithLogic, msg, confirm); @@ -1166,7 +1129,7 @@ UpdateNomallyOpenStatus(); }); //鍒犻櫎宸茬粡澶辨晥鐨勨�滃父寮�妯″紡鈥濈殑閫昏緫 - if (HaveLogicNormallyOpenMode) + if (haveLogicNormallyOpenMode) { var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(3); //if (resTemp == 3) @@ -1194,7 +1157,7 @@ //涓婃姤鈥滃父寮�妯″紡鈥濆凡琚彇娑� Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); //鍏堝垹闄ゅ凡澶辨晥鐨勨�滃父寮�妯″紡鈥濈殑閫昏緫 - if (HaveLogicNormallyOpenMode) + if (haveLogicNormallyOpenMode) { var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(3); //if (resTemp == 3) @@ -1271,7 +1234,7 @@ }); //鍒犻櫎宸茬粡澶辨晥鐨勨�滃父寮�妯″紡鈥濈殑閫昏緫 - if (HaveLogicNormallyOpenMode) + if (haveLogicNormallyOpenMode) { var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(3); //if (resTemp == 3) @@ -1310,7 +1273,7 @@ UpdateNomallyOpenStatus(); }); //鍒犻櫎璁剧疆甯稿紑妯″紡鍒涘缓鐨勯�昏緫 - if (HaveLogicNormallyOpenMode) + if (haveLogicNormallyOpenMode) { var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(3); //鍥犱负鐩墠鏈哄埗闂锛岄�昏緫缁忓父澶辫触锛屾墍浠ヤ笉鎻愮ず锛屽悗鏈熸満鍒惰鏀癸紝閲嶆柊鍋氫竴涓繖涓晫闈� diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs index 6739b3e..4bbb6c1 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs @@ -403,7 +403,7 @@ else { //鍒锋柊涓荤敾闈�(涓嶉噸鏂拌幏鍙栬澶囩姸鎬�) - this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame", false); + this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame"); } }); } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs index 805e646..3ac8791 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs @@ -297,7 +297,7 @@ //鍏抽棴鐣岄潰 this.CloseForm(); //鍒锋柊涓荤敾闈�(涓嶉噸鏂拌幏鍙栬澶囩姸鎬�) - this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame", false); + this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame"); } }); } @@ -363,7 +363,7 @@ string gwid = HdlGatewayLogic.Current.GetGatewayId(gateWay); if (this.dicRowContr.ContainsKey(gwid) == true && this.dicRowContr[gwid] != null) { - this.dicRowContr[gwid].RefreshControl(gateWay); + this.dicRowContr[gwid].IsOnline = online; } }); } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs index 1b5698f..84ac290 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs @@ -67,6 +67,15 @@ this.AddNormalRowControl("WIFI鍙橀噺", 400, Shared.Application.IsWifi == true ? "true" : "false", 400); + if (ZigBee.Common.Application.FindGateWaySocket.busSocket == null) + { + this.AddNormalRowControl("Socket閾炬帴", 400, "鏈垵濮嬪寲", 400); + } + else + { + this.AddNormalRowControl("Socket閾炬帴", 400, ZigBee.Common.Application.FindGateWaySocket.busSocket.Connected == true ? "true" : "false", 400); + } + int count = HdlGatewayLogic.Current.GetAllLocalGateway().Count; var row1 = new FrameRowControl(listView.rowSpace / 2); listView.AddChidren(row1); @@ -149,6 +158,16 @@ #endif row1 = new FrameRowControl(listView.rowSpace / 2); listView.AddChidren(row1); + row1.AddLeftCaption("璁惧缂撳瓨鍙橀噺", 500); + row1.AddRightArrow(); + row1.ButtonClickEvent += (sender, e) => + { + + }; + + + row1 = new FrameRowControl(listView.rowSpace / 2); + listView.AddChidren(row1); row1.AddLeftCaption("涓婁紶Log", 500); row1.AddRightArrow(); row1.ButtonClickEvent += (sender, e) => diff --git a/ZigbeeApp/Shared/Phone/UserView/HomePage.cs b/ZigbeeApp/Shared/Phone/UserView/HomePage.cs index bc2f040..72d0148 100755 --- a/ZigbeeApp/Shared/Phone/UserView/HomePage.cs +++ b/ZigbeeApp/Shared/Phone/UserView/HomePage.cs @@ -128,7 +128,7 @@ var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString()); var revertData = responseDataObj; //鏍囪涓婁竴娆℃槸涓嶆槸鍚屼竴涓处鍙风櫥闄� - UserCenter.UserCenterResourse.ResidenceOption.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid; + Config.Instance.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid; Config.Instance.Account = revertData.Account; Config.Instance.Password = password; Config.Instance.MD5PWD = revertData.MD5PWD; diff --git a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs old mode 100644 new mode 100755 index f0f4d8d..55f5d7d --- a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs @@ -49,6 +49,10 @@ /// 鎺т欢缂撳瓨(鐪嬩笉鎳傜殑璇�,涓嶈鍔ㄥ畠) /// </summary> private List<ButtonBase> listButton = new List<ButtonBase>(); + /// <summary> + /// 濡傛灉璁剧疆姝ゅ彉閲忎负true,鍒欏湪鍗曞嚮搴曢儴鑿滃崟鏃�,寮哄埗鏃犳潯浠跺叏閮ㄥ埛鏂� + /// </summary> + public bool RefreshForm = false; #endregion @@ -76,10 +80,10 @@ return; } #if iOS - if (Shared.Application.PhoneType >= 10) - { - //楂樼増鏈殑鑻规灉鏈哄瀷锛屽睆骞曞簳閮ㄤ細鏈変竴涓粦鑹茬殑鏉� - ControlCommonResourse.BottomFrameHeight = Application.GetRealHeight(242); + if (Shared.Application.PhoneType >= 10) + { + //楂樼増鏈殑鑻规灉鏈哄瀷锛屽睆骞曞簳閮ㄤ細鏈変竴涓粦鑹茬殑鏉� + ControlCommonResourse.BottomFrameHeight = Application.GetRealHeight(242); } #endif //鐢ㄦ埛涓讳綋鐣岄潰锛堜腑闂撮儴鍒嗭級 @@ -214,10 +218,10 @@ this.BottomMenuClickEvent(MenuSelectEnum.A涓婚〉, false); } -#endregion + #endregion -#region 鈻� 涓�鑸柟娉昣__________________________ - + #region 鈻� 涓�鑸柟娉昣__________________________ + /// <summary> /// 搴曢儴鑿滃崟鐨勭偣鍑讳簨浠� /// </summary> @@ -225,11 +229,22 @@ /// <param name="handClick">鏄惁鏄墜鍔ㄧ偣鍑�</param> private void BottomMenuClickEvent(MenuSelectEnum selectEnum, bool handClick) { - if (selectEnum == this.nowSelectMenu && handClick == true) + if (this.RefreshForm == false && selectEnum == this.nowSelectMenu && handClick == true) { //鎵嬪姩鐐瑰嚮鍚屼竴涓彍鍗�,鍒欎笉鍋氬鐞� return; } + + //濡傛灉寮哄埗鎸囧畾鍒锋柊鐣岄潰鐨勮瘽 + if (this.RefreshForm == true) + { + //鍏ㄩ儴鍒锋柊 + this.listForm = new List<EditorCommonForm>() { null, null, null }; + this.bodyFrameView.RemoveAll(); + + this.RefreshForm = false; + } + this.nowSelectMenu = selectEnum; //涓婚〉 @@ -319,10 +334,10 @@ this.BottomMenuClickEvent(MenuSelectEnum.A鍒嗙被, false); } -#endregion + #endregion -#region 鈻� 缁撴瀯浣揰____________________________ - + #region 鈻� 缁撴瀯浣揰____________________________ + /// <summary> /// 鑿滃崟閫夋嫨鐨勬灇涓� /// </summary> @@ -332,8 +347,8 @@ A涓婚〉 = 1, A鍒嗙被 = 2, A涓汉涓績 = 3 - } - -#endregion + } + + #endregion } } diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs b/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs index 89ec837..5fb22cb 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs @@ -104,18 +104,25 @@ { searchCount = 6; ZbGateway.IsRemote = false; + //褰撶綉鍏崇殑杩炴帴鏂瑰紡鏀瑰彉鏃�,璁板綍褰撳墠鐨勮繛鎺ユ柟寮� + Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.WIFI); } else { if (searchCount < 0) { ZbGateway.IsRemote = true; + //褰撶綉鍏崇殑杩炴帴鏂瑰紡鏀瑰彉鏃�,璁板綍褰撳墠鐨勮繛鎺ユ柟寮� + Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.Remote); } } } else { ZbGateway.IsRemote = true; + //褰撶綉鍏崇殑杩炴帴鏂瑰紡鏀瑰彉鏃�,璁板綍褰撳墠鐨勮繛鎺ユ柟寮� + Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.Remote); + for (int i = 0; i < ZbGateway.GateWayList.Count; i++) { ZbGateway.GateWayList[i].DisConnectLocalMqttClient("1"); @@ -303,48 +310,7 @@ try { //瀹氭椂妫�娴嬭繙绋嬭繛鎺ユ儏鍐� - await ZbGateway.StartRemoteMqtt(); - if (!ZbGateway.IsRemote) - { - System.Threading.Thread.Sleep(500); - continue; - } - var gateWayList = ZbGateway.GateWayList.FindAll(obj => obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId); - - if (gateWayList.Count == 1) - { - gateWayList[0].getGatewayBaseInfo.IsMainGateWay = true; - } - else - { - if (gateWayList.Find((obj) => obj.getGatewayBaseInfo.IsMainGateWay) == null) - { - for (int i = 0; i < gateWayList.Count; i++) - { - var gateWay = gateWayList[i]; - var info = await gateWay.GetZbGwInfoAsync(); - if (info == null || info.getGwData == null) - { - continue; - } - if (info.getGwData.IsDominant == 1) - { - for (int j = 0; j < gateWayList.Count; j++) - { - if (gateWayList[i].getGatewayBaseInfo.gwID == info.getGwData.GwId) - { - gateWayList[i].getGatewayBaseInfo.IsMainGateWay = true; - } - else - { - gateWayList[i].getGatewayBaseInfo.IsMainGateWay = false; - } - } - break; - } - } - } - } + await ZbGateway.StartRemoteMqtt(); } catch { } System.Threading.Thread.Sleep(2000); diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs b/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs index 7c83759..ed03e42 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs @@ -100,7 +100,12 @@ /// 杩滅▼杩炴帴鐨凪qtt鐨勫鎴风ID /// </summary> [Newtonsoft.Json.JsonIgnore] - public string ConnEmqClientId = string.Empty; + public string ConnEmqClientId = string.Empty; + /// <summary> + /// 褰撳墠鐧诲綍鐨勮处鍙锋槸涓嶆槸涔嬪墠鐨勮处鍙� + /// </summary> + [Newtonsoft.Json.JsonIgnore] + public bool TheSameLoginAccount = false; [Newtonsoft.Json.JsonIgnore] /// <summary> diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs index f2e05ad..2eb6f8a 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs @@ -182,6 +182,10 @@ { return Newtonsoft.Json.JsonConvert.DeserializeObject<FreshAir>(strDeviceByte); } + else if (strDeviceType == ZigBee.Device.DeviceType.PMSensor.ToString()) + { + return Newtonsoft.Json.JsonConvert.DeserializeObject<PMSensor>(strDeviceByte); + } return null; } @@ -248,6 +252,11 @@ //鏂伴 IconPath = "Device/FreshAirEpoint.png"; } + else if (this.Type == DeviceType.FreshAir) + { + //PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� + IconPath = "Device/FreshAirEpoint.png"; + } else if (this.Type == DeviceType.FreshAirHumiditySensor) { //婀垮害浼犳劅鍣� diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/DeviceType.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/DeviceType.cs index 6928ccf..90768b9 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/DeviceType.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/DeviceType.cs @@ -94,6 +94,12 @@ /// <para>瀹氫箟瀵硅薄锛歍emperatureSensor</para> /// </summary> TemperatureSensor = 770, + /// <summary> + /// <para>PM2.5浼犳劅鍣�</para> + /// <para>璁惧ID涓�777</para> + /// <para>瀹氫箟瀵硅薄锛歅MSensor</para> + /// </summary> + PMSensor = 777, } /// <summary> diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/PMSensor.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/PMSensor.cs new file mode 100755 index 0000000..f2dece7 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/PMSensor.cs @@ -0,0 +1,16 @@ +锘縰sing System; +using ZigBee.Device; + +namespace ZigBee.Device +{ + public class PMSensor : CommonDevice + { + /// <summary> + /// PM2.5浼犳劅鍣ㄥ璞� + /// </summary> + public PMSensor() + { + this.Type = DeviceType.PMSensor; + } + } +} diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs index 104c55f..60c83d9 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs @@ -2702,7 +2702,6 @@ { DebugPrintLog($" 鏈湴杩炴帴鎴愬姛_缃戝叧IP:{brokerName}_缃戝叧鏄惁鍔�:{IsEncry}_褰撳墠瀵嗙爜:{Password}"); IsRemote = false; - Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.WIFI); }); } @@ -2943,7 +2942,7 @@ await RemoteMqttClient.SubscribeAsync("/ZigbeeGateWayToClient/" + Config.Instance.ConnEmqClientId + "/Push/NotifySqueeze"); await initGateWayBaseInfomation(); - Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.Remote); + //娌℃湁涓荤綉鍏虫椂涓诲姩璇诲彇锛岃幏鍙栦富缃戝叧淇℃伅 var gateWayList = GateWayList.FindAll(obj => obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId); if (gateWayList.Find(obj => obj.getGatewayBaseInfo.IsMainGateWay == true) == null) diff --git a/ZigbeeApp/Shared/R.cs b/ZigbeeApp/Shared/R.cs index c274329..bd4528c 100755 --- a/ZigbeeApp/Shared/R.cs +++ b/ZigbeeApp/Shared/R.cs @@ -330,7 +330,7 @@ /// </summary> public const int GetPanelProximityFail = 233; /// <summary> - /// 鎸変綇闈㈡澘妯″紡 + /// 鎸変綇闈㈡澘妯″紡鎸夐敭5绉掞紝缁胯壊鎸囩ず鐏棯鐑亄0}杩涘叆閰嶇綉鐘舵�侊紱闂儊鍋滄{0}鎸囩ず鐏彉鐧借壊琛ㄧず閰嶇綉鎴愬姛 /// </summary> public const int AddFreshAirPanelMsg = 235; /// <summary> @@ -566,6 +566,10 @@ /// PM2.5鎰熷櫒 -> 闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝淇″彿鍥炬爣{0}蹇棯锛� 杩涘叆閰嶇綉鐘舵�併�備俊鍙峰浘鏍囧父浜垯閰嶇綉鎴愬姛 /// </summary> public const int AddSensorPMMsg = 313; + /// <summary> + /// 鑷姩妯″紡涓嶆敮鎸佹搷浣� + /// </summary> + public const int AutoModeForbiddenOperate = 314; public readonly static int cancel = 5097; public readonly static int confrim = 5098; @@ -839,6 +843,13 @@ public readonly static int or = 5396; public readonly static int timeNull = 5397; public readonly static int numberInput = 5398; + public readonly static int closeFailed = 5399; + public readonly static int openFailed = 5400; + public readonly static int addFailed = 5401; + public readonly static int timeSensitive = 5402; + public readonly static int executeSone = 5403; + + #region 鐧诲綍娉ㄥ唽 /// <summary> @@ -5962,15 +5973,15 @@ /// </summary> public const int uAddSensorTemperatureAndHumidityMsg = 21017; /// <summary> - /// 鏂规偊2鎸夐敭杞昏Е寮忛潰鏉� -> 鎸変綇闈㈡澘宸︿笂瑙掓寜閿紝鎵�鏈夋寜閿寚绀虹伅{0}浜捣锛屽垯閰嶇綉鎴愬姛 + /// 鍗曞紑鍙屾帶闈㈡澘 -> 闀挎寜BUTTON1鎸夐敭5绉掞紝鎵�鏈夋寚绀虹伅{0}鍙樹负缁胯壊骞堕棯鐑侊紝杩涘叆閰嶇綉鐘舵�� /// </summary> public const int uAddFangyueTwoButtonPanelMsg = 21018; /// <summary> - /// 鏂规偊4鎸夐敭杞昏Е寮忛潰鏉� -> 鎸変綇闈㈡澘宸︿笂瑙掓寜閿紝鎵�鏈夋寜閿寚绀虹伅{0}浜捣锛屽垯閰嶇綉鎴愬姛 + /// 鍙屽紑鍥涙帶闈㈡澘 -> 闀挎寜BUTTON1鎸夐敭5绉掞紝鎵�鏈夋寚绀虹伅{0}鍙樹负缁胯壊骞堕棯鐑侊紝杩涘叆閰嶇綉鐘舵�� /// </summary> public const int uAddFangyueFourButtonPanelMsg = 21019; /// <summary> - /// 鏂规偊8鎸夐敭杞昏Е寮忛潰鏉� -> 鎸変綇闈㈡澘宸︿笂瑙掓寜閿紝鎵�鏈夋寜閿寚绀虹伅{0}浜捣锛屽垯閰嶇綉鎴愬姛 + /// 鍥涘紑鍏帶闈㈡澘-> 闀挎寜BUTTON1鎸夐敭5绉掞紝鎵�鏈夋寚绀虹伅{0}鍙樹负缁胯壊骞堕棯鐑侊紝杩涘叆閰嶇綉鐘舵�� /// </summary> public const int uAddFangyueEightButtonPanelMsg = 21020; /// <summary> @@ -6148,6 +6159,10 @@ /// 闀滃儚ID涓�1306鐨勮澶囩殑榛樿鍚嶅瓧锛歓igbee鍚搁《鐕冩皵浼犳劅鍣� /// </summary> public const int uDeviceModelId1306 = 30039; + /// <summary> + /// 闀滃儚ID涓�1307鐨勮澶囩殑榛樿鍚嶅瓧锛歅M2.5绌烘皵璐ㄩ噺浼犳劅鍣� + /// </summary> + public const int uDeviceModelId1307 = 30040; //鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄澶囨墍灞炵绫荤殑缈昏瘧鍚嶅瓧,浠�40000寮�濮嬧槄鈽呪槄鈽� /// <summary> diff --git a/ZigbeeApp/Shared/Shared.projitems b/ZigbeeApp/Shared/Shared.projitems index db6ed67..1795d10 100755 --- a/ZigbeeApp/Shared/Shared.projitems +++ b/ZigbeeApp/Shared/Shared.projitems @@ -402,6 +402,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\DoorLock.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\FreshAir.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\HumiditySensor.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\PMSensor.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\Repeater.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\ThirdPartyModuleUpgrade.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\Transverter.cs" /> -- Gitblit v1.8.0