| | |
| | | this.AddChidren(view.TopRowView()); |
| | | view.toptitleNameBtn.TextID = MyInternationalizationString.linkageevent; |
| | | view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; |
| | | //加大点击热键 |
| | | var addiocnclick = new Button |
| | | { |
| | | Width = Application.GetRealWidth(108+58), |
| | | Height = Application.GetRealHeight(72+20), |
| | | X = Application.GetRealWidth(1080 - 108 - 58), |
| | | Y = Application.GetRealHeight(184 - 72), |
| | | }; |
| | | view.topRowLayout.AddChidren(addiocnclick); |
| | | |
| | | var addiocn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(72), |
| | | Height = Application.GetRealHeight(72), |
| | | Width = Application.GetMinRealAverage(72), |
| | | Height = Application.GetMinRealAverage(72), |
| | | X = Application.GetRealWidth(1080 - 108 - 58), |
| | | UnSelectedImagePath = "ZigeeLogic/lockadd.png", |
| | | Y = Application.GetRealHeight(184 - 72 - 20), |
| | | }; |
| | | view.topRowLayout.AddChidren(addiocn); |
| | | addiocn.MouseUpEventHandler += (sender, e) => |
| | | |
| | | EventHandler<MouseEventArgs> addclick = (sender, e) => |
| | | { |
| | | //new一个新逻辑对象; |
| | | Common.Logic.CurrentLogic = new Common.Logic(); |
| | |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | lockLogicCommunalPage.Show(() => { }); |
| | | }; |
| | | |
| | | addiocnclick.MouseUpEventHandler += addclick; |
| | | addiocn.MouseUpEventHandler += addclick; |
| | | |
| | | #endregion |
| | | middle = new VerticalRefreshLayout |
| | | { |
| | | Y = view.topRowLayout.Bottom, |
| | | Height = Application.GetRealHeight(1920 - 184), |
| | | Height = Application.GetRealHeight(Method.H - 184), |
| | | BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, |
| | | }; |
| | | this.AddChidren(middle); |
| | |
| | | /// </summary> |
| | | public async void Read() |
| | | { |
| | | |
| | | CommonPage.Loading.Start(); |
| | | if (Common.Logic.LockLogicList.Count == 0) |
| | | if (!BoolExist()) |
| | | { |
| | | var Idlist = await Send.GetLogicId(1); |
| | | if (Idlist.Count != 0) |
| | |
| | | { |
| | | continue; |
| | | } |
| | | bool yes = false; |
| | | for (int a = 0; a < logic.Accounts.Count; a++) |
| | | { |
| | | if (logic.Accounts[a]["Account"].ToString() == Config.Instance.Guid) |
| | | { |
| | | //查找自己账号下的创建联动事件; |
| | | yes = true; |
| | | break; |
| | | } |
| | | } |
| | | if (yes) |
| | | { |
| | | Common.Logic.LockLogicList.Add(listlogic[j]); |
| | | } |
| | | Common.Logic.LockLogicList.Add(logic); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | middle.RemoveAll(); |
| | | |
| | | if (Common.Logic.LockLogicList.Count == 0) |
| | | //if (Common.Logic.LockLogicList.Count == 0) |
| | | if (!BoolExist()) |
| | | { |
| | | //就是为了显示引导添加图标; |
| | | var noFrameLayout = new FrameLayout |
| | |
| | | for (int i = 0; i < Common.Logic.LockLogicList.Count; i++) |
| | | { |
| | | var logic = Common.Logic.LockLogicList[i]; |
| | | if (!Exist(logic)) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | var logicRowlayout = new RowLayout |
| | | { |
| | | Width = Application.GetRealWidth(1080), |
| | |
| | | logicRowlayout.AddRightView(del); |
| | | del.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, |
| | | var alert = new ShowMsgControl(ShowMsgType.Confirm, |
| | | Language.StringByID(MyInternationalizationString.doyouwanttodelete), |
| | | Language.StringByID(MyInternationalizationString.confrim));
|
| | | alert.Show();
|
| | | alert.ConfirmClickEvent += () =>
|
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | | alert.ConfirmClickEvent += () => |
| | | { |
| | | Common.Logic.LockLogicList.Remove(logic); |
| | | Automationview(); |
| | | Send.DelLogic(logic.LogicId);
|
| | | Send.DelLogic(logic.LogicId); |
| | | }; |
| | | |
| | | }; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 查找该门锁是否存在自动化 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private bool BoolExist() |
| | | { |
| | | bool yes = false; |
| | | for (int i = 0; i < Common.Logic.LockLogicList.Count; i++) |
| | | { |
| | | var logic = Common.Logic.LockLogicList[i]; |
| | | if (logic.LogicType != 1) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | if (Exist(logic)) |
| | | { |
| | | yes = true; |
| | | //存在就退出 |
| | | break; |
| | | } |
| | | } |
| | | return yes; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查找这一条自动化是否属于该门锁 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private bool Exist(Common.Logic logic) |
| | | { |
| | | for (int j = 0; j < logic.Accounts.Count; j++) |
| | | { |
| | | //Option4是设备mac;Option2是设备端口; |
| | | if (logic.Accounts[j]["Option4"].ToString() == Send.CurrentDoorLock.DeviceAddr) |
| | | { |
| | | //查找是否是那个门锁; |
| | | //如果不是该门锁联动事件不显示出来; |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | } |