From 07c91e3b27d10bad17ad2f805aab7b74e24fad2b Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 06 十一月 2023 14:58:48 +0800
Subject: [PATCH] 场景增加配置自动化使能;安防增加干接点触发条件

---
 HDL_ON/Entity/Function/Scene.cs                                     |  184 ++++---
 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs   |   41 -
 HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs          |    6 
 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs                  |  390 +++++++++++-----
 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs                 |  284 ++++++++++--
 HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs      |    8 
 HDL_ON/DAL/Server/HttpServerRequest.cs                              |    5 
 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneTargetTypeChoosePage.cs     |  158 ++++++
 HDL_ON/HDL_ON.projitems                                             |    2 
 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAutomationListChoosePage.cs |  239 ++++++++++
 HDL_ON/Entity/FunctionList.cs                                       |    2 
 HDL_ON/UI/UI0-Public/TopViewDiv.cs                                  |    8 
 12 files changed, 1,047 insertions(+), 280 deletions(-)

diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index f6d8677..46ccea0 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/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);
                 }
             }
diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs
index 35fba28..9065ef5 100644
--- a/HDL_ON/Entity/Function/Scene.cs
+++ b/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()
         {
-            var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid);
-            if(localFunction == null)
+            if (type == "7")
             {
-                localFunction = FunctionList.List.groupControls.Find((obj) => obj.sid == sid);
+                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,91 +591,109 @@
         public string GetFunctionScnenInfo()
         {
             var sceneFunctionInfo = "";
-            foreach (var sfs in status)
+            if (type == "7")
             {
-                if (sfs.key == FunctionAttributeKey.OnOff)
+                foreach (var sfs in status)
                 {
-                    if (sfs.value == "off")
+                    if (sfs.key == "enable")
                     {
-                        return Language.StringByID(StringId.Close);
+                        if (sfs.value == "true")
+                            return Language.StringByID(StringId.OpenArm);
+                        else
+                        {
+                            return Language.StringByID(StringId.Close);
+                        }
                     }
                 }
             }
-            sceneFunctionInfo += Language.StringByID(StringId.Open) + " ";
+            else
+            {
+                foreach (var sfs in status)
+                {
+                    if (sfs.key == FunctionAttributeKey.OnOff)
+                    {
+                        if (sfs.value == "off")
+                        {
+                            return Language.StringByID(StringId.Close);
+                        }
+                    }
+                }
+                sceneFunctionInfo += Language.StringByID(StringId.Open) + " ";
 
-            var modeState = status.Find((obj) => obj.key == FunctionAttributeKey.Mode);
-            var tempState = status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp);
-            var fanState = status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed);
-            ////娴蜂俊鐢佃鐘舵��
-            //var hisenseTvState = status.Find((obj) => obj.key == "wol");
-            //if(hisenseTvState != null)
-            //{
-            //}
-            if (modeState != null)
-            {
-                sceneFunctionInfo += modeState.GetValueText() + " ";
-            }
-            if (tempState != null)
-            {
-                sceneFunctionInfo += tempState.GetValueText();
-                sceneFunctionInfo += tempState.GetUintString() + " ";
-            }
-            if (fanState != null)
-            {
-                sceneFunctionInfo += fanState.GetValueText() + " ";
-            }
-            var briState = status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
-            if (briState != null)
-            {
-                sceneFunctionInfo += briState.value + "%" + " ";
-            }
-            var perState = status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
-            if (perState != null)
-            {
-                sceneFunctionInfo += perState.value + "%" + " ";
-            }
-            var cctState = status.Find((obj) => obj.key == FunctionAttributeKey.CCT);
-            if (cctState != null)
-            {
-                sceneFunctionInfo += cctState.value + "K" + " ";
-            }
-            var rgbState = status.Find((obj) => obj.key == FunctionAttributeKey.RGB);
-            if (rgbState != null)
-            {
-                //sceneFunctionInfo += new  cctState.value + "%" + " ";
-            }
+                var modeState = status.Find((obj) => obj.key == FunctionAttributeKey.Mode);
+                var tempState = status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp);
+                var fanState = status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed);
+                ////娴蜂俊鐢佃鐘舵��
+                //var hisenseTvState = status.Find((obj) => obj.key == "wol");
+                //if(hisenseTvState != null)
+                //{
+                //}
+                if (modeState != null)
+                {
+                    sceneFunctionInfo += modeState.GetValueText() + " ";
+                }
+                if (tempState != null)
+                {
+                    sceneFunctionInfo += tempState.GetValueText();
+                    sceneFunctionInfo += tempState.GetUintString() + " ";
+                }
+                if (fanState != null)
+                {
+                    sceneFunctionInfo += fanState.GetValueText() + " ";
+                }
+                var briState = status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
+                if (briState != null)
+                {
+                    sceneFunctionInfo += briState.value + "%" + " ";
+                }
+                var perState = status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
+                if (perState != null)
+                {
+                    sceneFunctionInfo += perState.value + "%" + " ";
+                }
+                var cctState = status.Find((obj) => obj.key == FunctionAttributeKey.CCT);
+                if (cctState != null)
+                {
+                    sceneFunctionInfo += cctState.value + "K" + " ";
+                }
+                var rgbState = status.Find((obj) => obj.key == FunctionAttributeKey.RGB);
+                if (rgbState != null)
+                {
+                    //sceneFunctionInfo += new  cctState.value + "%" + " ";
+                }
 
 
-            var perAngle = status.Find((obj) => obj.key == FunctionAttributeKey.Angle);
-            if (perAngle != null)
-            {
-                sceneFunctionInfo += " " + perAngle.value + "掳";
-            }
+                var perAngle = status.Find((obj) => obj.key == FunctionAttributeKey.Angle);
+                if (perAngle != null)
+                {
+                    sceneFunctionInfo += " " + perAngle.value + "掳";
+                }
 
-            var perSetVolume = status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume);
-            if (perSetVolume != null)
-            {
-                sceneFunctionInfo += " " + perSetVolume.value;
-            }
+                var perSetVolume = status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume);
+                if (perSetVolume != null)
+                {
+                    sceneFunctionInfo += " " + perSetVolume.value;
+                }
 
-            var perSignal = status.Find((obj) => obj.key == FunctionAttributeKey.Signal);
-            if (perSignal != null)
-            {
-                var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface();
-                string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value);
-                sceneFunctionInfo += " " + key;
-            }
+                var perSignal = status.Find((obj) => obj.key == FunctionAttributeKey.Signal);
+                if (perSignal != null)
+                {
+                    var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface();
+                    string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value);
+                    sceneFunctionInfo += " " + key;
+                }
 
-            var perVolume =status.Find((obj) => obj.key == FunctionAttributeKey.Volume);
-            if (perVolume != null)
-            {
-                sceneFunctionInfo += " " + perVolume.value;
-            }
+                var perVolume = status.Find((obj) => obj.key == FunctionAttributeKey.Volume);
+                if (perVolume != null)
+                {
+                    sceneFunctionInfo += " " + perVolume.value;
+                }
 
-            var perSongName =status.Find((obj) => obj.key == FunctionAttributeKey.SongName);
-            if (perSongName != null)
-            {
-                sceneFunctionInfo += " " + perSongName.value;
+                var perSongName = status.Find((obj) => obj.key == FunctionAttributeKey.SongName);
+                if (perSongName != null)
+                {
+                    sceneFunctionInfo += " " + perSongName.value;
+                }
             }
             return sceneFunctionInfo;
         }
@@ -670,6 +702,8 @@
         /// 璁惧
         /// 鍦烘櫙 =scene
         /// 缇ゆ帶=5
+        /// 鑷姩鍖�=7
+        /// 
         /// </summary>
         public string type = "0";
     }
diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index 919bfe1..f91b737 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/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));
diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems
index edb07df..708c9a1 100644
--- a/HDL_ON/HDL_ON.projitems
+++ b/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\" />
diff --git a/HDL_ON/UI/UI0-Public/TopViewDiv.cs b/HDL_ON/UI/UI0-Public/TopViewDiv.cs
index 572cffe..31658f6 100644
--- a/HDL_ON/UI/UI0-Public/TopViewDiv.cs
+++ b/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,
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs
index efb7272..6ec4b00 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs
+++ b/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),
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
index 4586b64..c4219e2 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
+++ b/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,25 +425,6 @@
                 };
                 row.AddChidren(btnFunctionInfo);
 
-                var btnFunctionDelayInfo = new Button()
-                {
-                    Width = Application.GetRealWidth(327),
-                    Y = Application.GetRealWidth(35),
-                    Height = Application.GetRealWidth(32),
-                    TextAlignment = TextAlignment.TopRight,
-                    TextColor = CSS_Color.PromptingColor1,
-                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-                };
-                row.AddChidren(btnFunctionDelayInfo);
-
-                if (Convert.ToInt32(scenefunction.delay) > 0)
-                {
-                    btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText();
-                }
-                else
-                {
-                    btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay);
-                }
 
                 var btnFunctionName = new Button()
                 {
@@ -454,34 +437,74 @@
                 };
                 row.AddChidren(btnFunctionName);
 
-                var btnFunctionFloorAndRoom = new Button()
+                if (scenefunction.type == "7")
                 {
-                    X = Application.GetRealWidth(16),
-                    Y = Application.GetRealWidth(24),
-                    Height = Application.GetRealWidth(41),
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextColor = CSS_Color.PromptingColor1,
-                    TextSize = CSS_FontSize.TextFontSize,
-                    Text = scenefunction.localFunction.GetRoomListName(),
-                };
-                row.AddChidren(btnFunctionFloorAndRoom);
+                    btnFunctionName.Gravity = Gravity.CenterVertical;
+                    btnFunctionInfo.TextAlignment = TextAlignment.CenterRight;
+                    btnFunctionInfo.Gravity = Gravity.CenterVertical;
 
-                EventHandler<MouseEventArgs> skipEvent= (sender, e) =>
+                    btnFunctionName.MouseUpEventHandler = (sender, e) =>{
+                        try
+                        {
+                            LoadAutomationSettingDialog(scenefunction, btnFunctionInfo);
+                        }
+                        catch (Exception ex)
+                        {
+                            MainPage.Log($"load automation error : {ex.Message}");
+                        }
+                    };
+                }
+                else
                 {
-                    try
+                    var btnFunctionDelayInfo = new Button()
                     {
-                        var ssf = new SceneFunctionInfoEditPage(scene, scenefunction.localFunction.ConvertSceneFunction(), refreshFunctionRowAction);
-                        MainPage.BasePageView.AddChidren(ssf);
-                        ssf.LoadPage();
-                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                    }catch(Exception ex)
+                        Width = Application.GetRealWidth(327),
+                        Y = Application.GetRealWidth(35),
+                        Height = Application.GetRealWidth(32),
+                        TextAlignment = TextAlignment.TopRight,
+                        TextColor = CSS_Color.PromptingColor1,
+                        TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                    };
+                    row.AddChidren(btnFunctionDelayInfo);
+
+                    if (Convert.ToInt32(scenefunction.delay) > 0)
                     {
-                        MainPage.Log($"load SceneFunctionInfoEditPage error : {ex.Message}");
+                        btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText();
                     }
-                };
+                    else
+                    {
+                        btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay);
+                    }
 
-                btnFunctionName.MouseUpEventHandler = skipEvent;
-                btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent;
+                    var btnFunctionFloorAndRoom = new Button()
+                    {
+                        X = Application.GetRealWidth(16),
+                        Y = Application.GetRealWidth(24),
+                        Height = Application.GetRealWidth(41),
+                        TextAlignment = TextAlignment.CenterLeft,
+                        TextColor = CSS_Color.PromptingColor1,
+                        TextSize = CSS_FontSize.TextFontSize,
+                        Text = scenefunction.localFunction.GetRoomListName(),
+                    };
+                    row.AddChidren(btnFunctionFloorAndRoom);
+                    EventHandler<MouseEventArgs> skipEvent = (sender, e) =>
+                    {
+                        try
+                        {
+                            var ssf = new SceneFunctionInfoEditPage(scene, scenefunction.localFunction.ConvertSceneFunction(), refreshFunctionRowAction);
+                            MainPage.BasePageView.AddChidren(ssf);
+                            ssf.LoadPage();
+                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                        }
+                        catch (Exception ex)
+                        {
+                            MainPage.Log($"load SceneFunctionInfoEditPage error : {ex.Message}");
+                        }
+                    };
+
+                    btnFunctionName.MouseUpEventHandler = skipEvent;
+                    btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent;
+                }
 
                 Button btnDelSceneFunction = new Button()
                 {
@@ -508,93 +531,111 @@
         string GetFunctionScnenInfo(SceneFunction sceneFunction)
         {
             var sceneFunctionInfo = "";
-            foreach (var sfs in sceneFunction.status)
+            if (sceneFunction.type == "7")
             {
-                if (sfs.key == FunctionAttributeKey.OnOff)
+                foreach (var sfs in sceneFunction.status)
                 {
-                    if (sfs.value == "off")
-                        return Language.StringByID(StringId.Close);
-                }
-            }
-
-            sceneFunctionInfo += Language.StringByID(StringId.Open);
-
-            var modeState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Mode);
-            var tempState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp);
-            var fanState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed);
-            if (modeState != null)
-            {
-                sceneFunctionInfo += modeState.GetValueText();
-            }
-            if (tempState != null)
-            {
-                sceneFunctionInfo += tempState.GetValueText();
-                sceneFunctionInfo += tempState.GetUintString();
-            }
-            if (fanState != null)
-            {
-                sceneFunctionInfo += fanState.GetValueText();
-            }
-            var briState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
-            if (briState != null)
-            {
-                sceneFunctionInfo += " " + briState.value + "%";
-            }
-            var perState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
-            if (perState != null)
-            {
-                sceneFunctionInfo += " " + perState.value + "%";
-            }
-            var perAngle = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Angle);
-            if (perAngle != null)
-            {
-                sceneFunctionInfo += " "+ perAngle.value + "掳";
-            }
-
-            var perColorful = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful);
-            if(perColorful != null)
-            {
-                if (perColorful.value == "on")
-                {
-                    sceneFunctionInfo += " " + Language.StringByID(StringId.HorseRaceLamp);
-                }
-                else
-                {
-                    if (sceneFunction.localFunction.spk == SPK.GroupControl)
+                    if (sfs.key == "enable")
                     {
-                        sceneFunctionInfo += " " + Language.StringByID(StringId.Close) + " " + Language.StringByID(StringId.HorseRaceLamp);
+                        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)
+                    {
+                        if (sfs.value == "off")
+                            return Language.StringByID(StringId.Close);
+                    }
+                }
+
+                sceneFunctionInfo += Language.StringByID(StringId.Open);
+
+                var modeState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Mode);
+                var tempState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp);
+                var fanState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed);
+                if (modeState != null)
+                {
+                    sceneFunctionInfo += modeState.GetValueText();
+                }
+                if (tempState != null)
+                {
+                    sceneFunctionInfo += tempState.GetValueText();
+                    sceneFunctionInfo += tempState.GetUintString();
+                }
+                if (fanState != null)
+                {
+                    sceneFunctionInfo += fanState.GetValueText();
+                }
+                var briState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
+                if (briState != null)
+                {
+                    sceneFunctionInfo += " " + briState.value + "%";
+                }
+                var perState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
+                if (perState != null)
+                {
+                    sceneFunctionInfo += " " + perState.value + "%";
+                }
+                var perAngle = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Angle);
+                if (perAngle != null)
+                {
+                    sceneFunctionInfo += " " + perAngle.value + "掳";
+                }
+
+                var perColorful = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful);
+                if (perColorful != null)
+                {
+                    if (perColorful.value == "on")
+                    {
+                        sceneFunctionInfo += " " + Language.StringByID(StringId.HorseRaceLamp);
                     }
                     else
                     {
-                        sceneFunctionInfo = Language.StringByID(StringId.Close) + " " + Language.StringByID(StringId.HorseRaceLamp);
+                        if (sceneFunction.localFunction.spk == SPK.GroupControl)
+                        {
+                            sceneFunctionInfo += " " + Language.StringByID(StringId.Close) + " " + Language.StringByID(StringId.HorseRaceLamp);
+                        }
+                        else
+                        {
+                            sceneFunctionInfo = Language.StringByID(StringId.Close) + " " + Language.StringByID(StringId.HorseRaceLamp);
+                        }
                     }
                 }
-            }
 
-            var perSetVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume);
-            if (perSetVolume != null)
-            {
-                sceneFunctionInfo += " " + perSetVolume.value ;
-            }
+                var perSetVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume);
+                if (perSetVolume != null)
+                {
+                    sceneFunctionInfo += " " + perSetVolume.value;
+                }
 
-            var perSignal = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Signal);
-            if (perSignal != null)
-            {
-                var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface();
-                string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value);
-                sceneFunctionInfo += " " + key;
-            }
+                var perSignal = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Signal);
+                if (perSignal != null)
+                {
+                    var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface();
+                    string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value);
+                    sceneFunctionInfo += " " + key;
+                }
 
-            var perVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Volume);
-            if (perVolume != null)
-            {
-                sceneFunctionInfo += " " + perVolume.value;
-            }
+                var perVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Volume);
+                if (perVolume != null)
+                {
+                    sceneFunctionInfo += " " + perVolume.value;
+                }
 
-            var perSongName = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SongName);
-            if (perSongName != null)
-            {
-                sceneFunctionInfo += " " + perSongName.value;
+                var perSongName = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SongName);
+                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;
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAutomationListChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAutomationListChoosePage.cs
new file mode 100644
index 0000000..0d49714
--- /dev/null
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAutomationListChoosePage.cs
@@ -0,0 +1,239 @@
+锘縰sing 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();
+            };
+
+        }
+
+
+    }
+}
+
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
index 4373932..f1d18b8 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
+++ b/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,26 +554,6 @@
                 };
                 row.AddChidren(btnFunctionInfo);
 
-                var btnFunctionDelayInfo = new Button()
-                {
-                    Width = Application.GetRealWidth(327),
-                    Y = Application.GetRealWidth(35),
-                    Height = Application.GetRealWidth(32),
-                    TextAlignment = TextAlignment.TopRight,
-                    TextColor = CSS_Color.PromptingColor1,
-                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-                };
-                row.AddChidren(btnFunctionDelayInfo);
-
-                if (!string.IsNullOrEmpty(scenefunction.delay) && Convert.ToInt32( scenefunction.delay) > 0)
-                {
-                    btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText();
-                }
-                else
-                {
-                    btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay);
-                }
-
                 var btnFunctionName = new Button()
                 {
                     X = Application.GetRealWidth(16),
@@ -583,31 +565,72 @@
                 };
                 row.AddChidren(btnFunctionName);
 
-                var btnFunctionFloorAndRoom = new Button()
+                if (scenefunction.type == "7")
                 {
-                    X = Application.GetRealWidth(16),
-                    Y = Application.GetRealWidth(24),
-                    Height = Application.GetRealWidth(41),
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextColor = CSS_Color.PromptingColor1,
-                    TextSize = CSS_FontSize.TextFontSize,
-                    Text = scenefunction.localFunction.GetRoomListName(),
-                };
-                row.AddChidren(btnFunctionFloorAndRoom);
+                    btnFunctionName.Gravity = Gravity.CenterVertical;
+                    btnFunctionInfo.TextAlignment = TextAlignment.CenterRight;
+                    btnFunctionInfo.Gravity = Gravity.CenterVertical;
 
-                EventHandler<MouseEventArgs> skipEvent = (sender, e) =>
+                    btnFunctionName.MouseUpEventHandler = (sender, e) => {
+                        try
+                        {
+                            LoadAutomationSettingDialog(scenefunction, btnFunctionInfo);
+                        }
+                        catch (Exception ex)
+                        {
+                            MainPage.Log($"load automation error : {ex.Message}");
+                        }
+                    };
+                }
+                else
                 {
-                    var ssf = new SceneFunctionInfoEditPage(scene, scenefunction, refreshFunctionRowAction);
-                    MainPage.BasePageView.AddChidren(ssf);
-                    ssf.LoadPage();
-                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                };
-                btnFunctionName.MouseUpEventHandler = skipEvent;
-                btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent;
-                btnFunctionDelayInfo.MouseUpEventHandler = skipEvent;
-                btnFunctionInfo.MouseUpEventHandler = skipEvent;
-                btnRight.MouseUpEventHandler = skipEvent;
-                row.MouseUpEventHandler = skipEvent;
+                    var btnFunctionDelayInfo = new Button()
+                    {
+                        Width = Application.GetRealWidth(327),
+                        Y = Application.GetRealWidth(35),
+                        Height = Application.GetRealWidth(32),
+                        TextAlignment = TextAlignment.TopRight,
+                        TextColor = CSS_Color.PromptingColor1,
+                        TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                    };
+                    row.AddChidren(btnFunctionDelayInfo);
+
+                    if (!string.IsNullOrEmpty(scenefunction.delay) && Convert.ToInt32(scenefunction.delay) > 0)
+                    {
+                        btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText();
+                    }
+                    else
+                    {
+                        btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay);
+                    }
+
+
+                    var btnFunctionFloorAndRoom = new Button()
+                    {
+                        X = Application.GetRealWidth(16),
+                        Y = Application.GetRealWidth(24),
+                        Height = Application.GetRealWidth(41),
+                        TextAlignment = TextAlignment.CenterLeft,
+                        TextColor = CSS_Color.PromptingColor1,
+                        TextSize = CSS_FontSize.TextFontSize,
+                        Text = scenefunction.localFunction.GetRoomListName(),
+                    };
+                    row.AddChidren(btnFunctionFloorAndRoom);
+
+                    EventHandler<MouseEventArgs> skipEvent = (sender, e) =>
+                    {
+                        var ssf = new SceneFunctionInfoEditPage(scene, scenefunction, refreshFunctionRowAction);
+                        MainPage.BasePageView.AddChidren(ssf);
+                        ssf.LoadPage();
+                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                    };
+                    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,
@@ -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;
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
index c0f6581..2278e48 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
+++ b/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
 
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneTargetTypeChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneTargetTypeChoosePage.cs
new file mode 100644
index 0000000..957a33b
--- /dev/null
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneTargetTypeChoosePage.cs
@@ -0,0 +1,158 @@
+锘縰sing 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 });
+        }
+    }
+}
+
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
index 4713ac2..08820bd 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
+++ b/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);

--
Gitblit v1.8.0