wxr
2020-12-19 792ca2a402feb952ef890d653f2e049c1230baf1
HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs
old mode 100644 new mode 100755
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using HDL_ON.DriverLayer;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
@@ -20,6 +21,10 @@
        /// 场景内容显示区域
        /// </summary>
        FrameLayout floorChangeView;
        /// <summary>
        /// 楼层房间选择的下拉对象
        /// </summary>
        FloorRoomSelectPopupView floorRoomSelectView = null;
        Button btnSceneTilte;
        #region 场景底部切换显示区域
@@ -69,7 +74,10 @@
            };
            bodyView.AddChidren(topView);
            if (DB_ResidenceData.residenceData.GatewayType == 0)
            //不是A网关或者是成员 只允许添加场景隐藏自动化
            var HideAutoPage = DB_ResidenceData.Instance.GatewayType != 1 || DB_ResidenceData.Instance.CurrentRegion.IsOthreShare;
            //判断是否需要隐藏自动化
            if (HideAutoPage)
            {
                btnSceneTilte = new Button()
                {
@@ -85,7 +93,6 @@
                };
                topView.AddChidren(btnSceneTilte);
                btnAutomationTitle = new Button();
            }
            else
            {
@@ -147,7 +154,11 @@
            bodyView.AddChidren(contentPageView);
            LoadScenePageView();
            LoadAutomationPageView();
            //判断是否需要隐藏自动化
            if (!HideAutoPage)
            {
                LoadAutomationPageView();
            }
            LoadEventList();
        }
@@ -200,25 +211,42 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextAlignment = TextAlignment.CenterLeft,
                Text = DB_ResidenceData.residenceData.CurFoor,
                Text = DB_ResidenceData.Instance.CurFloor.roomName,
            };
            floorChangeView.AddChidren(btnFloor);
            floorChangeView.AddChidren(btnFloor);
            string nowSelectId = null;
            btnFloor.MouseUpEventHandler += (sender, e) =>
            {
                if (this.floorRoomSelectView == null)
                {
                    //先初始化
                    this.floorRoomSelectView = new FloorRoomSelectPopupView();
                }
                //显示下拉列表
                this.floorRoomSelectView.ShowSceneView(btnFloor, (selectId, listScene) =>
                {
                    nowSelectId = selectId;
                    //重新刷新场景列表
                    this.LoadSceneFunctionControlZone(listScene);
                }, nowSelectId);
            };
            #endregion
            sceneFunctionView = new VerticalScrolViewLayout()
            {
                Y = floorChangeView.Bottom,
                Height = Application.GetRealHeight(667 - 64 - 49 - 52 + 30),
            };
            scenePageView.AddChidren(sceneFunctionView);
            LoadSceneFunctionControlZone();
            LoadSceneFunctionControlZone(null);
        }
        /// <summary>
        /// 加载场景功能显示区域
        /// </summary>
        void LoadSceneFunctionControlZone()
        void LoadSceneFunctionControlZone(List<Scene> listScene)
        {
            //topView.AddChidren(btnAddIcon);
@@ -227,7 +255,18 @@
            try
            {
                int index = 0;
                foreach (var scene in FunctionList.List.scenes)
                //获取能够显示的场景
                if (listScene == null)
                {
                    //初始值
                    if (this.floorRoomSelectView == null)
                    {
                        //先初始化
                        this.floorRoomSelectView = new FloorRoomSelectPopupView();
                    }
                    listScene = this.floorRoomSelectView.GetCanShowListScene();
                }
                foreach (var scene in listScene)
                {
                    //if (scene.roomIds.Count == 0)//如何在房间已经移除了这个功能,则收藏界面也不会再显示
                    //{
@@ -361,26 +400,30 @@
                    SelectedImagePath = "Collection/CollectionIcon.png",
                    IsSelected = scene.collect,
                };
                view.AddChidren(btnCollection);
                //view.AddChidren(btnCollection);
                //2020-12-16 如果是成员隐藏收藏功能
                if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare)
                {
                    view.AddChidren(btnCollection);
                }
                btnCollection.MouseUpEventHandler = (sender, e) => {
                    scene.collect = btnCollection.IsSelected = !btnCollection.IsSelected;
                    scene.SaveSceneData(true);
                    scene.CollectScene();
                };
                LoadEvent_ControlScene(btnCoverd,btnName,btnZone, scene);
                btnSettingIcon.MouseUpEventHandler = (sender, e) => {
                    Action backAction = () => {
                        LoadSceneFunctionControlZone();
                        LoadSceneFunctionControlZone(null);
                    };
                    Action refreshAction = () => {
                        btnName.Text = scene.name;
                        btnZone.Text = scene.GetRoomListName();
                        //view.BackgroundImagePath = scene.ImagePath;
                        //2020-12-03 修改图片加载方法
                        ImageUtlis.Current.LoadLocalOrNetworkImages((scene as Scene).ImagePath, view);
                    };
                    var aep = new SceneEditPage(scene, backAction);
                    MainPage.BasePageView.AddChidren(aep);
                    aep.LoadPage(StringId.EditScene, refreshAction);
                    aep.LoadPage(refreshAction);
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
            }
@@ -402,7 +445,7 @@
            contentPageView.AddChidren(automationPage);
            UI2.Intelligence.Automation.MainView.automationPage = automationPage;
            UI2.Intelligence.Automation.MainView.MainShow();
        }
        }
        #endregion
    }
@@ -481,9 +524,21 @@
            {
                if (!btnAutomationTitle.IsSelected)
                {
                    //如果是成员
                    if (DB_ResidenceData.Instance.CurrentRegion.IsOthreShare)
                    {
                        //如果没有场景权限
                        if (!DB_ResidenceData.Instance.CurrentRegion.isAllowCreateScene)
                        {
                            //提示没有场景的创建权限
                            Utlis.ShowTip(Language.StringByID(StringId.PermissionDenied));
                            return;
                        }
                    }
                    Action action = () =>
                    {
                        LoadSceneFunctionControlZone();
                        LoadSceneFunctionControlZone(null);
                    };
                    var aep = new NewSceneMenuListPage(action);
                    MainPage.BasePageView.AddChidren(aep);