黄学彪
2020-04-15 23532fa8ad34c89b6d24b01eaef6475fd0aad898
ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
@@ -22,6 +22,7 @@
        {
            #region  最上面的布局代码
            UserView.HomePage.Instance.ScrollEnabled = false;//锁住左滑
            TopView view = new TopView();
            this.AddChidren(view.TopRowView());
            if (Common.Logic.CurrentLogic.LogicId != 0)
@@ -40,7 +41,7 @@
            var middle = new VerticalScrolViewLayout
            {
                Y = view.topRowLayout.Bottom,
                Height = Application.GetRealHeight(1920 - 184 - 180),
                Height = Application.GetRealHeight(Method.H - 184 - 180),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
            };
            this.AddChidren(middle);
@@ -127,6 +128,9 @@
                {
                    SelectedDeviceView selecteddevice = new SelectedDeviceView();
                    selecteddevice.Show(middle);
                    selecteddevice.stateRow.AddRightView(selecteddevice.edit);
                    selecteddevice.stateRow.AddRightView(selecteddevice.del);
                    var Type = int.Parse(ListConditions[i]["Type"]);
                    var conditions = ListConditions[i];
                    switch (Type)
@@ -135,7 +139,7 @@
                            {
                                var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]);
                                selecteddevice.deviceNameBtn.Visible = true;
                                selecteddevice.deviceNameBtn.Text = deviceinof.DeviceEpointName;
                                selecteddevice.deviceNameBtn.Text = LocalDevice.Current.GetDeviceEpointName(deviceinof);
                                selecteddevice.regionNameBtn.Visible = true;
                                Method.RoomNmae(selecteddevice.regionNameBtn, deviceinof);
                                selecteddevice.edit.Tag = i;
@@ -150,7 +154,7 @@
                                                {
                                                    if (Common.Logic.CurrentLogic.Accounts[a]["UserId"] == conditions["AttriButeData2"])
                                                    {
                                                        selecteddevice.selecetddevicestateBtn.Text = Common.Logic.CurrentLogic.Accounts[a]["Account"];
                                                        selecteddevice.selecetddevicestateBtn.Text = Common.Logic.CurrentLogic.Accounts[a]["AccountName"];
                                                        break;
                                                    }
                                                }
@@ -179,10 +183,11 @@
                        alert.ConfirmClickEvent += () =>
                        {
                            Common.Logic.CurrentLogic.Conditions.Remove(conditions);
                            var lockLogicCommunalPage = new LockLogicCommunalPage();
                            UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
                            UserView.HomePage.Instance.PageIndex += 1;
                            lockLogicCommunalPage.Show(() => { });
                            selecteddevice.selecetdFrameLayout.RemoveFromParent();
                            //var lockLogicCommunalPage = new LockLogicCommunalPage();
                            //UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
                            //UserView.HomePage.Instance.PageIndex += 1;
                            //lockLogicCommunalPage.Show(() => { });
                        };
                    };
@@ -201,10 +206,7 @@
            addactionview.clickBtn.MouseUpEventHandler += (sender, e) =>
            {
                Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
                var addAction = new AddAction();
                UserView.HomePage.Instance.AddChidren(addAction);
                UserView.HomePage.Instance.PageIndex += 1;
                addAction.Show();
                Method.View(LogicView.IfString.Action_LockAction, LogicView.IfString.Action_LockScene);
            };
            List<Dictionary<string, object>> ListActions = new List<Dictionary<string, object>>();
@@ -218,15 +220,12 @@
                {
                    LogicView.AddDeviceView addflview = new LogicView.AddDeviceView();
                    addflview.titleBtn.TextID = MyInternationalizationString.selectunlockingmode;
                    addflview.titleBtn.TextID = MyInternationalizationString.addaction;
                    middle.AddChidren(addflview.AddFl());
                    addflview.clickBtn.MouseUpEventHandler += (sender, e) =>
                    {
                        Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
                        var addAction = new AddAction();
                        UserView.HomePage.Instance.AddChidren(addAction);
                        UserView.HomePage.Instance.PageIndex += 1;
                        addAction.Show();
                        Method.View(LogicView.IfString.Action_LockAction, LogicView.IfString.Action_LockScene);
                    };
                }
                else
@@ -241,11 +240,13 @@
                    string state = "";
                    switch (linkType)
                    {
                        case 0:
                        case 8:
                            {
                                var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
                                name = deviceinof.DeviceEpointName;
                                name =LocalDevice.Current.GetDeviceEpointName(deviceinof);
                                actiondevice.regionNameBtn.Visible = true;
                                Method.RoomNmae(actiondevice.regionNameBtn, deviceinof);
@@ -489,6 +490,20 @@
                                            }
                                        }
                                        break;
                                    case DeviceType.DoorLock:
                                        {
                                            //门锁特殊
                                            icon = "ZigeeLogic/doorlock.png";
                                            if (actions["PassData"].ToString() == "055704010112")
                                            {
                                                state = Language.StringByID(MyInternationalizationString.logicopen);
                                            }
                                            else
                                            {
                                                state = Language.StringByID(MyInternationalizationString.logicclose);
                                            }
                                        }
                                        break;
                                }
@@ -496,7 +511,8 @@
                            }
                            break;
                        case 2:
                            {
                            {
                                actiondevice.edit.Visible = false;//隐藏编辑按钮(场景不需要编辑)
                                //在本地查找该场景;
                                var sceneinof = UserCenter.HdlSceneLogic.Current.GetSceneUIBySceneId(Convert.ToInt32(actions["DeviceAddr"].ToString()));
                                //本地没有存在;
@@ -531,7 +547,11 @@
                            }
                            break;
                    }
                    if (linkType != 2)
                    {
                        actiondevice.stateRow.AddRightView(actiondevice.edit);
                    }
                    actiondevice.stateRow.AddRightView(actiondevice.del);
                    //状态
                    actiondevice.deviceNameBtn.Visible = true;
                    actiondevice.deviceNameBtn.Text = name;
@@ -544,6 +564,7 @@
                        switch (linkType)
                        {
                            case 0:
                            case 8:
                                {
                                    var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
                                    var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
@@ -567,10 +588,11 @@
                        alert.ConfirmClickEvent += () =>
                        {
                            Common.Logic.CurrentLogic.Actions.Remove(actions);
                            var lockLogicCommunalPage = new LockLogicCommunalPage();
                            UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
                            UserView.HomePage.Instance.PageIndex += 1;
                            lockLogicCommunalPage.Show(() => { });
                            actiondevice.selecetdFrameLayout.RemoveFromParent();
                            //var lockLogicCommunalPage = new LockLogicCommunalPage();
                            //UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
                            //UserView.HomePage.Instance.PageIndex += 1;
                            //lockLogicCommunalPage.Show(() => { });
                        };
                    };
@@ -583,7 +605,6 @@
            Method.Push(middle);
            #endregion
            saveBtn.clickviewBtn.MouseUpEventHandler += (sender, e) =>
           {
               var name = logicTextBox.Text.Trim();
@@ -593,12 +614,12 @@
        }
        public  void AddCondition(int value)
        {
            Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
            var addCondition = new AddCondition();
            addCondition.conditionsIndex = value;
            UserView.HomePage.Instance.AddChidren(addCondition);
            UserView.HomePage.Instance.PageIndex += 1;
            addCondition.Show();
        }
    }
}