黄学彪
2019-12-09 163777d8a2cb7cfa469f54a7042528870ebc10a3
ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs
@@ -17,10 +17,6 @@
        /// </summary>
        private Common.Room lookRoom = null;
        /// <summary>
        /// 当前选择的分支,1:场景  2:功能
        /// </summary>
        private int nowSelectIndex = 1;
        /// <summary>
        /// 桌布控件
        /// </summary>
        private FrameLayout frameTable = null;
@@ -52,17 +48,14 @@
            //清空bodyFrame
            this.ClearBodyFrame();
            //初始化分支控件
            this.InitSwitchControl();
            //初始化桌布控件
            this.frameTable = new FrameLayout();
            frameTable.Y = Application.GetRealHeight(187);
            frameTable.Height = bodyFrameLayout.Height - Application.GetRealHeight(187);
            bodyFrameLayout.AddChidren(frameTable);
            //显示场景列表
            this.ShowSceneList();
            //初始化分支控件
            this.InitSwitchControl();
        }
        /// <summary>
@@ -70,93 +63,23 @@
        /// </summary>
        private void InitSwitchControl()
        {
            var btnTemp = new NormalViewControl(10, 10, false);
            btnTemp.TextID = R.MyInternationalizationString.uScence;
            //场景框(点击范围有点小,需要扩大它的点击范围)
            var frameScene = new FrameLayoutControl();
            frameScene.UseClickStatu = false;
            frameScene.Height = Application.GetRealHeight(90);
            frameScene.Width = btnTemp.GetRealWidthByText(16);
            frameScene.X = ControlCommonResourse.XXLeft;
            frameScene.Y = Application.GetRealHeight(40);
            bodyFrameLayout.AddChidren(frameScene);
            //场景
            var btnScene = new NormalViewControl(frameScene.Width, Application.GetRealHeight(63), false);
            btnScene.Text = btnTemp.Text;
            btnScene.TextSize = 16;
            btnScene.TextColor = UserCenterColor.Current.TextColor2;
            frameScene.AddChidren(btnScene, ChidrenBindMode.BindEventOnly);
            //底线
            var btnSceneLine = new NormalViewControl(40, 10, true);
            btnSceneLine.Y = btnScene.Bottom + Application.GetRealHeight(14);
            btnSceneLine.X = btnScene.X + btnScene.Width / 2 - Application.GetRealWidth(40) / 2;
            btnSceneLine.Radius = (uint)Application.GetRealHeight(10) / 2;
            btnSceneLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
            frameScene.AddChidren(btnSceneLine, ChidrenBindMode.BindEventOnly);
            btnTemp.TextID = R.MyInternationalizationString.uFunction;
            //功能框(点击范围有点小,需要扩大它的点击范围)
            var frameFunc = new FrameLayoutControl();
            frameFunc.UseClickStatu = false;
            frameFunc.Height = Application.GetRealHeight(90);
            frameFunc.Width = btnTemp.GetRealWidthByText(16);
            frameFunc.X = frameScene.Right + Application.GetRealWidth(58);
            frameFunc.Y = Application.GetRealHeight(40);
            bodyFrameLayout.AddChidren(frameFunc);
            //功能
            var btnFunc = new NormalViewControl(frameFunc.Width, Application.GetRealHeight(63), false);
            btnFunc.Text = btnTemp.Text;
            btnFunc.TextColor = UserCenterColor.Current.TextGrayColor3;
            frameFunc.AddChidren(btnFunc, ChidrenBindMode.BindEventOnly);
            //底线
            var btnFuncLine = new NormalViewControl(40, 10, true);
            btnFuncLine.Y = btnFunc.Bottom + Application.GetRealHeight(14);
            btnFuncLine.X = btnFunc.X + btnFunc.Width / 2 - Application.GetRealWidth(40) / 2;
            btnFuncLine.Radius = (uint)Application.GetRealHeight(10) / 2;
            btnFuncLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
            frameFunc.AddChidren(btnFuncLine, ChidrenBindMode.BindEventOnly);
            btnFuncLine.Visible = false;
            frameScene.ButtonClickEvent += (sender, e) =>
            var tabControl = new SceneFunctionSwitchControl();
            tabControl.Y = Application.GetRealHeight(40);
            bodyFrameLayout.AddChidren(tabControl);
            tabControl.SelectTabEvent += (tabIndex) =>
            {
                //场景分支选择
                if (this.nowSelectIndex == 1)
                if (tabIndex == 1)
                {
                    return;
                    //显示场景列表
                    this.ShowSceneList();
                }
                this.nowSelectIndex = 1;
                btnScene.TextSize = 16;
                btnScene.TextColor = UserCenterColor.Current.TextColor2;
                btnFunc.TextSize = 14;
                btnFunc.TextColor = UserCenterColor.Current.TextGrayColor3;
                btnSceneLine.Visible = true;
                btnFuncLine.Visible = false;
                //显示场景列表
                this.ShowSceneList();
            };
            frameFunc.ButtonClickEvent += (sender, e) =>
            {
                //功能分支选择
                if (this.nowSelectIndex == 2)
                else
                {
                    return;
                    //显示功能列表
                    this.ShowFunctionList();
                }
                this.nowSelectIndex = 2;
                btnScene.TextSize = 14;
                btnScene.TextColor = UserCenterColor.Current.TextGrayColor3;
                btnFunc.TextSize = 16;
                btnFunc.TextColor = UserCenterColor.Current.TextColor2;
                btnFuncLine.Visible = true;
                btnSceneLine.Visible = false;
                //显示功能列表
                this.ShowFunctionList();
            };
            tabControl.InitControl();
        }
        #endregion
@@ -195,14 +118,14 @@
                    btnPic.Width = Application.GetRealWidth(844);
                    btnPic.Height = Application.GetRealHeight(420);
                    btnPic.ImagePath = data.IconPath;
                    btnPic.Radius = 8;
                    btnPic.Radius = (uint)Application.GetRealHeight(17);
                    frameContr.AddChidren(btnPic);
                    var btnName = new NormalViewControl(251, 282, true);
                    btnName.X = ControlCommonResourse.XXLeft;
                    btnName.Y = Application.GetRealHeight(58);
                    btnName.BackgroundColor = 0xff333333;
                    btnName.Radius = 8;
                    btnName.RadiusEx = 17;
                    btnName.Text = data.Name;
                    btnName.TextSize = 15;
                    btnName.TextColor = UserCenterColor.Current.White;
@@ -240,7 +163,7 @@
                frameBack.BackgroundColor = UserCenterColor.Current.White;
                frameBack.Width = bodyFrameLayout.Width;
                frameBack.Height = Application.GetRealHeight(1650);
                frameBack.Radius = 20;
                frameBack.Radius = (uint)Application.GetRealHeight(58);
                frameTable.AddChidren(frameBack);
                var listView = new VerticalListControl(23);
@@ -392,9 +315,10 @@
        {
            HdlThreadLogic.Current.RunThread(() =>
            {
                var listCheck = new HashSet<string>();
                for (int i = 0; i < listGwId.Count; i++)
                {
                    if (listView == null)
                    if (listView.Parent == null)
                    {
                        return;
                    }
@@ -403,14 +327,12 @@
                    var result = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, (device) =>
                     {
                         string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
                         if (listView.Parent == null)
                         if (listView.Parent == null || dicData.ContainsKey(mainkeys) == false || listCheck.Contains(mainkeys) == true)
                         {
                             return;
                         }
                         if (listView == null || dicData.ContainsKey(mainkeys) == false)
                         {
                             return;
                         }
                         listCheck.Add(mainkeys);
                         var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
                         if (localDevice != null && localDevice.IsOnline != device.IsOnline)
                         {