黄学彪
2020-03-11 06802250b4b9041d39d568c1dbe77684075006b2
ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddAction.cs
@@ -10,199 +10,55 @@
        public AddAction()
        {
            Tag = "LockLogic";
            Tag = "Logic";
        }
        public void Show()
        {
            #region  最上面的布局代码
            var topRowLayout = new RowLayout
            {
                BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
                Height = Application.GetRealHeight(184),
                LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
            };
            this.AddChidren(topRowLayout);
            var titleName = new Button
            {
                TextSize = 17,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextAlignment = TextAlignment.CenterLeft,
                X = Application.GetRealWidth(176),
                Width = Application.GetRealWidth(600),
                Height = Application.GetRealHeight(69),
                Y = Application.GetRealHeight(92),
                TextID = MyInternationalizationString.addaction,
                IsBold = true,
            };
            topRowLayout.AddChidren(titleName);
            var clickBtn = new Button
            {
                Width = Application.GetRealWidth(81 + 51),
                Height = Application.GetRealHeight(58 + 40),
                Y = Application.GetRealHeight(98 - 40),
            };
            topRowLayout.AddChidren(clickBtn);
            clickBtn.MouseDownEventHandler += (sender, e) =>
            {
                RemoveFromParent();
            };
            var back = new Button
            {
                Width = Application.GetRealWidth(30),
                Height = Application.GetRealHeight(51),
                X = Application.GetRealWidth(81),
                Y = Application.GetRealHeight(98),
                //Gravity = Gravity.CenterVertical;
                UnSelectedImagePath = "ZigeeLogic/back.png",
            };
            topRowLayout.AddChidren(back);
            back.MouseDownEventHandler += (sender, e) => {
                RemoveFromParent();
            };
            #region  上面的布局代码
            TopView view = new TopView();
            this.AddChidren(view.TopRowView());
            view.toptitleNameBtn.TextID = MyInternationalizationString.addaction;
            view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); };
            #endregion
            var middle = new FrameLayout
            {
                Y = topRowLayout.Bottom,
                Y =view.topRowLayout.Bottom,
                Height = Application.GetRealHeight(1920 - 184),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
            };
            this.AddChidren(middle);
            #region ----- 设备------    
            var deviceframelayout = new FrameLayout
            FunView deviceview = new FunView();
            deviceview.iconBtn.UnSelectedImagePath = "ZigeeLogic/function.png";
            deviceview.funnameBtn.TextID = MyInternationalizationString.device;
            middle.AddChidren(deviceview.FunFrameView());
            deviceview.clickviewBtn.MouseUpEventHandler += (sender, e) =>
            {
                Height = Application.GetRealHeight(160),
                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
            };
            middle.AddChidren(deviceframelayout);
            var deviceiconBtn = new Button
            {
                Width = Application.GetRealWidth(81),
                Height = Application.GetRealHeight(81),
                X = Application.GetRealWidth(58),
                Y = Application.GetRealHeight(55),
                UnSelectedImagePath = "ZigeeLogic/function.png",
            };
            deviceframelayout.AddChidren(deviceiconBtn);
            var devicerow = new RowLayout
            {
                Y = Application.GetRealHeight(30),
                Width = Application.GetRealWidth(850),
                Height = Application.GetRealHeight(130),
                X = Application.GetRealWidth(176),
                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
            };
            deviceframelayout.AddChidren(devicerow);
            var btndevice = new Button
            {
                TextID = MyInternationalizationString.device,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextSize = 15,
            };
            devicerow.AddChidren(btndevice);
            var btndeviceback = new Button
            {
                Width = Application.GetRealWidth(58),
                Height = Application.GetRealHeight(58),
                X = Application.GetRealWidth(789),
                Gravity = Gravity.CenterVertical,
                UnSelectedImagePath = "ZigeeLogic/next.png",
            };
            devicerow.AddChidren(btndeviceback);
            EventHandler<MouseEventArgs> devicestateclick = (sender, e) =>
            {
                var lockAddDevice = new LockAddDevice();
                UserView.HomePage.Instance.AddChidren(lockAddDevice);
                var roomAndDeviceView = new RoomAndDeviceView();
                UserView.HomePage.Instance.AddChidren(roomAndDeviceView);
                UserView.HomePage.Instance.PageIndex += 1;
                lockAddDevice.Show();
                roomAndDeviceView.IfType = LogicView.IfString.Action_LockAction;
                roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addaction));
            };
            deviceframelayout.MouseUpEventHandler += devicestateclick;
            btndevice.MouseUpEventHandler += devicestateclick;
            btndeviceback.MouseUpEventHandler += devicestateclick;
            deviceiconBtn.MouseUpEventHandler += devicestateclick;
            devicerow.MouseUpEventHandler += devicestateclick;
            #endregion
            #region ----- 场景------
            var sceneframelayout = new FrameLayout
            FunView sceneview = new FunView();
            sceneview.iconBtn.UnSelectedImagePath = "ZigeeLogic/scene.png";
            sceneview.funnameBtn.TextID = MyInternationalizationString.scene;
            sceneview.funFrameLayout.Y = deviceview.funFrameLayout.Bottom;
            middle.AddChidren(sceneview.FunFrameView());
            sceneview.clickviewBtn.MouseUpEventHandler += (sender, e) =>
            {
                Height = Application.GetRealHeight(160),
                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                Y = deviceframelayout.Bottom,
            };
            middle.AddChidren(sceneframelayout);
            var sceneiconBtn = new Button
            {
                Width = Application.GetRealWidth(81),
                Height = Application.GetRealHeight(81),
                X = Application.GetRealWidth(58),
                Y = Application.GetRealHeight(55),
                UnSelectedImagePath = "ZigeeLogic/scene.png",
            };
            sceneframelayout.AddChidren(sceneiconBtn);
            var sceneRowLayout = new RowLayout
            {
                Y = Application.GetRealHeight(30),
                Width = Application.GetRealWidth(850),
                Height = Application.GetRealHeight(130),
                X = Application.GetRealWidth(176),
                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
            };
            sceneframelayout.AddChidren(sceneRowLayout);
            var scene = new Button
            {
                TextID = MyInternationalizationString.scene,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextSize = 15,
            };
            sceneRowLayout.AddChidren(scene);
            var btnsceneback = new Button
            {
                Width = Application.GetRealWidth(58),
                Height = Application.GetRealHeight(58),
                X = Application.GetRealWidth(789),
                Gravity = Gravity.CenterVertical,
                UnSelectedImagePath = "ZigeeLogic/next.png",
            };
            sceneRowLayout.AddChidren(btnsceneback);
            EventHandler<MouseEventArgs> sceneclick = (sender, e) =>
            {
                var lockAddScene = new LockAddScene();
                UserView.HomePage.Instance.AddChidren(lockAddScene);
                var addScenePage = new AddScenePage();
                UserView.HomePage.Instance.AddChidren(addScenePage);
                UserView.HomePage.Instance.PageIndex += 1;
                lockAddScene.Show();
                addScenePage.Show(LogicView.IfString.Action_LockScene);
            };
            sceneRowLayout.MouseUpEventHandler += sceneclick;
            scene.MouseUpEventHandler += sceneclick;
            btnsceneback.MouseUpEventHandler += sceneclick;
            sceneframelayout.MouseUpEventHandler += sceneclick;
            sceneiconBtn.MouseUpEventHandler += sceneclick;
            #endregion
        }