wjc
2023-07-26 9508510f0b27da3278fa1161eb2ba3dd1e3e2030
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
@@ -98,6 +98,7 @@
        public void LoadPage(Action backRefresh)
        {
             //DB_ResidenceData.Instance.sceneChooseRoomId
            new TopViewDiv(bodyView, Language.StringByID(StringId.EditScene)).LoadTopView(backRefresh);
            initPage();
        }
@@ -233,6 +234,51 @@
                Height = Application.GetRealHeight(8),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
            #endregion
            #region 组号
            //var grounpView = new FrameLayout()
            //{
            //    Height = Application.GetRealWidth(50),
            //};
            //contentView.AddChidren(grounpView);
            //Button btnGroupTitle = new Button()
            //{
            //    X = Application.GetRealWidth(16),
            //    //Width = Application.GetRealWidth(90),
            //    TextAlignment = TextAlignment.CenterLeft,
            //    TextColor = CSS_Color.FirstLevelTitleColor,
            //    TextSize = CSS_FontSize.TextFontSize,
            //    Text = "组号"
            //};
            //grounpView.AddChidren(btnGroupTitle);
            //var etGroup = new EditText()
            //{
            //    TextAlignment = TextAlignment.CenterRight,
            //    Width = Application.GetRealWidth(350),
            //    Text = scene.group,
            //    TextColor = CSS_Color.PromptingColor1,
            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            //    IsNumberKeyboardType = true
            //};
            //grounpView.AddChidren(etGroup);
            //etGroup.TextChangeEventHandler = (sender, e) => {
            //    scene.group = e;
            //};
            //Button btnGroupLine = new Button()
            //{
            //    Y = Application.GetRealWidth(49),
            //    Gravity = Gravity.CenterHorizontal,
            //    Height = Application.GetRealHeight(1),
            //    Width = Application.GetRealWidth(343),
            //    BackgroundColor = CSS_Color.DividingLineColor,
            //};
            //grounpView.AddChidren(btnGroupLine);
            #endregion
            #region 场景延时row
@@ -387,14 +433,22 @@
                    var pack = pm.GetSceneInfo(scene.userSceneId);
                    if (pack.Code == StateCode.SUCCESS)
                    {
                        var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString());
                        var tempScene = sceneList.Find((obj) => obj.userSceneId == scene.userSceneId);
                        if (tempScene != null)
                        if (pack.Data != null)
                        {
                            scene.functions = tempScene.functions;
                            var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString());
                            var tempScene = sceneList.Find((obj) => obj.userSceneId == scene.userSceneId);
                            if (tempScene != null)
                            {
                                scene.name = tempScene.name;
                                scene.delay = tempScene.delay;
                                scene.roomIds = tempScene.roomIds;
                                scene.functions = tempScene.functions;
                            }
                        }
                        Application.RunOnMainThread(() =>
                        {
                            btnSceneName.Text = scene.name;
                            //etGroup.Text = scene.group;
                            LoadFunctionRow();
                            waitPage.Hide();
                            waitPage.RemoveFromParent();
@@ -431,6 +485,20 @@
                    scene.functions.Remove(scenefunction);
                    continue;
                }
                try
                {
                    //将spk实体里面的min max值放入场景功能实体里,要不然数据会丢失 2022-06-21 16:06:45
                    foreach (var tt in scenefunction.status)
                    {
                        tt.min = scenefunction.localFunction.GetAttribute(tt.key).min;
                        tt.max = scenefunction.localFunction.GetAttribute(tt.key).max;
                        tt.valueList = scenefunction.localFunction.GetAttribute(tt.key).value;
                    }
                }catch(Exception ex)
                {
                    MainPage.Log($"场景加载功能列表异常:{ex.Message}");
                }
                i++;
                var row = new RowLayout()
                {
@@ -520,7 +588,10 @@
                };
                btnFunctionName.MouseUpEventHandler = skipEvent;
                btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent;
                btnFunctionDelayInfo.MouseUpEventHandler = skipEvent;
                btnFunctionInfo.MouseUpEventHandler = skipEvent;
                btnRight.MouseUpEventHandler = skipEvent;
                row.MouseUpEventHandler = skipEvent;
                Button btnDelSceneFunction = new Button() {
                    BackgroundColor = CSS_Color.WarningColor,
@@ -792,6 +863,12 @@
            UploadImage(selectImagePath, addSceneImageView, scene, uploadSuccessAction);
        }
        public override void RemoveFromParent()
        {
            backAction();
            base.RemoveFromParent();
        }
        /// <summary>
        /// 完成按钮点击事件
        /// </summary>
@@ -821,7 +898,7 @@
                    }
                    scene.EditScene();
                    FunctionList.List.scenes.Add(scene);
                    backAction();
                    //backAction();
                    this.RemoveFromParent();
                }
                if (btnComplete.TextID == StringId.Del)
@@ -829,7 +906,7 @@
                    Action action = () =>
                    {
                        FunctionList.List.DeleteScene(scene,true);
                        backAction();
                        //backAction();
                        this.RemoveFromParent();
                    };
                    new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.DeleteSceneTip, action);