wxr
2023-11-06 07c91e3b27d10bad17ad2f805aab7b74e24fad2b
场景增加配置自动化使能;安防增加干接点触发条件
2个文件已添加
10个文件已修改
909 ■■■■■ 已修改文件
HDL_ON/DAL/Server/HttpServerRequest.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/Function/Scene.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/FunctionList.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/HDL_ON.projitems 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI0-Public/TopViewDiv.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs 186 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAutomationListChoosePage.cs 239 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs 220 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneTargetTypeChoosePage.cs 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -192,9 +192,8 @@
            {
                if (canRefresh)
                {
                    MainPage.Log($"UserInfo.Current.RefreshToken 1 : " + UserInfo.Current.RefreshToken);
                    UserInfo.Current.RefreshToken = SiriKit.NSUserDefaultsHelper.DataSuite.StringForKey(SiriKit.NSUserDefaultsHelper.StorageKeys.GLOBAL_GAccessToken);
                    MainPage.Log($"UserInfo.Current.RefreshToken 2 : " + UserInfo.Current.RefreshToken);
                    UserInfo.Current.RefreshToken = SiriKit.NSUserDefaultsHelper.DataSuite.StringForKey(SiriKit.NSUserDefaultsHelper.StorageKeys.GLOBAL_GRefreshToken);
                    //UserInfo.Current.AccessToken = SiriKit.NSUserDefaultsHelper.DataSuite.StringForKey(SiriKit.NSUserDefaultsHelper.StorageKeys.GLOBAL_GAccessToken);
                    RefreshToken(false);
                }
            }
HDL_ON/Entity/Function/Scene.cs
@@ -3,6 +3,7 @@
using HDL_ON.Common;
using HDL_ON.DAL.Server;
using HDL_ON.UI;
using HDL_ON.UI.UI2.Intelligence.Automation;
using Shared;
namespace HDL_ON.Entity
@@ -561,10 +562,23 @@
        /// <returns></returns>
        private Function ConvertFunctionObject()
        {
            if (type == "7")
            {
                var logic = Logic.LogicList.Find((obj) => obj.sid == sid);
                if (logic != null) {
                    _localFunction = new Function()
                    {
                        name = logic.name
                    };
                }
            }
            else
            {
            var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid);
            if(localFunction == null)
            {
                localFunction = FunctionList.List.groupControls.Find((obj) => obj.sid == sid);
                }
            }
            return localFunction;
        }
@@ -577,6 +591,23 @@
        public string GetFunctionScnenInfo()
        {
            var sceneFunctionInfo = "";
            if (type == "7")
            {
                foreach (var sfs in 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 status)
            {
                if (sfs.key == FunctionAttributeKey.OnOff)
@@ -663,6 +694,7 @@
            {
                sceneFunctionInfo += " " + perSongName.value;
            }
            }
            return sceneFunctionInfo;
        }
@@ -670,6 +702,8 @@
        /// 设备
        /// 场景 =scene
        /// 群控=5
        /// 自动化=7
        ///
        /// </summary>
        public string type = "0";
    }
HDL_ON/Entity/FunctionList.cs
@@ -282,6 +282,8 @@
                SPK.SensorSmoke,
                SPK.SensorWater,
                SPK.SensorGas,
                SPK.SensorDryContact,
                SPK.SensorDryContact2,
            };
            return Functions.FindAll((obj) => spkList.Contains(obj.spk));
HDL_ON/HDL_ON.projitems
@@ -598,6 +598,8 @@
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\AirSwitchP3EnergyPage.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\AirSwitchP3SubloopEnergyPage.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\Constant.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\SceneTargetTypeChoosePage.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\SceneAutomationListChoosePage.cs" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" />
HDL_ON/UI/UI0-Public/TopViewDiv.cs
@@ -42,6 +42,8 @@
        /// </summary>
        Action backAction;
        public int maginY = 0;
        public TopViewDiv(FrameLayout frame, string str)
        {
            baseView = frame;
@@ -84,7 +86,7 @@
        {
            contentView = new FrameLayout()
            {
                Height = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(64+ maginY),
                BackgroundColor = color,
            };
            baseView.AddChidren(contentView);
@@ -92,7 +94,7 @@
            Button btnBackIcon = new Button()
            {
                X = Application.GetRealWidth(10),
                Y = Application.GetRealHeight(29),
                Y = Application.GetRealHeight(29 + maginY),
                Width = Application.GetRealWidth(40),
                Height = Application.GetRealWidth(28),
                UnSelectedImagePath = "Public/BackIcon.png",
@@ -102,7 +104,7 @@
            btnTilte = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(30),
                Y = Application.GetRealHeight(30 + maginY),
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealHeight(25),
                TextAlignment = TextAlignment.Center,
HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs
@@ -24,13 +24,15 @@
        public void LoadPage()
        {
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene)).LoadTopView();
            var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene));
            topView.maginY = 10;
            topView.LoadTopView();
            #region 添加场景
            FrameLayout addSceneView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(67),
                Y = Application.GetRealHeight(67 + 10),
                Width = Application.GetRealWidth(361),
                Height = Application.GetRealWidth(202),
                Radius = (uint)Application.GetRealWidth(12),
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
@@ -97,14 +97,16 @@
        public void LoadPage()
        {
            new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene)).LoadTopView();
            var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene));
            topView.maginY = 10;
            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 +425,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 +476,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 +487,6 @@
                    Text = scenefunction.localFunction.GetRoomListName(),
                };
                row.AddChidren(btnFunctionFloorAndRoom);
                EventHandler<MouseEventArgs> skipEvent= (sender, e) =>
                {
                    try
@@ -474,7 +495,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 +504,7 @@
                btnFunctionName.MouseUpEventHandler = skipEvent;
                btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent;
                }
                Button btnDelSceneFunction = new Button()
                {
@@ -508,6 +531,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 +635,7 @@
            if (perSongName != null)
            {
                sceneFunctionInfo += " " + perSongName.value;
                }
            }
            return sceneFunctionInfo;
        }
@@ -687,6 +728,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,7 +878,8 @@
        void LoadEvent_ChangeFunctionList()
        {
            btnAddFunctionTitle.MouseUpEventHandler = (sender, e) => {
                var sefp = new SceneFunctionListChoosePage(scene, refreshFunctionRowAction);
                //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;
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAutomationListChoosePage.cs
New file
@@ -0,0 +1,239 @@
using System;
using System.Collections.Generic;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using HDL_ON.UI.UI2.Intelligence.Automation;
using Shared;
namespace HDL_ON.UI
{
    public class SceneAutomationListChoosePage : FrameLayout
    {
        FrameLayout bodyView;
        Scene scene;
        Action refreshAction;
        List<Logic> addedList = new List<Logic>();
        public SceneAutomationListChoosePage(Scene function, Action action)
        {
            scene = function;
            bodyView = this;
            refreshAction = action;
            refreshAction += () => {
                this.RemoveFromParent();
            };
        }
        public void LoadPage()
        {
            this.bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
            var topView = new TopViewDiv(bodyView, "选择自动化");
            topView.maginY = 10;
            topView.LoadTopView();
            var contentView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(74),
                Height = Application.GetRealHeight(667-80),
            };
            bodyView.AddChidren(contentView);
            foreach (var logic in Logic.LogicList)
            {
                var funtionView = new FrameLayout()
                {
                    Height = Application.GetRealHeight(50),
                };
                contentView.AddChidren(funtionView);
                Button btnRight = new Button()
                {
                    X = Application.GetRealWidth(339),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetMinRealAverage(16),
                    Height = Application.GetMinRealAverage(16),
                    UnSelectedImagePath = "Public/Right.png",
                };
                funtionView.AddChidren(btnRight);
                if (scene.functions.Find((obj) => obj.sid == logic.sid) != null)
                {
                    addedList.Add(logic); var btnTipAdded = new Button()
                    {
                        Width = Application.GetRealWidth(327),
                        TextAlignment = TextAlignment.CenterRight,
                        TextColor = CSS_Color.MainColor,
                        TextSize = CSS_FontSize.TextFontSize,
                        TextID = StringId.Added
                    };
                    funtionView.AddChidren(btnTipAdded);
                    addedList.Add(logic);
                }
                var btnFunctionTitle = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Width = Application.GetRealWidth(220),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.SubheadingFontSize,
                    Text = logic.name
                };
                funtionView.AddChidren(btnFunctionTitle);
                var btnClick = new Button()
                {
                    X = Application.GetRealWidth(300),
                    Width = Application.GetRealWidth(70),
                };
                funtionView.AddChidren(btnClick);
                btnClick.MouseUpEventHandler = (sender, e) =>
                {
                    LoadEditDialog_OnOff(logic.sid);
                };
                contentView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
            }
        }
        /// <summary>
        /// 加载自动化配置弹窗
        /// </summary>
        void LoadEditDialog_OnOff(string logicSid)
        {
            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();
                var temp = scene.functions.Find((obj) => obj.sid == logicSid);
                if (temp != null)
                {
                    temp.status.Clear();
                }
                else
                {
                    temp = new SceneFunction();
                    temp.type = "7";
                    temp.sid = logicSid;
                    scene.functions.Add(temp);
                }
                temp.status.Add(new SceneFunctionStatus()
                {
                    key = "enable",
                    value = "true"
                });
                refreshAction();
            };
            btnOff.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
                var temp = scene.functions.Find((obj) => obj.sid == logicSid);
                if (temp != null)
                {
                    temp.status.Clear();
                }
                else
                {
                    temp = new SceneFunction();
                    temp.type = "7";
                    temp.sid = logicSid;
                    scene.functions.Add(temp);
                }
                temp.status.Add(new SceneFunctionStatus()
                {
                    key = "enable",
                    value = "false"
                });
                refreshAction();
            };
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
@@ -98,8 +98,10 @@
        public void LoadPage(Action backRefresh)
        {
             //DB_ResidenceData.Instance.sceneChooseRoomId
            new TopViewDiv(bodyView, Language.StringByID(StringId.EditScene)).LoadTopView(backRefresh);
            var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.EditScene));
            topView.maginY = 10;
            topView.LoadTopView(backRefresh);
            initPage();
        }
@@ -109,8 +111,8 @@
            VerticalScrolViewLayout contentView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(603-50),
                Y = Application.GetRealHeight(64 + 10),
                Height = Application.GetRealHeight(603-50-10),
            };
            bodyView.AddChidren(contentView);
            contentView.AddChidren(new Button() { Height = Application.GetRealWidth(12) });
@@ -552,6 +554,36 @@
                };
                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),
@@ -572,16 +604,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()
                {
@@ -608,6 +630,7 @@
                btnFunctionInfo.MouseUpEventHandler = skipEvent;
                btnRight.MouseUpEventHandler = skipEvent;
                row.MouseUpEventHandler = skipEvent;
                }
                Button btnDelSceneFunction = new Button() {
                    BackgroundColor = CSS_Color.WarningColor,
@@ -712,6 +735,172 @@
        }
        /// <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"
                });
                var waitPage = new Loading();
                bodyView.AddChidren(waitPage);
                waitPage.Start("");
                new System.Threading.Thread(() => {
                    try
                    {
                        var code = scene.EditScene();
                        Application.RunOnMainThread(() =>
                        {
                            if (code == "0")
                            {
                                btnTipText.TextID = StringId.OpenArm;
                            }
                        });
                    }
                    catch { }
                    finally
                    {
                        Application.RunOnMainThread(() => {
                            if(waitPage!= null)
                            {
                                waitPage.RemoveFromParent();
                                waitPage = null;
                            }
                        });
                    }
                })
                { IsBackground = true }.Start();
            };
            btnOff.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
                temp = new SceneFunction();
                temp.type = "7";
                temp.status.Add(new SceneFunctionStatus()
                {
                    key = "enable",
                    value = "false"
                });
                var waitPage = new Loading();
                bodyView.AddChidren(waitPage);
                waitPage.Start("");
                new System.Threading.Thread(() => {
                    try
                    {
                        var code = scene.EditScene();
                        Application.RunOnMainThread(() =>
                        {
                            if (code == "0")
                            {
                                btnTipText.TextID = StringId.Close;
                            }
                        });
                    }
                    catch { }
                    finally
                    {
                        Application.RunOnMainThread(() => {
                            if (waitPage != null)
                            {
                                waitPage.RemoveFromParent();
                                waitPage = null;
                            }
                        });
                    }
                })
                { IsBackground = true }.Start();
            };
        }
    }
    //--------------------------------------
    public partial class SceneEditPage
@@ -759,7 +948,8 @@
        void LoadEvent_ChangeFunctionList()
        {
            btnAddFunctionTitle.MouseUpEventHandler = (sender, e) => {
                var sefp =new SceneFunctionListChoosePage(scene,refreshFunctionRowAction);
                //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;
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
@@ -57,14 +57,15 @@
        public void LoadPage()
        {
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            new TopViewDiv(bodyView, Language.StringByID(StringId.AddFunction)).LoadTopView();
            //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.AddFunction));
            var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.AddFunction));
            topView.maginY = 10;
            topView.LoadTopView();
            #region 显示的功能类型切换区域
            showdFunctionTypeRow = new FrameLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(62),
                Y = Application.GetRealHeight(64+10),
                Height = Application.GetRealHeight(50),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            bodyView.AddChidren(showdFunctionTypeRow);
@@ -93,30 +94,14 @@
            };
            showdFunctionTypeRow.AddChidren(btnFloor);
            //btnScreenIcon = new Button()
            //{
            //    Width = Application.GetMinRealAverage(16),
            //    Height = Application.GetMinRealAverage(16),
            //    X = Application.GetRealWidth(122),
            //    Y = Application.GetRealHeight(18),
            //    UnSelectedImagePath = "Public/DownIcon.png",
            //};
            //showdFunctionTypeRow.AddChidren(btnScreenIcon);
            //btnScreenText = new Button()
            //{
            //    X = btnScreenIcon.Right,
            //    Y = Application.GetRealHeight(18),
            //    Width = Application.GetRealWidth(200),
            //    Height = Application.GetMinRealAverage(16),
            //    TextColor = CSS_Color.FirstLevelTitleColor,
            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            //    TextAlignment = TextAlignment.CenterLeft,
            //    TextID = StringId.Screen
            //};
            //showdFunctionTypeRow.AddChidren(btnScreenText);
            showdFunctionTypeRow.AddChidren(new Button()
            {
                Y = Application.GetRealHeight(49),
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealWidth(1),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
            #endregion
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneTargetTypeChoosePage.cs
New file
@@ -0,0 +1,158 @@
using System;
using System.Collections.Generic;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
    /// <summary>
    /// 场景模板类型选择界面
    /// 功能
    /// 自动化
    /// </summary>
    public class SceneTargetTypeChoosePage : FrameLayout
    {
        FrameLayout bodyView;
        Scene scene;
        /// <summary>
        /// 更新功能row
        /// </summary>
        Action refreshFunctionRowAction;
        public SceneTargetTypeChoosePage(Scene function, Action action)
        {
            bodyView = this;
            scene = function;
            refreshFunctionRowAction = () =>
            {
                this.RemoveFromParent();
                action();
            };
        }
        public void LoadPage()
        {
            bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
            bodyView.AddChidren(new Button()
            {
                Height = Application.GetRealHeight(20),
                BackgroundColor = CSS_Color.BackgroundColor
            });
            var topView = new TopViewDiv(bodyView, "添加执行动作");
            topView.maginY = 10;
            topView.LoadTopView();
            var contentView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(74),
                Height = Application.GetRealHeight(530),
                ScrollEnabled = false,
            };
            bodyView.AddChidren(contentView);
            var funtionView = new FrameLayout()
            {
                Height = Application.GetRealHeight(50),
            };
            contentView.AddChidren(funtionView);
            var btnFunctionIcon = new Button()
            {
                Gravity = Gravity.CenterVertical,
                X = Application.GetRealWidth(16),
                Width = Application.GetMinRealAverage(22),
                Height = Application.GetMinRealAverage(22),
                UnSelectedImagePath = "Navigation/ClassificationIcon.png",
            };
            funtionView.AddChidren(btnFunctionIcon);
            var btnFunctionRight = new Button()
            {
                X = Application.GetRealWidth(339),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/Right.png",
            };
            funtionView.AddChidren(btnFunctionRight);
            var btnFunctionTitle = new Button()
            {
                X = Application.GetRealWidth(50),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextID = StringId.Functions,
            };
            funtionView.AddChidren(btnFunctionTitle);
            btnFunctionTitle.MouseUpEventHandler = (sender, e) => {
                refreshFunctionRowAction += () => {
                    this.RemoveFromParent();
                };
                var sefp = new SceneFunctionListChoosePage(scene, refreshFunctionRowAction);
                MainPage.BasePageView.AddChidren(sefp);
                sefp.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            contentView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
            var automationView = new FrameLayout()
            {
                Height = Application.GetRealHeight(50),
            };
            contentView.AddChidren(automationView);
            var btnAutomationRight = new Button()
            {
                X = Application.GetRealWidth(339),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/Right.png",
            };
            automationView.AddChidren(btnAutomationRight);
            var btnAutomationIcon = new Button()
            {
                Gravity = Gravity.CenterVertical,
                X = Application.GetRealWidth(16),
                Width = Application.GetMinRealAverage(22),
                Height = Application.GetMinRealAverage(22),
                UnSelectedImagePath = "Navigation/IntellectualizationIcon.png",
            };
            automationView.AddChidren(btnAutomationIcon);
            var btnAutomationTitle = new Button()
            {
                X = Application.GetRealWidth(50),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextID = StringId.Automation,
            };
            automationView.AddChidren(btnAutomationTitle);
            btnAutomationTitle.MouseUpEventHandler = (sender, e) => {
                refreshFunctionRowAction += () => {
                    this.RemoveFromParent();
                };
                var sefp = new SceneAutomationListChoosePage(scene, refreshFunctionRowAction);
                MainPage.BasePageView.AddChidren(sefp);
                sefp.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            contentView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
@@ -53,12 +53,14 @@
        {
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            new TopViewDiv(bodyView, sceneFunction.localFunction.name).LoadTopView();
            var topView = new TopViewDiv(bodyView, sceneFunction.localFunction.name);
            topView.maginY = 10;
            topView.LoadTopView();
            contentView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(520),
                Y = Application.GetRealHeight(64 + 10),
                Height = Application.GetRealHeight(510),
                ScrollEnabled = false,
            };
            bodyView.AddChidren(contentView);