| | |
| | | Tag = "LockLogic"; |
| | | } |
| | | Button selectedIcon = new Button(); |
| | | VerticalScrolViewLayout middle; |
| | | VerticalRefreshLayout middle; |
| | | public int conditionsIndex = -1; |
| | | |
| | | public async void Show() |
| | | public void Show() |
| | | { |
| | | #region 最上面的布局代码 |
| | | var topRowLayout = new RowLayout |
| | |
| | | Height = Application.GetRealHeight(69), |
| | | Y = Application.GetRealHeight(92), |
| | | TextID = MyInternationalizationString.userlist, |
| | | IsBold = true, |
| | | //Text = "选择用户", |
| | | }; |
| | | topRowLayout.AddChidren(titleName); |
| | |
| | | |
| | | #endregion |
| | | |
| | | middle = new VerticalScrolViewLayout |
| | | middle = new VerticalRefreshLayout |
| | | { |
| | | Y = topRowLayout.Bottom, |
| | | Height = Application.GetRealHeight(1920 - 184), |
| | | BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, |
| | | }; |
| | | this.AddChidren(middle); |
| | | middle.BeginHeaderRefreshingAction += () => |
| | | { |
| | | //重新刷新logic列表 |
| | | string macport = Send.CurrentDoorLock.DeviceAddr + "_" + Send.CurrentDoorLock.DeviceEpoint.ToString(); |
| | | for (int i = 0; i < Send.LockList.Count; i++) |
| | | { |
| | | if (Send.LockList[i].DoorLockMacPort == macport) |
| | | { |
| | | ///从列表移除当前门锁全部的旧数据; |
| | | Send.LockList.Remove(Send.LockList[i]); |
| | | i--; |
| | | } |
| | | } |
| | | Read(); |
| | | //关闭刷新View; |
| | | middle.EndHeaderRefreshing(); |
| | | }; |
| | | Read(); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 读取当前门锁的云端数据; |
| | | /// </summary> |
| | | public void Read() |
| | | { |
| | | bool d = false; |
| | | string macport = Send.CurrentDoorLock.DeviceAddr + "_" + Send.CurrentDoorLock.DeviceEpoint.ToString(); |
| | | for (int i = 0; i < Send.LockList.Count; i++) |
| | |
| | | } |
| | | } |
| | | CommonPage.Loading.Start(); |
| | | if (!d) |
| | | middle.RemoveAll(); |
| | | System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | var allMemberslist = await Send.AllMembers(Send.CurrentDoorLock.DeviceAddr); |
| | | Send.LockList.AddRange(allMemberslist); |
| | | } |
| | | UserAllView(macport); |
| | | CommonPage.Loading.Hide(); |
| | | |
| | | try |
| | | { |
| | | if (!d) |
| | | { |
| | | var allMemberslist = await Send.AllMembers(macport); |
| | | Send.LockList.AddRange(allMemberslist); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | UserAllView(macport); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | /// <summary> |
| | | /// 显示所有用户 |
| | | /// </summary> |
| | | void UserAllView(string macport) |
| | | public void UserAllView(string macport) |
| | | { |
| | | |
| | | middle.RemoveAll(); |
| | | for (int i = 0; i < Send.LockList.Count; i++) |
| | | { |
| | | var user = Send.LockList[i]; |
| | |
| | | /// 选择某个用户 |
| | | /// </summary> |
| | | /// <param name="membershipIfon">触发源列表</param> |
| | | /// <param name="userName">用户名字</param> |
| | | void SelectedUserID(Send.MembershipIfon membershipIfon) { |
| | | public void SelectedUserID(Send.MembershipIfon membershipIfon) |
| | | { |
| | | |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; |
| | | this.AddChidren(flMain); |
| | | |
| | | flMain.MouseUpEventHandler += (sender1, e1) => |
| | |
| | | flMain.RemoveFromParent(); |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | var lockcolorfra1 = new FrameLayout |
| | | { |
| | |
| | | Radius = (uint)Application.GetRealHeight(60), |
| | | }; |
| | | flMain.AddChidren(lockcolorfra1); |
| | | lockcolorfra1.SetCornerWithSameRadius(20, HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); |
| | | lockcolorfra1.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); |
| | | |
| | | #region -------取消 完成 |
| | | var lockRow = new RowLayout |
| | |
| | | lockRow.AddChidren(Btncomplete); |
| | | #endregion |
| | | |
| | | string SelectedLockStatus = ""; |
| | | |
| | | 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 = ""; |
| | | |
| | | for (int j = 0; j < membershipIfon.UserIdMode.Count; j++) |
| | | { |
| | | var userIdmode = membershipIfon.UserIdMode[j]; |
| | |
| | | TextSize = 14, |
| | | }; |
| | | doorlockRow.AddChidren(doorlockBtn); |
| | | |
| | | |
| | | var doorlockSelected = new Button |
| | | { |
| | | X = Application.GetRealWidth(860), |
| | |
| | | selectedIcon.Visible = false; |
| | | selectedIcon = doorlockSelected; |
| | | doorlockSelected.Visible = true; |
| | | //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | attriButeId = userIdmode.OpenMode.ToString(); |
| | | //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | attriButeId = userIdmode.OpenMode.ToString(); |
| | | attriButeData2 = userIdmode.UserId; |
| | | modeName = userIdmode.ModeName; |
| | | }; |
| | |
| | | selectedIcon = doorlockSelected; |
| | | doorlockSelected.Visible = true; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | Btncomplete.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var lockConditionsInfo = new Dictionary<string, string>(); |
| | |
| | | lockConditionsInfo.Add("Range", "0"); |
| | | var accounts = new Dictionary<string, string>(); |
| | | accounts.Add("Type", "1"); |
| | | accounts.Add("Account", membershipIfon.UserName+ modeName); |
| | | accounts.Add("Account", membershipIfon.UserName + modeName); |
| | | accounts.Add("UserId", attriButeData2); |
| | | if (SelectedLockStatus != "") |
| | | { |
| | |
| | | { |
| | | if (conditionsIndex == -1) |
| | | { |
| | | var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt), |
| | | Language.StringByID(MyInternationalizationString.selectdevicestatuscondition), |
| | | Language.StringByID(MyInternationalizationString.complete)); |
| | | var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, |
| | | Language.StringByID(MyInternationalizationString.usertip), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | | return; |
| | | } |
| | |
| | | lockLogicCommunalPage.Show(() => { }); |
| | | }; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |