From fdc47d950498e088260a3b04028703adc0f878e0 Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期一, 30 三月 2020 10:54:27 +0800 Subject: [PATCH] 2020-03-30-1 --- ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs | 231 +++++++++++++++++++-------------------------------------- 1 files changed, 77 insertions(+), 154 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs index 061dbcc..1efe402 100644 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs @@ -126,97 +126,41 @@ /// <summary> /// 閫夋嫨鏌愪釜鐢ㄦ埛 /// </summary> - /// <param name="membershipIfon">瑙﹀彂婧愬垪琛�</param> - public void SelectedUserID(Send.MembershipIfon membershipIfon) + /// <param name="user">瑙﹀彂婧愬垪琛�</param> + public void SelectedUserID(Send.MembershipIfon user) { - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - - flMain.MouseUpEventHandler += (sender1, e1) => + //鍏冪礌瓒呭嚭9涓氨鐢ㄤ笂涓嬫粦鍔ㄦ帶浠�; + VerticalScrolViewLayout vV = null; + int count = user.UserIdMode.Count; + if (count > 9) { - flMain.RemoveFromParent(); - }; - - - - var lockcolorfra1 = new FrameLayout - { - - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(530), - Y = Application.GetRealHeight(1920 - 530), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - Radius = (uint)Application.GetRealHeight(60), - }; - flMain.AddChidren(lockcolorfra1); - lockcolorfra1.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); + ///鍏冪礌瓒呭嚭9涓�; + count = 6; + //鍏冪礌瓒呭嚭9涓氨鐢ㄤ笂涓嬫粦鍔ㄦ帶浠�; + vV = new VerticalScrolViewLayout + { + Y = Application.GetRealHeight(140 + 20), + Height = Application.GetRealHeight(160 * count), + }; + //娓呴櫎涔嬪墠鐨勬帶浠�; + vV.RemoveAll(); + } #region -------鍙栨秷 瀹屾垚 - var lockRow = new RowLayout + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; + this.AddChidren(flMain); + CompleteView completeView = new CompleteView(); + flMain.AddChidren(completeView.Show(count)); + completeView.Btntitle.Text = user.UserName; + EventHandler<MouseEventArgs> clickcancel = (sender, e) => { - Height = Application.GetRealHeight(140), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - - }; - lockcolorfra1.AddChidren(lockRow); - var Btncancel = new Button - { - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - X = Application.GetRealWidth(80), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - }; - lockRow.AddChidren(Btncancel); - Btncancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); UserView.HomePage.Instance.ScrollEnabled = true; + flMain.RemoveFromParent(); }; - - var Btntitle = new Button - { - TextID = MyInternationalizationString.security, - TextColor = ZigbeeColor.Current.LogicBtnTypeColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(320), - TextAlignment = TextAlignment.Center, - X = Btncancel.Right + Application.GetRealWidth(100), - TextSize = 16, - Text = membershipIfon.UserName, - }; - lockRow.AddChidren(Btntitle); - var Btncomplete = new Button - { - TextID = MyInternationalizationString.complete, - TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.CenterRight, - X = Btntitle.Right + Application.GetRealWidth(100), - TextSize = 14, - - }; - lockRow.AddChidren(Btncomplete); + flMain.MouseUpEventHandler += clickcancel; + completeView.Btncancel.MouseUpEventHandler += clickcancel; #endregion - - - lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * membershipIfon.UserIdMode.Count) - 20 - 50); - lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * membershipIfon.UserIdMode.Count) + 20 + 50); - if (membershipIfon.UserIdMode.Count > 9) - { - ///鍏冪礌瓒呭嚭10涓紝鏆傛椂榛樿鏄剧ず10; - lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * 9) - 20 - 50); - lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * 9) + 20 + 50); - } - string SelectedLockStatus = ""; - ///瀹氫箟涓や釜鍙橀噺璁板綍閫変腑鐘舵�侊紱 - string attriButeId = ""; - string attriButeData2 = ""; - string modeName = ""; ///瀹氫袱涓彉閲忚褰曚箣鍓嶇殑鍙�硷紱 string userId = ""; @@ -224,71 +168,44 @@ string accountName = ""; string SelectedDeviceStatuscondition = ""; - for (int j = 0; j < membershipIfon.UserIdMode.Count; j++) + for (int i = 0; i < user.UserIdMode.Count; i++) { - var userIdmode = membershipIfon.UserIdMode[j]; - var doorlockfra = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = lockRow.Bottom + Application.GetRealHeight(20 + 160 * j), - }; - lockcolorfra1.AddChidren(doorlockfra); + var userifon = user.UserIdMode[i]; - var doorlockRow = new RowLayout + mFunView lockView = new mFunView(); + if (user.UserIdMode.Count > 9) { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - doorlockfra.AddChidren(doorlockRow); - - var doorlockBtn = new Button - { - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - Text = userIdmode.ModeName, - TextSize = 14, - }; - doorlockRow.AddChidren(doorlockBtn); - - var doorlockSelected = new Button - { - X = Application.GetRealWidth(860), - Width = Application.GetMinRealAverage(60), - Height = Application.GetMinRealAverage(60), - UnSelectedImagePath = "ZigeeLogic/selected.png", - Visible = false, - Gravity = Gravity.CenterVertical, - - }; - doorlockRow.AddChidren(doorlockSelected); - if ((membershipIfon.UserIdMode.Count - 1) == j) - { - doorlockRow.LineColor = ZigbeeColor.Current.LogicBackgroundColor; + //鍏冪礌瓒呭嚭9涓氨鐢ㄤ笂涓嬫粦鍔ㄦ帶浠�; + completeView.Show(count).AddChidren(vV); + vV.AddChidren(lockView.Show()); } - EventHandler<MouseEventArgs> doorlockclick = (sender2, e2) => + else { - SelectedLockStatus = "DoorLock"; - selectedIcon.Visible = false; - selectedIcon = doorlockSelected; - doorlockSelected.Visible = true; - //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - attriButeId = userIdmode.OpenMode.ToString(); - attriButeData2 = userIdmode.UserId; - modeName = userIdmode.ModeName; - }; - doorlockRow.MouseUpEventHandler += doorlockclick; - doorlockBtn.MouseUpEventHandler += doorlockclick; - doorlockSelected.MouseUpEventHandler += doorlockclick; - doorlockfra.MouseUpEventHandler += doorlockclick; + lockView.frameLayout.Y = Application.GetRealHeight(140 + 20 + 160 * i); + completeView.Show(count).AddChidren(lockView.Show()); + } + lockView.titleBtn.Text = userifon.ModeName; - if (string.IsNullOrEmpty(doorlockBtn.Text)) + if ((user.UserIdMode.Count - 1) == i) + { + lockView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + } + lockView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatuscondition = "DoorLock"; + selectedIcon.Visible = false; + selectedIcon = lockView.selectedIconBtn; + lockView.selectedIconBtn.Visible = true; + userId = userifon.UserId; + openMode = userifon.OpenMode.ToString(); + accountName = completeView.Btntitle.Text + lockView.titleBtn.Text; + }; + + + if (string.IsNullOrEmpty(lockView.titleBtn.Text)) { string strname = ""; - switch (userIdmode.OpenMode) + switch (userifon.OpenMode) { case 0: { @@ -306,25 +223,31 @@ } break; } - doorlockBtn.Text = userIdmode.UserId + strname; + lockView.titleBtn.Text = userifon.UserId + strname; } - ///鏄剧ず涔嬪墠鐨勭姸鎬� + if (conditionsIndex != -1) { - var s = Common.Logic.CurrentLogic.Conditions[conditionsIndex]; - if (s["AttriButeId"] == userIdmode.OpenMode.ToString() && s["AttriButeData2"] == userIdmode.UserId) + + ///鏄剧ず涔嬪墠鐨勭姸鎬� + if (conditionsIndex != -1) { - selectedIcon.Visible = false; - selectedIcon = doorlockSelected; - doorlockSelected.Visible = true; + var s = Common.Logic.CurrentLogic.Conditions[conditionsIndex]; + if (s["AttriButeId"] == userifon.OpenMode.ToString() && s["AttriButeData2"] == userifon.UserId) + { + selectedIcon.Visible = false; + selectedIcon = lockView.selectedIconBtn; + lockView.selectedIconBtn.Visible = true; + } + } - } + } - Btncomplete.MouseUpEventHandler += (sender, e) => + completeView.Btncomplete.MouseUpEventHandler += (sender, e) => { var lockConditionsInfo = new Dictionary<string, string>(); lockConditionsInfo.Add("Type", "1"); @@ -332,16 +255,16 @@ lockConditionsInfo.Add("MacAddr", Send.CurrentDoorLock.DeviceAddr); lockConditionsInfo.Add("Epoint", Send.CurrentDoorLock.DeviceEpoint.ToString()); lockConditionsInfo.Add("Cluster_ID", "64529"); - lockConditionsInfo.Add("AttriButeId", attriButeId); - lockConditionsInfo.Add("AttriButeData2", attriButeData2); + lockConditionsInfo.Add("AttriButeId", openMode); + lockConditionsInfo.Add("AttriButeData2", userId); lockConditionsInfo.Add("AttriButeData1", "2"); lockConditionsInfo.Add("Range", "0"); var accounts = new Dictionary<string, string>(); accounts.Add("Type", "1"); accounts.Add("Account", Config.Instance.Guid); - accounts.Add("AccountName", membershipIfon.UserName + modeName); - accounts.Add("UserId", attriButeData2); - if (SelectedLockStatus != "") + accounts.Add("AccountName",accountName); + accounts.Add("UserId", userId); + if (SelectedDeviceStatuscondition != "") { if (conditionsIndex == -1) { @@ -366,7 +289,7 @@ { if (Common.Logic.CurrentLogic.Accounts[i]["Type"] == "1") { - if (Common.Logic.CurrentLogic.Accounts[i]["UserId"] == attriButeData2) + if (Common.Logic.CurrentLogic.Accounts[i]["UserId"] == userId) { addAccount = true; break; -- Gitblit v1.8.0