| | |
| | | Tag = "LockLogic"; |
| | | } |
| | | Button selectedIcon = new Button(); |
| | | |
| | | VerticalScrolViewLayout middle; |
| | | public int conditionsIndex = -1; |
| | | |
| | | public async void Show() |
| | | { |
| | | #region 最上面的布局代码 |
| | |
| | | |
| | | #endregion |
| | | |
| | | var middle = new VerticalScrolViewLayout |
| | | middle = new VerticalScrolViewLayout |
| | | { |
| | | Y = topRowLayout.Bottom, |
| | | Height = Application.GetRealHeight(1920 - 184), |
| | |
| | | d = true; |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | CommonPage.Loading.Start(); |
| | | if (!d) |
| | | { |
| | | |
| | | var allMemberslist = await Send.AllMembers(Send.CurrentDoorLock.DeviceAddr); |
| | | Send.LockList.AddRange(allMemberslist); |
| | | } |
| | | UserAllView(middle, macport); |
| | | UserAllView(macport); |
| | | CommonPage.Loading.Hide(); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 显示所有用户 |
| | | /// </summary> |
| | | /// <param name="middle"></param> |
| | | void UserAllView(VerticalScrolViewLayout middle,string macport) |
| | | void UserAllView(string macport) |
| | | { |
| | | |
| | | for (int i = 0; i < Send.LockList.Count; i++) |
| | |
| | | |
| | | EventHandler<MouseEventArgs> userclick = (sender, e) => |
| | | { |
| | | SelectedUserID(user.UserIdMode, usernameBtn.Text); |
| | | SelectedUserID(user); |
| | | }; |
| | | usernameBtn.MouseUpEventHandler += userclick; |
| | | btntimeback.MouseUpEventHandler += userclick; |
| | |
| | | /// </summary> |
| | | /// <param name="membershipIfon">触发源列表</param> |
| | | /// <param name="userName">用户名字</param> |
| | | void SelectedUserID(List<Send.UnlockingMode> membershipIfon, string userName) { |
| | | void SelectedUserID(Send.MembershipIfon membershipIfon) { |
| | | |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | this.AddChidren(flMain); |
| | |
| | | TextAlignment = TextAlignment.Center, |
| | | X = Btncancel.Right + Application.GetRealWidth(100), |
| | | TextSize = 16, |
| | | Text =userName, |
| | | Text = membershipIfon.UserName, |
| | | }; |
| | | lockRow.AddChidren(Btntitle); |
| | | var Btncomplete = new Button |
| | |
| | | #endregion |
| | | |
| | | string SelectedLockStatus = ""; |
| | | lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * membershipIfon.Count) - 20 - 50); |
| | | lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * membershipIfon.Count) + 20 + 50); |
| | | lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * membershipIfon.UserIdMode.Count) - 20 - 50); |
| | | lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * membershipIfon.UserIdMode.Count) + 20 + 50); |
| | | ///定义两个变量记录选中状态; |
| | | string attriButeId ="", attriButeData2 =""; |
| | | for (int j = 0; j < membershipIfon.Count; j++) |
| | | string attriButeId = ""; |
| | | string attriButeData2 = ""; |
| | | string modeName = ""; |
| | | for (int j = 0; j < membershipIfon.UserIdMode.Count; j++) |
| | | { |
| | | var userIdmode = membershipIfon[j]; |
| | | var userIdmode = membershipIfon.UserIdMode[j]; |
| | | var doorlockfra = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | |
| | | TextSize = 14, |
| | | }; |
| | | doorlockRow.AddChidren(doorlockBtn); |
| | | //(0按键/3卡/15指纹) |
| | | //switch (userIdmode.OpenMode.ToString()) |
| | | //{ |
| | | // case "0": |
| | | // { |
| | | // doorlockBtn.Text = Language.StringByID(MyInternationalizationString.lockpassword); |
| | | // } |
| | | // break; |
| | | // case "3": |
| | | // { |
| | | // doorlockBtn.Text = Language.StringByID(MyInternationalizationString.ic); |
| | | // } |
| | | // break; |
| | | // case "15": |
| | | // { |
| | | // doorlockBtn.Text = Language.StringByID(MyInternationalizationString.fingerprint); |
| | | // } |
| | | // break; |
| | | //} |
| | | |
| | | |
| | | |
| | | var doorlockSelected = new Button |
| | | { |
| | | X = Application.GetRealWidth(860), |
| | |
| | | |
| | | }; |
| | | doorlockRow.AddChidren(doorlockSelected); |
| | | if ((membershipIfon.Count - 1) == j) |
| | | if ((membershipIfon.UserIdMode.Count - 1) == j) |
| | | { |
| | | doorlockRow.LineColor = ZigbeeColor.Current.LogicBackgroundColor; |
| | | } |
| | |
| | | //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | attriButeId = userIdmode.OpenMode.ToString(); |
| | | attriButeData2 = userIdmode.UserId; |
| | | modeName = userIdmode.ModeName; |
| | | }; |
| | | doorlockRow.MouseUpEventHandler += doorlockclick; |
| | | doorlockBtn.MouseUpEventHandler += doorlockclick; |
| | |
| | | selectedIcon = doorlockSelected; |
| | | doorlockSelected.Visible = true; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | lockConditionsInfo.Add("AttriButeData2", attriButeData2); |
| | | lockConditionsInfo.Add("AttriButeData1", "2"); |
| | | lockConditionsInfo.Add("Range", "0"); |
| | | var accounts = new Dictionary<string, string>(); |
| | | accounts.Add("Type", "1"); |
| | | accounts.Add("Account", membershipIfon.UserName+ modeName); |
| | | accounts.Add("UserId", attriButeData2); |
| | | if (SelectedLockStatus != "") |
| | | { |
| | | if (conditionsIndex == -1) |
| | | { |
| | | bool add = false; |
| | | bool addCondition = false; |
| | | bool addAccount = false; |
| | | for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++) |
| | | { |
| | | if (Common.Logic.CurrentLogic.Conditions[i]["Type"] == "1") |
| | |
| | | { |
| | | if (Common.Logic.CurrentLogic.Conditions[i]["AttriButeId"] == lockConditionsInfo["AttriButeId"] && Common.Logic.CurrentLogic.Conditions[i]["AttriButeData2"] == lockConditionsInfo["AttriButeData2"]) |
| | | { |
| | | add = true; |
| | | addCondition = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!add) |
| | | if (!addCondition) |
| | | { |
| | | Common.Logic.CurrentLogic.Conditions.Add(lockConditionsInfo); |
| | | } |
| | | |
| | | for (int i = 0; i < Common.Logic.CurrentLogic.Accounts.Count; i++) |
| | | { |
| | | if (Common.Logic.CurrentLogic.Accounts[i]["Type"] == "1") |
| | | { |
| | | if (Common.Logic.CurrentLogic.Accounts[i]["UserId"] == attriButeData2) |
| | | { |
| | | addAccount = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (!addAccount) |
| | | { |
| | | Common.Logic.CurrentLogic.Accounts.Add(accounts); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | ///找出之前的旧数据移除掉,再重新添加新数据; |
| | | string accountuserId = Common.Logic.CurrentLogic.Conditions[conditionsIndex]["AttriButeData2"]; |
| | | Common.Logic.CurrentLogic.Conditions.RemoveAt(conditionsIndex); |
| | | Common.Logic.CurrentLogic.Conditions.Insert(conditionsIndex, lockConditionsInfo); |
| | | for (int i = 0; i < Common.Logic.CurrentLogic.Accounts.Count; i++) |
| | | { |
| | | if (Common.Logic.CurrentLogic.Accounts[i]["Type"] == "1") |
| | | { |
| | | ///找出之前的旧数据移除掉,再重新添加新数据; |
| | | if (Common.Logic.CurrentLogic.Accounts[i]["UserId"] == accountuserId) |
| | | { |
| | | Common.Logic.CurrentLogic.Accounts.RemoveAt(i); |
| | | Common.Logic.CurrentLogic.Accounts.Insert(i, accounts); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |