From 863b530a1b95d59aee08d1cfa791ee8a1984596c Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期二, 05 十一月 2019 13:45:15 +0800 Subject: [PATCH] 2019-11-05-1 --- ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs | 91 ++++++++++++++++++++------------------------- 1 files changed, 41 insertions(+), 50 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs index 4d7983c..bc56662 100644 --- a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs @@ -9,25 +9,19 @@ { public class MemberList : FrameLayout { + public MemberList() + { + Tag = "Logic"; + } Button selectedIcon = new Button(); public static Action action; public static bool edit=false; - Dictionary<string, string> deviceConditionsInfo = new Dictionary<string, string>(); - Dictionary<string, string> userdictionary = new Dictionary<string, string>(); + public async void Show(CommonDevice common, Dictionary<string, string> editdeviceConditionsInfo=null) { - if (!edit) - { - deviceConditionsInfo.Add("Type", "1"); - deviceConditionsInfo.Add("IsValid", "1"); - deviceConditionsInfo.Add("MacAddr", common.DeviceAddr); - deviceConditionsInfo.Add("Epoint", common.DeviceEpoint.ToString()); - deviceConditionsInfo.Add("Cluster_ID", "64529"); - deviceConditionsInfo.Add("AttriButeData1", "2"); - deviceConditionsInfo.Add("Range", "0"); - editdeviceConditionsInfo = deviceConditionsInfo; - } + + UserView.HomePage.Instance.ScrollEnabled = false; this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; #region 鏈�涓婇潰鐨勫竷灞�浠g爜 @@ -45,7 +39,7 @@ TextColor = ZigbeeColor.Current.LogicTextBlackColor, TextAlignment = TextAlignment.CenterLeft, X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(400), + Width = Application.GetRealWidth(600), Height = Application.GetRealHeight(69), Y = Application.GetRealHeight(92), TextID = MyInternationalizationString.userlist, @@ -209,8 +203,8 @@ }; lockRow.AddChidren(Btncomplete); #endregion - - string SelectedDeviceStatuscondition = ""; + ///瀹氫袱涓彉閲忚褰曚箣鍓嶇殑鍙�硷紱 + string userId = "", openMode = "", accountname="", SelectedDeviceStatuscondition = ""; lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * user.UserIdMode.Count) - 20 - 50); lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * user.UserIdMode.Count) + 20 + 50); for (int i = 0; i < user.UserIdMode.Count; i++) @@ -280,48 +274,27 @@ selectedIcon.Visible = false; selectedIcon = doorlockSelected; doorlockSelected.Visible = true; + userId = userifon.UserId; + openMode = userifon.OpenMode.ToString(); + accountname = Btntitle.Text + doorlockBtn.Text; //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - if (deviceConditionsInfo.ContainsKey("AttriButeId")) - { - deviceConditionsInfo.Remove("AttriButeId"); - } - if (deviceConditionsInfo.ContainsKey("AttriButeData2")) - { - deviceConditionsInfo.Remove("AttriButeData2"); - } - deviceConditionsInfo.Add("AttriButeId", userifon.OpenMode.ToString()); - deviceConditionsInfo.Add("AttriButeData2", userifon.UserId); - if (userdictionary.ContainsKey("Account")) - { - userdictionary.Remove("Account"); - } - if (userdictionary.ContainsKey("Type")) - { - userdictionary.Remove("Type"); - } - if (userdictionary.ContainsKey("UserId")) - { - userdictionary.Remove("UserId"); - } - userdictionary.Add("Account", Btntitle.Text+doorlockBtn.Text); - userdictionary.Add("Type", "1"); - userdictionary.Add("UserId", userifon.UserId); }; doorlockRow.MouseUpEventHandler += doorlockclick; doorlockBtn.MouseUpEventHandler += doorlockclick; doorlockSelected.MouseUpEventHandler += doorlockclick; doorlockfra.MouseUpEventHandler += doorlockclick; - if (edit) + + if (edit && editdeviceConditionsInfo != null) { - if (editdeviceConditionsInfo["AttriButeData2"] == userifon.OpenMode.ToString()) + + if (editdeviceConditionsInfo["AttriButeData2"] == userifon.UserId.ToString()) { selectedIcon.Visible = false; selectedIcon = doorlockSelected; doorlockSelected.Visible = true; - } - + } } @@ -329,9 +302,24 @@ Btncomplete.MouseUpEventHandler += (sender3, e3) => { + var deviceConditionsInfo = new Dictionary<string, string>(); + var userdictionary = new Dictionary<string, string>(); + deviceConditionsInfo.Add("Type", "1"); + deviceConditionsInfo.Add("IsValid", "1"); + deviceConditionsInfo.Add("MacAddr", common.DeviceAddr); + deviceConditionsInfo.Add("Epoint", common.DeviceEpoint.ToString()); + deviceConditionsInfo.Add("Cluster_ID", "64529"); + deviceConditionsInfo.Add("AttriButeData1", "2"); + deviceConditionsInfo.Add("Range", "0"); + deviceConditionsInfo.Add("AttriButeId", openMode); + deviceConditionsInfo.Add("AttriButeData2", userId); + userdictionary.Add("Account",accountname); + userdictionary.Add("Type", "1"); + userdictionary.Add("UserId", userId); + if (SelectedDeviceStatuscondition != "") { - + bool add = false; for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++) { if (Common.Logic.CurrentLogic.Conditions[i]["Type"] == "1") @@ -350,14 +338,17 @@ Common.Logic.CurrentLogic.Accounts.Insert(j, userdictionary); } } - return; + add = true; + break; } } } } - - Common.Logic.CurrentLogic.Accounts.Add(userdictionary); - Common.Logic.CurrentLogic.Conditions.Add(deviceConditionsInfo); + if (!add) + { + Common.Logic.CurrentLogic.Accounts.Add(userdictionary); + Common.Logic.CurrentLogic.Conditions.Add(deviceConditionsInfo); + } } else -- Gitblit v1.8.0