wxr
2023-11-15 05cd80d1f3120f421008da69309a98708504be3f
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
@@ -97,14 +97,15 @@
        public void LoadPage()
        {
            new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene)).LoadTopView();
            var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene));
            topView.LoadTopView();
     
            bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
            var contentView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(603 - 50),
                Y = Application.GetRealHeight(64+10),
                Height = Application.GetRealHeight(603 - 50 -10),
                //BackgroundColor = CSS_Color.DividingLineColor,
            };
            bodyView.AddChidren(contentView);
@@ -423,6 +424,37 @@
                };
                row.AddChidren(btnFunctionInfo);
                var btnFunctionName = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Height = Application.GetRealWidth(44),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.TextFontSize,
                    Text = scenefunction.localFunction.name,
                };
                row.AddChidren(btnFunctionName);
                if (scenefunction.type == "7")
                {
                    btnFunctionName.Gravity = Gravity.CenterVertical;
                    btnFunctionInfo.TextAlignment = TextAlignment.CenterRight;
                    btnFunctionInfo.Gravity = Gravity.CenterVertical;
                    btnFunctionName.MouseUpEventHandler = (sender, e) =>{
                        try
                        {
                            LoadAutomationSettingDialog(scenefunction, btnFunctionInfo);
                        }
                        catch (Exception ex)
                        {
                            MainPage.Log($"load automation error : {ex.Message}");
                        }
                    };
                }
                else
                {
                var btnFunctionDelayInfo = new Button()
                {
                    Width = Application.GetRealWidth(327),
@@ -443,17 +475,6 @@
                    btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay);
                }
                var btnFunctionName = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Height = Application.GetRealWidth(44),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.TextFontSize,
                    Text = scenefunction.localFunction.name,
                };
                row.AddChidren(btnFunctionName);
                var btnFunctionFloorAndRoom = new Button()
                {
                    X = Application.GetRealWidth(16),
@@ -465,7 +486,6 @@
                    Text = scenefunction.localFunction.GetRoomListName(),
                };
                row.AddChidren(btnFunctionFloorAndRoom);
                EventHandler<MouseEventArgs> skipEvent= (sender, e) =>
                {
                    try
@@ -474,7 +494,8 @@
                        MainPage.BasePageView.AddChidren(ssf);
                        ssf.LoadPage();
                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    }catch(Exception ex)
                        }
                        catch (Exception ex)
                    {
                        MainPage.Log($"load SceneFunctionInfoEditPage error : {ex.Message}");
                    }
@@ -482,6 +503,7 @@
                btnFunctionName.MouseUpEventHandler = skipEvent;
                btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent;
                }
                Button btnDelSceneFunction = new Button()
                {
@@ -508,6 +530,23 @@
        string GetFunctionScnenInfo(SceneFunction sceneFunction)
        {
            var sceneFunctionInfo = "";
            if (sceneFunction.type == "7")
            {
                foreach (var sfs in sceneFunction.status)
                {
                    if (sfs.key == "enable")
                    {
                        if (sfs.value == "true")
                            return Language.StringByID(StringId.OpenArm);
                        else
                        {
                            return Language.StringByID(StringId.Close);
                        }
                    }
                }
            }
            else
            {
            foreach (var sfs in sceneFunction.status)
            {
                if (sfs.key == FunctionAttributeKey.OnOff)
@@ -595,6 +634,7 @@
            if (perSongName != null)
            {
                sceneFunctionInfo += " " + perSongName.value;
                }
            }
            return sceneFunctionInfo;
        }
@@ -687,6 +727,116 @@
        }
        /// <summary>
        /// 加载自动化配置弹窗
        /// </summary>
        void LoadAutomationSettingDialog(SceneFunction temp,Button btnTipText)
        {
            Dialog dialog = new Dialog();
            var pView = new FrameLayout()
            {
                BackgroundColor = CSS_Color.DialogTransparentColor1,
            };
            dialog.AddChidren(pView);
            var optionBaseView = new FrameLayout()
            {
                Y = Application.GetRealHeight(500),
                Height = Application.GetRealHeight(160),
                AnimateSpeed = 0.3f,
                Animate = Animate.DownToUp,
            };
            pView.AddChidren(optionBaseView);
            var optionView = new VerticalScrolViewLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(100),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealWidth(12),
                ScrollEnabled = false,
            };
            optionBaseView.AddChidren(optionView);
            var btnOn = new Button()
            {
                Height = Application.GetRealHeight(50),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.TextualColor,
                SelectedTextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextID = StringId.OpenArm,
            };
            optionView.AddChidren(btnOn);
            optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
            var btnOff = new Button()
            {
                Height = Application.GetRealHeight(50),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.TextualColor,
                SelectedTextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextID = StringId.Close,
            };
            optionView.AddChidren(btnOff);
            var btnCancel = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(8) + optionView.Bottom,
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(50),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealWidth(12),
                TextID = StringId.Cancel,
                TextColor = CSS_Color.WarningColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
            };
            optionBaseView.AddChidren(btnCancel);
            dialog.Show();
            pView.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            btnCancel.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            btnOn.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
                temp = new SceneFunction();
                temp.type = "7";
                temp.status.Add(new SceneFunctionStatus()
                {
                    key = "enable",
                    value = "true"
                });
                btnTipText.TextID = StringId.OpenArm;
            };
            btnOff.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
                temp = new SceneFunction();
                temp.type = "7";
                temp.status.Add(new SceneFunctionStatus()
                {
                    key = "enable",
                    value = "false"
                });
                btnTipText.TextID = StringId.Close;
            };
        }
    }
    //--------------------------------------
    public partial class SceneAddPage
@@ -727,10 +877,22 @@
        void LoadEvent_ChangeFunctionList()
        {
            btnAddFunctionTitle.MouseUpEventHandler = (sender, e) => {
                var sefp = new SceneFunctionListChoosePage(scene, refreshFunctionRowAction);
                if (DB_ResidenceData.Instance.HomeGateway.isSupportSceneEnableAutomation)
                {
                    //var sefp =new SceneFunctionListChoosePage(scene,refreshFunctionRowAction);
                    var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction);
                MainPage.BasePageView.AddChidren(sefp);
                sefp.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                }
                else
                {
                    var sefp = new SceneFunctionListChoosePage(scene, refreshFunctionRowAction);
                    //var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction);
                    MainPage.BasePageView.AddChidren(sefp);
                    sefp.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                }
            };
        }