lss
2020-06-03 1c2b6fa69a7002315d4b3ecb883c255c65eceafa
ZigbeeApp/Shared/Phone/UserCenter/SmartSound/Forms/SmartSoundContentForDevice.cs
@@ -11,10 +11,9 @@
        private SmartSound.Room CurrentRoom = null;
        private FrameLayout ContentLayout = null;
        private BottomClickButton bottomClickButton = null;
        private VerticalListControl listView = null;
        /// <summary>
        /// 没有数据的时候,提示用
        /// </summary>
@@ -43,7 +42,7 @@
        {
            //设置标题信息
            base.SetTitleText("设备选择");
            base.SetTitleText(CurrentRoom.RoomName);
            //初始化中部控件
            this.InitMiddleFrame();
@@ -58,7 +57,6 @@
            switchContr.Gravity = Gravity.CenterVertical;
            switchContr.Width = Application.GetRealWidth(650);
            switchContr.Y = Application.GetRealHeight(40);
            
            ContentLayout = new FrameLayout();
            this.bodyFrameLayout.AddChidren(ContentLayout);
@@ -70,7 +68,7 @@
            listTitle.Add(Language.StringByID(R.MyInternationalizationString.uFunction));
            //设置初始值
            switchContr.SetDefultIndex(1);
            switchContr.SetDefultIndex(0);
           
            //选择事件
            switchContr.SelectTabEvent += (selectIndex) =>
@@ -83,11 +81,21 @@
                else
                {
                    LoadFunction();
                }
                }
            };
            //开始初始化
            switchContr.InitControl(listTitle);
            switchContr.InitControl(listTitle);
            //添加确认按钮
            BottomClickButton bottomClickButton = new BottomClickButton();
            this.bodyFrameLayout.AddChidren(bottomClickButton);
            bottomClickButton.Text = "确认";
            bottomClickButton.ButtonClickEvent += (sender, e) =>
            {
                //保存数据
                base.CloseForm();
            };
        }
        /// <summary>
@@ -107,7 +115,7 @@
                listView = new VerticalListControl();
                ContentLayout.AddChidren(listView);
                listView.Y = Application.GetRealHeight(90);
                listView.Y = Application.GetRealHeight(40);
                listView.RemoveAll();
                for (int i = 0; i < CurrentRoom.SceneList.Count; i++)
@@ -117,16 +125,6 @@
                    listView.AddChidren(roomRowLayout);
                    roomRowLayout.InitControl();
                }
                bottomClickButton = new BottomClickButton();
                ContentLayout.AddChidren(bottomClickButton);
                bottomClickButton.Text = "确认";
                bottomClickButton.ButtonClickEvent += (sender, e) =>
                {
                    this.CloseForm();
                };
                bottomClickButton.Visible = false;
                if (listView.ChildrenCount == 0)
                {
@@ -168,6 +166,8 @@
                ContentLayout.AddChidren(listView);
                listView.Y= tab_layout.Height;
                listView.Height=ContentLayout.Height- tab_layout.Height;
                Buttons.Clear();
@@ -228,7 +228,7 @@
                            for (int i = 0; i < CurrentRoom.DeviceList.Count; i++)
                            {
                                SmartSound.Device device = CurrentRoom.DeviceList[i];
                                //灯光
                                //
                                if (device.DeviceType == 4 || device.DeviceType == 5 || device.DeviceType == 6)
                                {
                                    var deviceRowLayout = new DeviceRowLayout(this, device);
@@ -283,7 +283,6 @@
            };
            layout.AddChidren(noFunctionTip);
        }
        //为了方便更新状态,存起来
        private List<Button> Buttons = new List<Button>();
@@ -312,12 +311,7 @@
            {
                string error = e.Message;
            }
        }
        //frameBack.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png";
        //frameBack.BackgroundImagePath = "Item/RoomIconBackground.png";
        }
        #region ■ 自定义场景选择控件_____________________
@@ -327,6 +321,7 @@
        private class SceneRowLayout : FrameRowControl
        {
            private SmartSoundContentForDevice smartSoundControlForDevice = null;
            private SmartSound.Scene scene = null;
            /// <summary>
            /// 房间名称
@@ -390,22 +385,6 @@
                        Right_icon.SelectedImagePath = "SmartSound/CheckBoxDef.png";
                        Right_icon.UnSelectedImagePath = "SmartSound/CheckBoxDef.png";
                    }
                    bool isShow = false;
                    if (smartSoundControlForDevice == null) return;
                    for (int i = 0; i < smartSoundControlForDevice.CurrentRoom.SceneList.Count; i++)
                    {
                        SmartSound.Scene _scene = smartSoundControlForDevice.CurrentRoom.SceneList[i];
                        if (_scene.Checked)
                        {
                            isShow = true;
                            break;
                        }
                    }
                    smartSoundControlForDevice.bottomClickButton.Visible = isShow;
                }
                catch (Exception e)
                {
@@ -424,6 +403,7 @@
        private class DeviceRowLayout : FrameRowControl
        {
            private SmartSoundContentForDevice smartSoundControlForDevice = null;
            private SmartSound.Device device = null;
            /// <summary>
            /// 房间名称
@@ -486,30 +466,13 @@
                    {
                        Right_icon.SelectedImagePath = "SmartSound/CheckBoxDef.png";
                        Right_icon.UnSelectedImagePath = "SmartSound/CheckBoxDef.png";
                    }
                    bool isShow = false;
                    if (smartSoundControlForDevice == null) return;
                    for (int i = 0; i < smartSoundControlForDevice.CurrentRoom.SceneList.Count; i++)
                    {
                        SmartSound.Scene _scene = smartSoundControlForDevice.CurrentRoom.SceneList[i];
                        if (_scene.Checked)
                        {
                            isShow = true;
                            break;
                        }
                    }
                    smartSoundControlForDevice.bottomClickButton.Visible = isShow;
                    }
                }
                catch (Exception e)
                {
                    string error = e.Message;
                }
            }
        }
        #endregion
    }