From 5da99fed2eb0d08b6338064da5f998891252c7b8 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期一, 18 五月 2020 16:39:59 +0800 Subject: [PATCH] 2020-05-18-2 --- ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs | 123 ++++++++++++++++++++++++++++++++-------- 1 files changed, 97 insertions(+), 26 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs old mode 100755 new mode 100644 index c593a35..6e7edf2 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs @@ -21,17 +21,27 @@ this.AddChidren(view.TopRowView()); view.toptitleNameBtn.TextID = MyInternationalizationString.linkageevent; view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; + //鍔犲ぇ鐐瑰嚮鐑敭 + var addiocnclick = new Button + { + Width = Application.GetRealWidth(108+58), + Height = Application.GetRealHeight(72+20), + X = Application.GetRealWidth(1080 - 108 - 58), + Y = Application.GetRealHeight(184 - 72), + }; + view.topRowLayout.AddChidren(addiocnclick); var addiocn = new Button { - Width = Application.GetRealWidth(72), - Height = Application.GetRealHeight(72), + Width = Application.GetMinRealAverage(72), + Height = Application.GetMinRealAverage(72), X = Application.GetRealWidth(1080 - 108 - 58), UnSelectedImagePath = "ZigeeLogic/lockadd.png", Y = Application.GetRealHeight(184 - 72 - 20), }; view.topRowLayout.AddChidren(addiocn); - addiocn.MouseUpEventHandler += (sender, e) => + + EventHandler<MouseEventArgs> addclick = (sender, e) => { //new涓�涓柊閫昏緫瀵硅薄锛� Common.Logic.CurrentLogic = new Common.Logic(); @@ -44,6 +54,10 @@ UserView.HomePage.Instance.PageIndex += 1; lockLogicCommunalPage.Show(() => { }); }; + + addiocnclick.MouseUpEventHandler += addclick; + addiocn.MouseUpEventHandler += addclick; + #endregion middle = new VerticalRefreshLayout { @@ -68,8 +82,9 @@ /// </summary> public async void Read() { + CommonPage.Loading.Start(); - if (Common.Logic.LockLogicList.Count == 0) + if (!BoolExist()) { var Idlist = await Send.GetLogicId(1); if (Idlist.Count != 0) @@ -83,27 +98,32 @@ { continue; } - bool yes = false; - for (int a = 0; a < logic.Accounts.Count; a++) - { - if (logic.Accounts[a]["MacAddr"].ToString() != Send.CurrentDoorLock.DeviceAddr && logic.Accounts[a]["Epoint"].ToString() != Send.CurrentDoorLock.DeviceEpoint.ToString()) - { - //鏌ユ壘鏄惁鏄偅涓棬閿侊紱 - //濡傛灉涓嶆槸璇ラ棬閿佽仈鍔ㄤ簨浠朵笉鏄剧ず鍑烘潵; - yes = false; - break; - } - if (logic.Accounts[a]["Account"].ToString() == Config.Instance.Guid) - { - //鏌ユ壘鑷繁璐﹀彿涓嬬殑鍒涘缓鑱斿姩浜嬩欢锛� - yes = true; - break; - } - } - if (yes) - { - Common.Logic.LockLogicList.Add(listlogic[j]); - } + Common.Logic.LockLogicList.Add(logic); + //bool yes = false; + //for (int a = 0; a < logic.Accounts.Count; a++) + //{ + // //Option4鏄澶噈ac锛汷ption2鏄澶囩鍙o紱 + // if (logic.Accounts[a]["Option4"].ToString() != Send.CurrentDoorLock.DeviceAddr) + // { + // //鏌ユ壘鏄惁鏄偅涓棬閿侊紱 + // //濡傛灉涓嶆槸璇ラ棬閿佽仈鍔ㄤ簨浠朵笉鏄剧ず鍑烘潵; + // yes = false; + // } + // else + // { + // yes = true; + // } + // //if (logic.Accounts[a]["Account"].ToString() == Config.Instance.Guid) + // //{ + // // //鏌ユ壘鑷繁璐﹀彿涓嬬殑鍒涘缓鑱斿姩浜嬩欢锛� + // // yes = true; + // // break; + // //} + //} + //if (yes) + //{ + // Common.Logic.LockLogicList.Add(listlogic[j]); + //} } } } @@ -117,7 +137,8 @@ { middle.RemoveAll(); - if (Common.Logic.LockLogicList.Count == 0) + //if (Common.Logic.LockLogicList.Count == 0) + if (!BoolExist()) { //灏辨槸涓轰簡鏄剧ず寮曞娣诲姞鍥炬爣; var noFrameLayout = new FrameLayout @@ -156,6 +177,11 @@ for (int i = 0; i < Common.Logic.LockLogicList.Count; i++) { var logic = Common.Logic.LockLogicList[i]; + if (!Exist(logic)) + { + continue; + } + var logicRowlayout = new RowLayout { Width = Application.GetRealWidth(1080), @@ -259,5 +285,50 @@ } } + + + /// <summary> + /// 鏌ユ壘璇ラ棬閿佹槸鍚﹀瓨鍦ㄨ嚜鍔ㄥ寲 + /// </summary> + /// <returns></returns> + private bool BoolExist() + { + bool yes = false; + for (int i = 0; i < Common.Logic.LockLogicList.Count; i++) + { + var logic = Common.Logic.LockLogicList[i]; + if (logic.LogicType != 1) + { + continue; + } + + if (Exist(logic)) + { + yes = true; + //瀛樺湪灏遍��鍑� + break; + } + } + return yes; + } + + /// <summary> + /// 鏌ユ壘杩欎竴鏉¤嚜鍔ㄥ寲鏄惁灞炰簬璇ラ棬閿� + /// </summary> + /// <returns></returns> + private bool Exist(Common.Logic logic) + { + for (int j = 0; j < logic.Accounts.Count; j++) + { + //Option4鏄澶噈ac锛汷ption2鏄澶囩鍙o紱 + if (logic.Accounts[j]["Option4"].ToString() == Send.CurrentDoorLock.DeviceAddr) + { + //鏌ユ壘鏄惁鏄偅涓棬閿侊紱 + //濡傛灉涓嶆槸璇ラ棬閿佽仈鍔ㄤ簨浠朵笉鏄剧ず鍑烘潵; + return true; + } + } + return false; + } } } -- Gitblit v1.8.0