xm
2020-07-21 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d
ZigbeeApp/Shared/Phone/MainPage/UnallocatedRoomForm.cs
@@ -16,13 +16,17 @@
        #region ■ 变量声明___________________________
        /// <summary>
        /// 界面关闭事件
        /// </summary>
        public Action FormCloseEvent = null;
        /// <summary>
        /// 添加到 的背景图控件
        /// </summary>
        private FrameLayoutControl frameAddBackGroud = null;
        private FrameLayoutStatuControl frameAddBackGroud = null;
        /// <summary>
        /// 功能的桌布控件
        /// </summary>
        private FrameLayout DeviceBodyTableControl = null;
        private NormalFrameLayout DeviceBodyTableControl = null;
        /// <summary>
        /// 场景的列表控件
        /// </summary>
@@ -34,7 +38,7 @@
        /// <summary>
        /// 场景的桌布控件
        /// </summary>
        private FrameLayout SceneBodyTableControl = null;
        private NormalFrameLayout SceneBodyTableControl = null;
        /// <summary>
        /// 全选控件
        /// </summary>
@@ -98,12 +102,12 @@
            bodyFrameLayout.AddChidren(tabControl);
            //初始化场景桌布
            this.SceneBodyTableControl = new FrameLayout();
            this.SceneBodyTableControl = new NormalFrameLayout();
            SceneBodyTableControl.Y = tabControl.Bottom;
            SceneBodyTableControl.Height = bodyFrameLayout.Height - tabControl.Bottom;
            bodyFrameLayout.AddChidren(SceneBodyTableControl);
            //初始化设备桌布
            this.DeviceBodyTableControl = new FrameLayout();
            this.DeviceBodyTableControl = new NormalFrameLayout();
            DeviceBodyTableControl.Y = tabControl.Bottom;
            DeviceBodyTableControl.Height = bodyFrameLayout.Height - tabControl.Bottom;
            bodyFrameLayout.AddChidren(DeviceBodyTableControl);
@@ -176,13 +180,13 @@
                SceneBodyTableControl.AddChidren(listSceneView);
                var listScene = HdlSceneLogic.Current.GetUnalloctedScenes();
                if (listScene == null || listScene.Count == 0) { return; }
                if (listScene.Count == 0) { return; }
                foreach (var data in listScene)
                {
                    //场景图片
                    var frameContr = new ScenePictrueControl();
                    listSceneView.AddChidrenFrame(frameContr);
                    listSceneView.AddChidren(frameContr);
                    frameContr.InitControl(data);
                    //添加选择控件
@@ -193,7 +197,7 @@
                    frameContr.CollectEvent += (collect) =>
                    {
                        //如果当前是收藏房间,则需要刷新主页
                        if (HdlRoomLogic.Current.CurrentRoom.IsLove == true)
                        if (HdlRoomLogic.Current.NowMainPageRoom.IsLove == true)
                        {
                            this.dataHadChanged = true;
                        }
@@ -218,7 +222,7 @@
                //促使它超过时,能够往上滑
                var frameTemp = new FrameLayout();
                frameTemp.Height = Application.GetRealHeight(202 + 23);
                listSceneView.AddChidrenFrame(frameTemp);
                listSceneView.AddChidren(frameTemp);
            });
        }
@@ -510,7 +514,7 @@
        private void InitAddToControl()
        {
            //添加到 的背景图控件
            this.frameAddBackGroud = new FrameLayoutControl();
            this.frameAddBackGroud = new FrameLayoutStatuControl();
            frameAddBackGroud.UseClickStatu = false;
            frameAddBackGroud.Height = Application.GetRealHeight(202);
            frameAddBackGroud.Gravity = Gravity.BottomCenter;
@@ -527,22 +531,27 @@
            btnAdd.TextID = R.MyInternationalizationString.AddTo;
            btnAdd.TextSize = 17;
            btnAdd.Radius = (uint)Application.GetRealHeight(35);
            frameAddBackGroud.AddChidren(btnAdd, ChidrenBindMode.BindEventOnly);
            frameAddBackGroud.AddChidren(btnAdd, ChidrenBindMode.BindEvent);
            frameAddBackGroud.ButtonClickEvent += (sender, e) =>
            {
                var selectZone = new SelectZone();
                selectZone.title = Language.StringByID(R.MyInternationalizationString.AddTo);
                selectZone.Init();
                selectZone.ZoneAction += (selectRoom) =>
                HdlControlLogic.Current.ShowBottomListRoomView(string.Empty, Language.StringByID(R.MyInternationalizationString.AddTo), (selectId, selectName) =>
                {
                    if (selectId == string.Empty)
                    {
                        //选择的是未分配
                        return;
                    }
                    //变更了当前房间的东西,主页需要刷新
                    if (HdlRoomLogic.Current.CurrentRoom.Id == selectRoom.Id)
                    if (HdlRoomLogic.Current.NowMainPageRoom.Id == selectId)
                    {
                        this.dataHadChanged = true;
                    }
                    //保存选择的设备和场景
                    this.SaveSelectDeviceAndScene(selectRoom);
                };
                    var room = HdlRoomLogic.Current.GetRoomById(selectId);
                    this.SaveSelectDeviceAndScene(room);
                    //分类界面需要刷新
                    UserPage.Instance.RefreshCategoryForm = true;
                });
            };
        }
@@ -635,7 +644,7 @@
                    string path1 = string.Empty;
                    string path2 = string.Empty;
                    //获取图片
                    Common.LocalDevice.Current.GetDeviceObjectIcon(typeInfo.ConcreteType, ref path1, ref path2);
                    Common.LocalDevice.Current.GetDeviceFunctionTypeMenuIcon(typeInfo.ConcreteType, ref path1, ref path2);
                    dic[typeInfo.BeloneTextId].IconPath = path1;
                    dic[typeInfo.BeloneTextId].IconPathSelected = path2;
                    dic[typeInfo.BeloneTextId].TextId = typeInfo.BeloneTextId;
@@ -654,12 +663,16 @@
        /// </summary>
        public override void CloseFormBefore()
        {
            //调用回调事件
            this.FormCloseEvent?.Invoke();
            this.FormCloseEvent = null;
            if (this.dataHadChanged == true)
            {
                HdlThreadLogic.Current.RunMainInThread(() =>
                {
                    //刷新主页
                    this.LoadFormMethodByName("HomeMainPageForm", "RefreshBodyView");
                    HomeMainPageForm.Instance?.RefreshBodyView();
                });
            }
            base.CloseFormBefore();