| | |
| | | Button selectedIcon = new Button(); |
| | | |
| | | public int conditionsIndex = -1; |
| | | public void Show() |
| | | public async void Show() |
| | | { |
| | | #region 最上面的布局代码 |
| | | var topRowLayout = new RowLayout |
| | |
| | | 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.selection, |
| | | Text = "选择用户", |
| | | TextID = MyInternationalizationString.userlist, |
| | | //Text = "选择用户", |
| | | }; |
| | | topRowLayout.AddChidren(titleName); |
| | | |
| | |
| | | this.AddChidren(middle); |
| | | |
| | | |
| | | var userlist = new List<ZigBee.Device.DoorLock.LocaDoorLockObj>(); |
| | | userlist.Clear(); |
| | | ///判断APP登录进来用户身份(主人,管理员,成员) |
| | | if (UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 3) |
| | | if (Send.LinkageventLockList.Count == 0) |
| | | { |
| | | var list = LockIfon.GetUserIfon(LockIfon.UserMemberInfoRes.SubAccountDistributedMark); |
| | | foreach (var o in list) |
| | | { |
| | | if (userlist.Count != 0) |
| | | { |
| | | continue; |
| | | } |
| | | userlist.Add(o); |
| | | } |
| | | var allMemberslist = await Send.AllMembers(Send.CurrentDoorLock.DeviceAddr); |
| | | Send.LinkageventLockList.AddRange(allMemberslist); |
| | | } |
| | | else |
| | | UserAllView(middle); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 显示所有用户 |
| | | /// </summary> |
| | | /// <param name="middle"></param> |
| | | void UserAllView(VerticalScrolViewLayout middle) |
| | | { |
| | | |
| | | for (int i = 0; i < Send.LinkageventLockList.Count; i++) |
| | | { |
| | | userlist = LockIfon.GetUserList(); |
| | | } |
| | | for (int i = 0; i < userlist.Count; i++) |
| | | { |
| | | var user = userlist[i]; |
| | | var user = Send.LinkageventLockList[i]; |
| | | var userFramelayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | |
| | | |
| | | var usernameBtn = new Button |
| | | { |
| | | Text = user.UserName, |
| | | Text = user.MembershipName, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | Width = Application.GetRealWidth(600), |
| | | Height = Application.GetRealHeight(130), |
| | | Tag = userlist[i].ConnectedAccount |
| | | Tag = Send.LinkageventLockList[i], |
| | | }; |
| | | userRow.AddChidren(usernameBtn); |
| | | |
| | |
| | | |
| | | EventHandler<MouseEventArgs> userclick = (sender, e) => |
| | | { |
| | | var uesrifonlist = LockIfon.GetUserIfon(usernameBtn.Tag.ToString()); |
| | | SelectedUserID(uesrifonlist, usernameBtn.Text); |
| | | SelectedUserID(user.UserIdMode, usernameBtn.Text); |
| | | }; |
| | | usernameBtn.MouseUpEventHandler += userclick; |
| | | btntimeback.MouseUpEventHandler += userclick; |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 选择某个用户 |
| | | /// </summary> |
| | | /// <param name="uesrifonlist">触发源列表</param> |
| | | /// <param name="membershipIfon">触发源列表</param> |
| | | /// <param name="userName">用户名字</param> |
| | | void SelectedUserID(List<ZigBee.Device.DoorLock.LocaDoorLockObj> uesrifonlist,string userName) { |
| | | void SelectedUserID(List<Send.LockMode> membershipIfon, string userName) { |
| | | |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | this.AddChidren(flMain); |
| | |
| | | #endregion |
| | | |
| | | string SelectedLockStatus = ""; |
| | | lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * uesrifonlist.Count) - 20 - 50); |
| | | lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * uesrifonlist.Count) + 20 + 50); |
| | | lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * membershipIfon.Count) - 20 - 50); |
| | | lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * membershipIfon.Count) + 20 + 50); |
| | | ///定义两个变量记录选中状态; |
| | | int attriButeId = 0, attriButeData2 = 0; |
| | | for (int j = 0; j < uesrifonlist.Count; j++) |
| | | string attriButeId ="", attriButeData2 =""; |
| | | for (int j = 0; j < membershipIfon.Count; j++) |
| | | { |
| | | var userid = uesrifonlist[j]; |
| | | var userIdmode = membershipIfon[j]; |
| | | var doorlockfra = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | |
| | | }; |
| | | doorlockRow.AddChidren(doorlockBtn); |
| | | //(0按键/3卡/15指纹) |
| | | switch (userid.UnlockType) |
| | | switch (userIdmode.OpenMode.ToString()) |
| | | { |
| | | case 0: |
| | | case "0": |
| | | { |
| | | doorlockBtn.Text = Language.StringByID(MyInternationalizationString.lockpassword); |
| | | } |
| | | break; |
| | | case 3: |
| | | case "3": |
| | | { |
| | | doorlockBtn.Text = Language.StringByID(MyInternationalizationString.ic); |
| | | } |
| | | break; |
| | | case 15: |
| | | case "15": |
| | | { |
| | | doorlockBtn.Text = Language.StringByID(MyInternationalizationString.fingerprint); |
| | | } |
| | |
| | | |
| | | }; |
| | | doorlockRow.AddChidren(doorlockSelected); |
| | | if ((uesrifonlist.Count - 1) == j) |
| | | if ((membershipIfon.Count - 1) == j) |
| | | { |
| | | doorlockRow.LineColor = ZigbeeColor.Current.LogicBackgroundColor; |
| | | } |
| | |
| | | selectedIcon = doorlockSelected; |
| | | doorlockSelected.Visible = true; |
| | | //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | attriButeId = userid.UnlockType; |
| | | attriButeData2 = userid.UserID; |
| | | attriButeId = userIdmode.OpenMode.ToString(); |
| | | attriButeData2 = userIdmode.UserId; |
| | | }; |
| | | doorlockRow.MouseUpEventHandler += doorlockclick; |
| | | doorlockBtn.MouseUpEventHandler += doorlockclick; |
| | |
| | | if (conditionsIndex != -1) |
| | | { |
| | | var s = Common.Logic.CurrentLogic.Conditions[conditionsIndex]; |
| | | if (s["AttriButeId"] == userid.UnlockType.ToString() && s["AttriButeData2"] == userid.UserID.ToString()) |
| | | if (s["AttriButeId"] == userIdmode.OpenMode.ToString() && s["AttriButeData2"] == userIdmode.UserId) |
| | | { |
| | | selectedIcon.Visible = false; |
| | | selectedIcon = doorlockSelected; |
| | |
| | | var lockConditionsInfo = new Dictionary<string, string>(); |
| | | lockConditionsInfo.Add("Type", "1"); |
| | | lockConditionsInfo.Add("IsValid", "1"); |
| | | lockConditionsInfo.Add("MacAddr", LockIfon.DoorLock.DeviceAddr); |
| | | lockConditionsInfo.Add("Epoint", LockIfon.DoorLock.DeviceEpoint.ToString()); |
| | | lockConditionsInfo.Add("MacAddr", Send.CurrentDoorLock.DeviceAddr); |
| | | lockConditionsInfo.Add("Epoint", Send.CurrentDoorLock.DeviceEpoint.ToString()); |
| | | lockConditionsInfo.Add("Cluster_ID", "64529"); |
| | | lockConditionsInfo.Add("AttriButeId", attriButeId.ToString()); |
| | | lockConditionsInfo.Add("AttriButeData2", attriButeData2.ToString()); |
| | | lockConditionsInfo.Add("AttriButeId", attriButeId); |
| | | lockConditionsInfo.Add("AttriButeData2", attriButeData2); |
| | | lockConditionsInfo.Add("AttriButeData1", "2"); |
| | | lockConditionsInfo.Add("Range", "0"); |
| | | if (SelectedLockStatus != "") |
| | | { |
| | | if (conditionsIndex == -1) |
| | | { |
| | | Common.Logic.CurrentLogic.Conditions.Add(lockConditionsInfo); |
| | | bool add = 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]["MacAddr"] == Send.CurrentDoorLock.DeviceAddr) && (Common.Logic.CurrentLogic.Conditions[i]["Epoint"] == Send.CurrentDoorLock.DeviceEpoint.ToString())) |
| | | { |
| | | if (Common.Logic.CurrentLogic.Conditions[i]["AttriButeId"] == lockConditionsInfo["AttriButeId"] && Common.Logic.CurrentLogic.Conditions[i]["AttriButeData2"] == lockConditionsInfo["AttriButeData2"]) |
| | | { |
| | | add = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!add) |
| | | { |
| | | Common.Logic.CurrentLogic.Conditions.Add(lockConditionsInfo); |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | lockLogicCommunalPage.Show(() => { }); |
| | | }; |
| | | } |
| | | |
| | | } |
| | | } |