HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2019-10-28 8b4d79ca03495e522a1953e04ca17527f33c853a
ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
@@ -17,11 +17,6 @@
        /// <param name="common">Common.</param>
        public void Changed(CommonDevice common)
        {
            //if (common.Type != ZigBee.Device.DeviceType.OnOffSwitch)
            //{
            //    return;
            //}
            Shared.Application.RunOnMainThread(() =>
            {
                //var dev = common as Panel;
@@ -57,37 +52,44 @@
            {
                RemoveFromParent();
            };
            this.btnTitle.Width = Application.GetRealWidth(1080 - 161 - 200 - 58);
            this.btnBack.MouseUpEventHandler += eHandlerBack;
            this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack;
            this.MidFrameLayout(this);
            var btnAddFrameLayout = new FrameLayout
            {
                X = Application.GetRealWidth(953),
                Height = Application.GetRealHeight(72),
                Width = Application.GetRealWidth(72),
                X = Application.GetRealWidth(830),
                Width = Application.GetRealWidth(0),//200
                BackgroundColor = 0xff00ff00,
            };
            this.titleFrameLayout.AddChidren(btnAddFrameLayout);
            var btnFloorText = new Button
            {
                Height = Application.GetRealHeight(84),
                Width = Application.GetRealWidth(58),
                X = Application.GetRealWidth(881),
                Text = "一楼",
                Width = Application.GetRealWidth(110),
                X = Application.GetRealWidth(15),
                Text = Language.StringByID(R.MyInternationalizationString.FirstFloor),
                TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                TextSize = 15,
                TextAlignment = TextAlignment.CenterRight,
                BackgroundColor = 0xffff0000,
            };
            btnAddFrameLayout.AddChidren(btnFloorText);
            var btnBindDown = new Button
            {
                Height = Application.GetRealHeight(72),
                Width = Application.GetRealWidth(72),
                //UnSelectedImagePath = "BindPic/BindDown.png",
                Height = Application.GetRealHeight(69),
                Width = Application.GetRealWidth(69),
                X = Application.GetRealWidth(200 - 69),
                UnSelectedImagePath = "BindPic/BindDown.png",
                Gravity = Gravity.CenterVertical,
                BackgroundColor = 0xff0000ff,
            };
            btnAddFrameLayout.AddChidren(btnBindDown);
            btnBindDown.MouseDownEventHandler += (sender, e) =>
            {
                SideslipFramelayout();
            };
            MidFrameLayoutContent();
        }
@@ -105,14 +107,6 @@
            {
            };
            btnMidTopLayout.AddChidren(btnHorizontalScrolViewLayout);
            //var btnLine = new Button
            //{
            //    Y = btnMidTopLayout.Bottom,
            //    Height = 1,
            //    BackgroundColor = Shared.Common.ZigbeeColor.Current.XMTitleLine,
            //};
            //this.midFrameLayout.AddChidren(btnLine);
            midVerticalScrolViewLayout = new VerticalScrolViewLayout()
            {
@@ -320,11 +314,7 @@
            #endregion 
        }
        /// <summary>
        /// 按键绑定场景表显示
        /// </summary>
        /// <param name="gateway">Gateway.</param>
        /// <param name="key">Key.</param>
        // 按键绑定场景表显示
        void RefreshRoomList(Shared.Common.Room curRoom, Button btnFinish, ref int index2)
        {
            Button curentOldRoom = null;
@@ -333,6 +323,11 @@
            for (int i = 0; i < roomList.Count; i++)
            {
                var room = roomList[i];
                if (room.IsLove == true)
                {
                    //;
                }
                var btnRoomFrameLayout = new FrameLayout
                {
                    Height = Application.GetRealHeight(78),
@@ -355,6 +350,8 @@
                    TextSize = 12,
                    TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                    Gravity = Gravity.Center,
                    //SelectedImagePath = "BindPic/BindRoomColorOn.png",
                    //UnSelectedImagePath = "BindPic/BindRoomColor.png",
                };
                btnRoomFrameLayout.AddChidren(btnRoom);
@@ -373,6 +370,7 @@
                    else
                    {
                        btnRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3;
                        btnRoom.IsSelected = false;
                        btnRoomFrameLayout.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMMidFrameLayout;
                        btnRoomFrameLayout.BorderWidth = 1;
                    }
@@ -462,11 +460,7 @@
            }
        }
        /// <summary>
        /// 按键绑定场景表显示
        /// </summary>
        /// <param name="gateway">Gateway.</param>
        /// <param name="key">Key.</param>
        //按键绑定场景表显示
        void RefreshSceneList(Shared.Common.Room curRoom)
        {
            midVerticalScrolViewLayout.RemoveAll();
@@ -591,6 +585,111 @@
            }
        }
        // 侧边导航栏
        void SideslipFramelayout()
        {
            var dialog = new Dialog
            {
            };
            dialog.Show();
            var flMain = new FrameLayout { BackgroundColor = 0x00000000 };
            dialog.AddChidren(flMain);
            flMain.MouseUpEventHandler += (sender11, e11) =>
            {
                dialog.Close();
            };
            var sidelipFrameLayout = new FrameLayout()
            {
                Height = Application.GetRealHeight(783),
                Width = Application.GetRealWidth(449),
                Y = Application.GetRealHeight(161),
                X = Application.GetRealWidth(596),
                BackgroundImagePath = "DoorLock/SideslipPic.png",
            };
            flMain.AddChidren(sidelipFrameLayout);
            var btnSelectFloor = new Button()
            {
                Width = Application.GetRealWidth(200),
                Height = Application.GetRealHeight(58),
                X = Application.GetRealWidth(81),
                Y = Application.GetRealHeight(58),
                TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                TextSize = 14,
                TextAlignment = TextAlignment.CenterLeft,
                TextID = R.MyInternationalizationString.SelectFloor,
            };
            sidelipFrameLayout.AddChidren(btnSelectFloor);
            var sidelipVerticalScrolViewLayout = new VerticalScrolViewLayout()
            {
                Height = Application.GetRealHeight(600),
                Y = Application.GetRealHeight(173),
            };
            sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout);
            //获取楼层
            var dicFloor = Common.Room.CurrentRoom.GetFloorSortList();
            Button oldbutton = null;
            Button oldbuttonText = null;
            foreach (var floorId in dicFloor.Keys)
            {
                var rowFrameLayout = new RowLayout()
                {
                    Height = Application.GetRealHeight(150),
                };
                sidelipVerticalScrolViewLayout.AddChidren(rowFrameLayout);
                var btnAllMethod = new Button()
                {
                    Width = Application.GetRealWidth(81),
                    Height = Application.GetRealHeight(81),
                    X = Application.GetRealWidth(81),
                    Y = Application.GetRealHeight(55),
                };
                rowFrameLayout.AddChidren(btnAllMethod);
                var btnMethodText = new Button()
                {
                    Width = Application.GetRealWidth(311),
                    Height = Application.GetRealHeight(58),
                    X = Application.GetRealWidth(173),
                    Y = Application.GetRealHeight(69),
                    TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                    TextSize = 14,
                    TextAlignment = TextAlignment.CenterLeft,
                    Text = dicFloor[floorId],
                };
                rowFrameLayout.AddChidren(btnMethodText);
                EventHandler<MouseEventArgs> hander = (sender, e) =>
                {
                    if (!btnMethodText.IsSelected)
                    {
                        if (oldbutton != null)
                        {
                            oldbutton.IsSelected = false;
                        }
                        if (oldbuttonText != null)
                        {
                            oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3;
                        }
                        oldbutton = btnMethodText;
                        oldbuttonText = btnMethodText;
                        btnMethodText.IsSelected = true;
                        oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                    }
                    dialog.Close();
                };
                btnAllMethod.MouseUpEventHandler += hander;
                rowFrameLayout.MouseUpEventHandler += hander;
                btnMethodText.MouseUpEventHandler += hander;
            }
        }
        public void DeviceInfoChange(CommonDevice common, string typeTag)
        {
        }