wxr
2020-12-01 a46cd0adb5af29e8a9cf47c219475acaedfcf839
Merge remote-tracking branch 'origin/WJC'
55个文件已添加
8个文件已修改
5531 ■■■■■ 已修改文件
.vs/HDL_APP_Project/xs/sqlite3/storage.ide 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Language.ini 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/addconditiontarget.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/airconditionerlogic.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/back.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/bjicon.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/curtainlogic.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/delayed.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/down.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/editname.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/functionicon.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/heatlogic.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/lightloguc.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/next.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/off.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/on.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/outletlogic.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/scene.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/set.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/timecondition.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/timeicon.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/weekoff.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/weekon.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Resources/Resource.designer.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/R.cs 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/HttpUtil.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/HDL_ON.projitems 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/CSS/CSS.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/.DS_Store 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs 674 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs 284 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/Automation/.DS_Store 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/DeviceFunList.cs 386 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs 256 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs 262 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs 344 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputTextView.cs 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AreaView.cs 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/ConfirmPopView.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/DateView.cs 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/EditPopView.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/FunAllAreaView.cs 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicAddView.cs 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/MonView.cs 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SaveView.cs 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SelectTypeView.cs 135 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SingleLogicView.cs 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TextSize.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeHorizonView.cs 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeView.cs 269 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs 569 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TopView.cs 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs 193 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs 263 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs 386 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/sqlite3/storage.ide
Binary files differ
HDL-ON_Android/Assets/Language.ini
@@ -432,6 +432,63 @@
5046=调节音量
5047=你手机暂未安装"QQ音乐"{\r\n}请前往手机商场安装
7000=新建自动化
7001=编辑自动化
7002=如果
7003=同时满足以下条件时
7004=任一满足以下条件时
7005=就执行
7006=以下动作
7007=循环方式
7008=执行一次
7009=每天
7010=每周
7011=每月
7012=保存
7013=执行推送
7014=发送通知
7015=选择条件
7016=时间
7017=选择时间条件
7018=时刻
7019=时间范围
7020=时
7021=分
7022=秒
7023=取消
7024=确定
7025=*在您所设置的时间段内必定会执行一次您所设置的自动化
7026=开始时间
7027=结束时间
7028=功能
7029=选中功能条件
7030=全部区域
7031=全部功能
7032=开
7033=关
7034=开关
7035=完成
7036=添加执行动作
7037=周一
7038=周二
7039=周三
7040=周四
7041=周五
7042=周六
7043=周日
7044=满足条件
7045=设置
7046=名称
7047=修改名称
7048=自动化名称已存在
7049=是否要删除自动化?
7050=添加场景
7051=延时
9000=请使用新的手机账号登录APP
9001=请使用新的邮箱账号登录APP
9002=登录手机修改完成
HDL-ON_Android/Assets/Phone/LogicIcon/addconditiontarget.png
HDL-ON_Android/Assets/Phone/LogicIcon/airconditionerlogic.png
HDL-ON_Android/Assets/Phone/LogicIcon/back.png
HDL-ON_Android/Assets/Phone/LogicIcon/bjicon.png
HDL-ON_Android/Assets/Phone/LogicIcon/curtainlogic.png
HDL-ON_Android/Assets/Phone/LogicIcon/delayed.png
HDL-ON_Android/Assets/Phone/LogicIcon/down.png
HDL-ON_Android/Assets/Phone/LogicIcon/editname.png
HDL-ON_Android/Assets/Phone/LogicIcon/functionicon.png
HDL-ON_Android/Assets/Phone/LogicIcon/heatlogic.png
HDL-ON_Android/Assets/Phone/LogicIcon/lightloguc.png
HDL-ON_Android/Assets/Phone/LogicIcon/next.png
HDL-ON_Android/Assets/Phone/LogicIcon/off.png
HDL-ON_Android/Assets/Phone/LogicIcon/on.png
HDL-ON_Android/Assets/Phone/LogicIcon/outletlogic.png
HDL-ON_Android/Assets/Phone/LogicIcon/scene.png
HDL-ON_Android/Assets/Phone/LogicIcon/set.png
HDL-ON_Android/Assets/Phone/LogicIcon/timecondition.png
HDL-ON_Android/Assets/Phone/LogicIcon/timeicon.png
HDL-ON_Android/Assets/Phone/LogicIcon/weekoff.png
HDL-ON_Android/Assets/Phone/LogicIcon/weekon.png
HDL-ON_Android/Resources/Resource.designer.cs
@@ -2,6 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
@@ -14,7 +15,7 @@
{
    
    
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
    public partial class Resource
    {
        
HDL_ON/Common/R.cs
@@ -427,6 +427,60 @@
        public const int qqMsuicTip = 5047;
        public const int newAutomation = 7000;
        public const int editAutomation = 7001;
        public const int ifCondition = 7002;
        public const int andCondition = 7003;
        public const int orCondition = 7004;
        public const int isExecuted = 7005;
        public const int theFollowingActions = 7006;
        public const int cyclic = 7007;
        public const int performA = 7008;
        public const int days = 7009;
        public const int weekly = 7010;
        public const int monthly = 7011;
        public const int save = 7012;
        public const int push = 7013;
        public const int notification = 7014;
        public const int selectionCondition = 7015;
        public const int time = 7016;
        public const int selectionTimeCondition = 7017;
        public const int hour = 7018;
        public const int timeHorizon = 7019;
        public const int h = 7020;
        public const int m = 7021;
        public const int s = 7022;
        public const int cancelSelected = 7023;
        public const int confirmSelected = 7024;
        public const int timeTipText = 7025;
        public const int startTime = 7026;
        public const int endTime = 7027;
        public const int funLogic = 7028;
        public const int selectedFunCondition = 7029;
        public const int allAreas = 7030;
        public const int allFun = 7031;
        public const int onLogic = 7032;
        public const int offLogic = 7033;
        public const int switchLogic = 7034;
        public const int completeLogic = 7035;
        public const int addtarget = 7036;
        public const int monday = 7037;
        public const int tuesday = 7038;
        public const int wednesday = 7039;
        public const int thursday = 7040;
        public const int friday = 7041;
        public const int saturday = 7042;
        public const int sunday = 7043;
        public const int meetTheCondition = 7044;
        public const int setlogic = 7045;
        public const int namelogic = 7046;
        public const int editName = 7047;
        public const int NameAlreadyExists = 7048;
        public const int delAutomation = 7049;
        public const int addSceneLogic = 7050;
        public const int delayLogic = 7051;
        #region LE新增
        /// <summary>
        /// 请使用新的手机账号登录APP
HDL_ON/DAL/Server/HttpUtil.cs
@@ -208,6 +208,7 @@
                {
                    try
                    {
                        ResponsePackNew revertObj = new ResponsePackNew() { };
                        revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePackNew>(response.Content);
                        //*****一些判空处理*****************
HDL_ON/HDL_ON.projitems
@@ -218,6 +218,37 @@
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\1-HomePage\MessageCenterPage.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Public\Widget\MenuButton.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Public\RoomGalleryPage.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\AddInputType.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\AddLogic.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\AddTarget.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\DeviceFunList.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\FunTpye.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\InpOrOutLogicMethod.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\Logic.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicMethod.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\MainView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\Set.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\TimeTpye.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\FunAllAreaView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\EditPopView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\DateView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\AreaView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\MonView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\LogicAddView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\TopView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\ConfirmPopView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\SelectTypeView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\SwitchView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\LogicTypeTitleView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\TimeView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\TimeHorizonView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\TextSize.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\AddOutputInputView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\TipPopView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\AddOutputInputTextView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\SaveView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\SingleLogicView.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\Send.cs" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="$(MSBuildThisFileDirectory)UI\" />
HDL_ON/UI/CSS/CSS.cs
@@ -94,6 +94,25 @@
        /// </summary>
        public const uint LinkTipFail = 0xFFFF4747;
        #region 自动化
        /// <summary>
        /// 标准字体颜色
        /// </summary>
        public const uint textColor = 0XFF1B2D4D;
        public const uint textCancelColor = 0XFFC0C7D4;
        public const uint textConfirmColor = 0XFF4484F4;
        public const uint textRedColor = 0XFFFF4747;
        public const uint textWhiteColor = 0XFFFFFFFF;
        public const uint viewTop = 0XFFF7F7F7;
        public const uint viewMiddle = 0XFFF2F3F7;
        public const uint viewLine = 0XFFECEDEE;
        public const uint view = 0XFFFFFFFF;
        public const uint btnSaveBackgroundColor = 0XFF4484F4;
        public const uint viewTrans60lucence = 0x60000000;
        public const uint viewTranslucence = 0x00000000;
        public const uint textTipColor = 0XFF798394;
        #endregion
        #endregion
    }
HDL_ON/UI/UI2/3-Intelligence/.DS_Store
Binary files differ
HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store
Binary files differ
HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
New file
@@ -0,0 +1,66 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class AddInputType : FrameLayout
    {
        public AddInputType()
        {
            Tag = "Logic";
        }
        public void Show()
        {
            LogicView.TopView topView = new LogicView.TopView();
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
            {
                RemoveFromParent();
            };
            topView.topNameBtn.TextID = StringId.selectionCondition;
            FrameLayout viewLayout = new FrameLayout
            {
                Y = Application.GetRealHeight(64),
                Width = Application.GetRealWidth(LogicView.TextSize.view375),
                Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64),
                BackgroundColor = CSS.CSS_Color.viewMiddle,
            };
            this.AddChidren(viewLayout);
            #region 时间  功能
            //时间
            LogicView.SelectTypeView timeView = new LogicView.SelectTypeView();
            timeView.btnText.TextID = StringId.time;
            timeView.btnIcon.UnSelectedImagePath = "LogicIcon/timeicon.png";
            viewLayout.AddChidren(timeView.FLayoutView());
            //功能
            LogicView.SelectTypeView functionView = new LogicView.SelectTypeView();
            functionView.frameLayout.Y = timeView.frameLayout.Bottom;
            functionView.btnText.TextID = StringId.funLogic;
            functionView.btnIcon.UnSelectedImagePath = "LogicIcon/functionicon.png";
            viewLayout.AddChidren(functionView.FLayoutView());
            #endregion
            #region  所有点击事件
            timeView.btnClick.MouseUpEventHandler += (sen, e) => {
                TimeTpye timeTpye = new TimeTpye();
                MainPage.BasePageView.AddChidren(timeTpye);
                timeTpye.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            functionView.btnClick.MouseUpEventHandler += (sen, e) => {
                FunTpye funTpye = new FunTpye();
                MainPage.BasePageView.AddChidren(funTpye);
                funTpye.Show(LogicMethod.condition_if);
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            #endregion
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
New file
@@ -0,0 +1,674 @@
using System;
using Shared;
using System.Collections.Generic;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class AddLogic : FrameLayout
    {
        public AddLogic()
        {
            Tag = "Logic";
        }
        public void Show()
        {
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            LogicView.TopView topView = new LogicView.TopView();
            topView.setBtn.Visible = true;
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
             {
                 RemoveFromParent();
             };
            if (string.IsNullOrEmpty(Logic.currlogic.sid))
            {
                topView.topNameBtn.TextID = StringId.newAutomation;
                topView.setBtn.Visible = false;
                topView.clickSetBtn.Visible = false;
            }
            else
            {
                topView.topNameBtn.TextID = StringId.editAutomation;
                topView.setBtn.Visible = true;
                topView.clickSetBtn.Visible = true;
            }
            topView.clickSetBtn.MouseUpEventHandler += (sender,e) => {
                Set set = new Set();
                MainPage.BasePageView.AddChidren(set);
                set.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
           VerticalScrolViewLayout viewLayout = new VerticalScrolViewLayout
            {
                Y = Application.GetRealHeight(64),
                Width = Application.GetRealWidth(LogicView.TextSize.view375),
                Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64 - 76),
                BackgroundColor = CSS.CSS_Color.viewMiddle,
            };
            this.AddChidren(viewLayout);
            #region  条件
            ///如果的View
            LogicView.AddOutputInputTextView addInputTextView = new LogicView.AddOutputInputTextView();
            addInputTextView.btnIf.TextID = StringId.ifCondition;
            viewLayout.AddChidren(addInputTextView.FLayoutView(46, 12));
            ///满足以下条件的View
            LogicView.LogicTypeTitleView titleCondition = new LogicView.LogicTypeTitleView();
            titleCondition.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
            titleCondition.btnText.TextID = StringId.andCondition;
            viewLayout.AddChidren(titleCondition.FLayoutView());
            titleCondition.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                FrameLayout fLayout = new FrameLayout
                {
                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                };
                this.AddChidren(fLayout);
                AndOrMethod(fLayout, titleCondition.btnText);
            };
            // 条件处理方法
            InpOrOutLogicMethod.InputCondition(this, viewLayout);
            ///添加图标的View
            LogicView.LogicAddView addInputIcon = new LogicView.LogicAddView();
            addInputIcon.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
            viewLayout.AddChidren(addInputIcon.FLayoutView());
            addInputIcon.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                var addInputType = new AddInputType();
                MainPage.BasePageView.AddChidren(addInputType);
                addInputType.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            #endregion
            #region  目标
            ///就执行View
            LogicView.AddOutputInputTextView addOutpuTextView = new LogicView.AddOutputInputTextView();
            addOutpuTextView.btnIf.TextID = StringId.isExecuted;
            viewLayout.AddChidren(addOutpuTextView.FLayoutView(54, 20));
            ///以下动作View
            LogicView.LogicTypeTitleView titleOutpu = new LogicView.LogicTypeTitleView();
            titleOutpu.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
            titleOutpu.btnText.TextID = StringId.theFollowingActions;
            viewLayout.AddChidren(titleOutpu.FLayoutView());
            //目标处理方法
            InpOrOutLogicMethod.OutputTarget(this, viewLayout);
            ///添加图标的View
            LogicView.LogicAddView addOutputIcon = new LogicView.LogicAddView();
            addOutputIcon.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
            viewLayout.AddChidren(addOutputIcon.FLayoutView());
            addOutputIcon.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                var addTarget = new AddTarget();
                MainPage.BasePageView.AddChidren(addTarget);
                addTarget.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            #endregion
            #region  循环方式
            ///循环方式iew
            LogicView.AddOutputInputTextView cyclicTextView = new LogicView.AddOutputInputTextView();
            cyclicTextView.btnIf.TextID = StringId.cyclic;
            viewLayout.AddChidren(cyclicTextView.FLayoutView(54, 20));
            ///选择周期类型View
            LogicView.LogicTypeTitleView cyclicTitle = new LogicView.LogicTypeTitleView();
            cyclicTitle.frameLayout.Height = Application.GetRealHeight(50);
            cyclicTitle.frameLayout.Radius = (uint)Application.GetRealHeight(12);
            cyclicTitle.btnText.TextID = StringId.days;
            viewLayout.AddChidren(cyclicTitle.FLayoutView());
            cyclicTitle.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                FrameLayout fLayout = new FrameLayout
                {
                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                };
                this.AddChidren(fLayout);
                DateMethod(fLayout, cyclicTitle.btnText);
            };
            #endregion
            #region  执行推送 发送通知
            ///上下间隔12像素
            viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) });
            ///执行推送iew
            LogicView.LogicTypeTitleView push = new LogicView.LogicTypeTitleView();
            push.frameLayout.Height = Application.GetRealHeight(50);
            push.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
            push.btnText.TextID = StringId.push;
            viewLayout.AddChidren(push.FLayoutView());
            ///发送通知View
            LogicView.LogicTypeTitleView notification = new LogicView.LogicTypeTitleView();
            notification.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
            notification.btnText.TextID = StringId.notification;
            viewLayout.AddChidren(notification.FLayoutView());
            ///上下间隔62像素
            viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(62) });
            #endregion
            #region  保存
            ///保存View
            LogicView.SaveView saveView = new LogicView.SaveView();
            saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
            this.AddChidren(saveView.FLayoutView());
            saveView.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                Logic.currlogic.sid = "000101000000000A0A0100CC1100";
                //Logic.currlogic.sid = LogicMethod.NewSid();
                //var f = Send.AddLogic(Logic.currlogic);
                //var a = Send.getLogicIdList();
                //var d = Send.getLogic(Logic.currlogic);
               // var c = Send.delLogic(Logic.currlogic);
                var e1= Send.switchLogic(Logic.currlogic);
                //if (string.IsNullOrEmpty(Logic.currlogic.sid))
                //{
                //    List<string> list = new List<string>();
                //    foreach (var logic in Logic.LogicList)
                //    {
                //        list.Add(logic.name);
                //    }
                //    new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) =>
                //    {
                //        Logic.currlogic.name = logicName;
                //        Logic.currlogic.sid = LogicMethod.NewSid();
                //        var responsePackNew = Send.AddLogic(Logic.currlogic);
                //        if (responsePackNew.Code == "0")
                //        {
                //            Logic.LogicList.Add(Logic.currlogic);
                //            LogicMethod.RemoveAllView();
                //            MainView.MainShow();
                //        }
                //        //发送新加修改逻辑命令;
                //    });
                //}
                //else
                //{
                //    LogicMethod.RemoveAllView();
                //    MainView.MainShow();
                //    //发送新加修改逻辑命令;
                //}
            };
            #endregion
        }
        /// <summary>
        /// 循环方式(每天,每月。。)
        /// </summary>
        /// <param name="fLayout">弹框主控件</param>
        /// <param name="button">显示文本</param>
        public void DateMethod(FrameLayout fLayout, Button button)
        {
            LogicView.DateView dateView = new LogicView.DateView();
            dateView.btnTitle.TextID = StringId.cyclic;
            dateView.FLayoutView(fLayout, 4);
            dateView.btnCancel.MouseUpEventHandler += (sender2, e2) =>
            {
                //移除fLayout界面
                fLayout.RemoveFromParent();
            };
            //定义一个局部变量记录选中文本状态
            string weekName = "";
            //定义一个局部Btn用来记录选中Btn;
            var selecetdBtn = new Button();
            for (int i = 0; i < 4; i++)
            {
                LogicView.SelectTypeView dateTypeView = new LogicView.SelectTypeView();
                dateTypeView.frameLayout.BackgroundColor = CSS.CSS_Color.viewTranslucence;
                dateTypeView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
                dateTypeView.btnIcon.Visible = false;
                dateTypeView.btnText.X = Application.GetRealWidth(20);
                dateTypeView.btnNextIcon.X = Application.GetRealWidth(307);
                dateTypeView.btnLine.X = Application.GetRealWidth(20);
                dateTypeView.btnLine.Width = Application.GetRealWidth(303);
                dateView.frameLayout.AddChidren(dateTypeView.FLayoutView());
                dateTypeView.btnClick.Tag = i;//标记类型
                switch (i)
                {
                    case 0:
                        {
                            weekName = Language.StringByID(StringId.performA);
                            dateTypeView.btnNextIcon.Visible = false;
                        }
                        break;
                    case 1:
                        {
                            weekName = Language.StringByID(StringId.days);
                            dateTypeView.btnNextIcon.Visible = false;
                        }
                        break;
                    case 2:
                        {
                            weekName = Language.StringByID(StringId.weekly);
                        }
                        break;
                    case 3:
                        {
                            weekName = Language.StringByID(StringId.monthly);
                        }
                        break;
                }
                dateTypeView.btnText.Text = weekName;
                //循环类型(例如:每月,每天)点击事件
                dateTypeView.btnClick.MouseUpEventHandler += (sender, e) =>
                {
                    int clickIndex = int.Parse(dateTypeView.btnClick.Tag.ToString());
                    switch (clickIndex)
                    {
                        case 0:
                            {
                                weekName = Language.StringByID(StringId.performA);
                                selecetdBtn.TextColor = CSS.CSS_Color.textColor;
                                dateTypeView.btnText.TextColor = CSS.CSS_Color.textConfirmColor;
                                selecetdBtn = dateTypeView.btnText;
                            }
                            break;
                        case 1:
                            {
                                weekName = Language.StringByID(StringId.days);
                                selecetdBtn.TextColor = CSS.CSS_Color.textColor;
                                dateTypeView.btnText.TextColor = CSS.CSS_Color.textConfirmColor;
                                selecetdBtn = dateTypeView.btnText;
                            }
                            break;
                        case 2:
                            {
                                // weekName = Language.StringByID(StringId.weekly);
                                WeekMethod(fLayout, button);
                            }
                            break;
                        case 3:
                            {
                                //weekName = Language.StringByID(StringId.monthly);
                                MonMethod(fLayout, button);
                            }
                            break;
                    }
                };
                //显示之前的状态
                if (button.Text == weekName)
                {
                    dateTypeView.btnText.TextColor = CSS.CSS_Color.textConfirmColor;
                    selecetdBtn = dateTypeView.btnText;
                }
                else if (button.Text == weekName)
                {
                    dateTypeView.btnText.TextColor = CSS.CSS_Color.textConfirmColor;
                    selecetdBtn = dateTypeView.btnText;
                }
            }
            //确定保存
            dateView.btnConfirm.MouseUpEventHandler += (sender3, e3) =>
            {
                if (weekName == Language.StringByID(StringId.monthly)|| weekName== Language.StringByID(StringId.weekly)) {
                    //提示:还未选
                    return;
                }
                if (weekName == Language.StringByID(StringId.performA))
                {
                    //执行一次
                    Logic.currlogic.cycle.type = "once";
                }
                else if (weekName == Language.StringByID(StringId.days))
                {
                    //每天
                    Logic.currlogic.cycle.type = "day";
                }
                //选中保存之后显示文本
                button.Text = weekName;
                //移除fLayout界面
                fLayout.RemoveFromParent();
            };
        }
        /// <summary>
        /// 选中星期几(周一,周二 。。。)
        /// </summary>
        /// <param name="fLayout">弹框主控件</param>
        /// <param name="button">显示文本</param>
        public void WeekMethod(FrameLayout fLayout, Button button)
        {
            LogicView.DateView weekView = new LogicView.DateView();
            weekView.btnTitle.TextID = StringId.cyclic;
            weekView.FLayoutView(fLayout, 7);
            weekView.btnCancel.MouseUpEventHandler += (sender2, e2) =>
            {
                weekView.frameLayout.RemoveFromParent();
            };
            //定义一个局部weekList列表用来记录选中数据;
            List<string> weekList = new List<string>();
            if (Logic.currlogic.cycle.type == "week")
            {
                //加载之前保存的数据
                weekList.AddRange(Logic.currlogic.cycle.value);
            }
            //定义一个局部变量记录选中文本状态
            string weekName = "";
            for (int i = 0; i < 7; i++)
            {
                LogicView.SelectTypeView weekTypeView = new LogicView.SelectTypeView();
                weekTypeView.frameLayout.BackgroundColor = CSS.CSS_Color.viewTranslucence;
                weekTypeView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
                weekTypeView.btnIcon.Visible = false;
                weekTypeView.btnText.X = Application.GetRealWidth(20);
                weekTypeView.btnLine.X = Application.GetRealWidth(20);
                weekTypeView.btnLine.Width = Application.GetRealWidth(303);
                weekTypeView.btnNextIcon.X = Application.GetRealWidth(303);
                weekTypeView.btnNextIcon.Width = Application.GetMinRealAverage(28);
                weekTypeView.btnNextIcon.Height = Application.GetMinRealAverage(28);
                weekTypeView.btnNextIcon.UnSelectedImagePath = "LogicIcon/weekoff.png";
                weekTypeView.btnNextIcon.SelectedImagePath = "LogicIcon/weekon.png";
                weekView.frameLayout.AddChidren(weekTypeView.FLayoutView());
                weekTypeView.btnClick.Tag = i;//标记索引
                switch (i)
                {
                    case 0:
                        {
                            weekName = Language.StringByID(StringId.monday);
                        }
                        break;
                    case 1:
                        {
                            weekName = Language.StringByID(StringId.tuesday);
                        }
                        break;
                    case 2:
                        {
                            weekName = Language.StringByID(StringId.wednesday);
                        }
                        break;
                    case 3:
                        {
                            weekName = Language.StringByID(StringId.thursday);
                        }
                        break;
                    case 4:
                        {
                            weekName = Language.StringByID(StringId.friday);
                        }
                        break;
                    case 5:
                        {
                            weekName = Language.StringByID(StringId.saturday);
                        }
                        break;
                    case 6:
                        {
                            weekName = Language.StringByID(StringId.sunday);
                        }
                        break;
                }
                weekTypeView.btnText.Text = weekName;
                if (weekList.Contains(i.ToString()))
                {
                    //显示之前的选中状态
                    weekTypeView.btnNextIcon.IsSelected = true;
                }
                //星期的点击事件
                weekTypeView.btnClick.MouseUpEventHandler += (sender, e) =>
                {
                    string clickIndex = weekTypeView.btnClick.Tag.ToString();
                    weekTypeView.btnClick.IsSelected = !weekTypeView.btnClick.IsSelected;
                    if (weekTypeView.btnClick.IsSelected)
                    {
                        weekTypeView.btnNextIcon.IsSelected = true;
                        if (!weekList.Contains(clickIndex))
                        {
                            //添加选中数据
                            weekList.Add(clickIndex);
                        }
                    }
                    else
                    {
                        weekTypeView.btnNextIcon.IsSelected = false;
                        if (weekList.Contains(clickIndex))
                        {
                            //移除选中数据
                            weekList.Remove(clickIndex);
                        }
                    }
                };
            }
            //确定点击事件
            weekView.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
            {
                if (weekList.Count == 0)
                {
                    //提示:还没选中执行周期
                    return;
                }
                Logic.currlogic.cycle.type = "week";
                Logic.currlogic.cycle.value = weekList;
                button.Text = MainView.GetWeekString(weekList);
                fLayout.RemoveFromParent();
            };
        }
        /// <summary>
        /// 每月
        /// </summary>
        /// <param name="fLayout">弹框主控件</param>
        /// <param name="button">显示文本</param>
        public void MonMethod(FrameLayout fLayout, Button button)
        {
            LogicView.MonView monView = new LogicView.MonView();
            monView.btnTitle.TextID = StringId.monthly;
            monView.FLayoutView(fLayout);
            monView.btnCancel.MouseUpEventHandler += (sender2, e2) =>
            {
                monView.frameLayout.RemoveFromParent();
            };
            //定义一个局部monList列表用来记录选中数据;
            List<string> monList = new List<string>();
            if (Logic.currlogic.cycle.type == "mon")
            {
                //加载之前保存的数据
                monList.AddRange(Logic.currlogic.cycle.value);
            }
            //定义一个变量记录行数
            int lineSun = 0;
            for (int i = 1; i < 32; i++)
            {
                Button monTextBtn = new Button
                {
                    Width = Application.GetMinRealAverage(30),
                    Height = Application.GetMinRealAverage(30),
                    Radius = (uint)Application.GetRealHeight(15),
                    Text = i.ToString(),
                    TextSize = LogicView.TextSize.text14,
                    TextColor = CSS.CSS_Color.textColor,
                    SelectedTextColor = CSS.CSS_Color.view,
                    SelectedBackgroundColor = CSS.CSS_Color.textConfirmColor,
                    BackgroundColor = CSS.CSS_Color.viewTranslucence,
                    Tag = i,
                };
                monView.frameLayout.AddChidren(monTextBtn);
                if (lineSun > 0)
                {
                    monTextBtn.X = Application.GetRealWidth(16 + ((i - 1) - lineSun * 7) * 46);
                }
                else
                {
                    monTextBtn.X = Application.GetRealWidth(16 + (i - 1) * 46);
                }
                monTextBtn.Y = Application.GetRealWidth(58 + 10 + lineSun * (30 + 10));
                if (i % 7 == 0)
                {
                    //一定执行完再判断是否要换行.
                    lineSun = lineSun + 1;
                }
                monTextBtn.MouseUpEventHandler += (sender, e) =>
                {
                    string clickIndex = monTextBtn.Tag.ToString();
                    monTextBtn.IsSelected = !monTextBtn.IsSelected;
                    if (monTextBtn.IsSelected)
                    {
                        monTextBtn.IsSelected = true;
                        if (!monList.Contains(clickIndex))
                        {
                            //添加选中数据
                            monList.Add(clickIndex);
                        }
                    }
                    else
                    {
                        monTextBtn.IsSelected = false;
                        if (monList.Contains(clickIndex))
                        {
                            //移除选中数据
                            monList.Remove(clickIndex);
                        }
                    }
                };
                if (monList.Contains(i.ToString())) {
                    monTextBtn.IsSelected = true;
                }
            }
            //确定点击事件
            monView.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
            {
                if (monList.Count == 0)
                {
                    //提示:还没选中执行周期
                    return;
                }
                Logic.currlogic.cycle.type = "mon";
                Logic.currlogic.cycle.value = monList;
                button.Text = MainView.GetMonString(monList);
                fLayout.RemoveFromParent();
            };
        }
        /// <summary>
        /// 满足条件
        /// </summary>
        /// <param name="fLayout">弹框主控件</param>
        /// <param name="button">显示文本</param>
        public void AndOrMethod(FrameLayout fLayout, Button button)
        {
            LogicView.DateView meetTheConditionView = new LogicView.DateView();
            meetTheConditionView.btnTitle.TextID = StringId.meetTheCondition;
            meetTheConditionView.FLayoutView(fLayout, 2);
            meetTheConditionView.btnCancel.MouseUpEventHandler += (sender2, e2) =>
            {
                fLayout.RemoveFromParent();
            };
            //定义一个局部变量记录选中文本状态
            string condition = "";
            LogicView.SelectTypeView andConditionViews = new LogicView.SelectTypeView();
            andConditionViews.frameLayout.BackgroundColor = CSS.CSS_Color.viewTranslucence;
            andConditionViews.frameLayout.Y = Application.GetRealHeight(56);
            andConditionViews.btnIcon.Visible = false;
            andConditionViews.btnText.X = Application.GetRealWidth(20);
            andConditionViews.btnText.TextID = StringId.andCondition;
            andConditionViews.btnLine.X = Application.GetRealWidth(20);
            andConditionViews.btnLine.Width = Application.GetRealWidth(303);
            andConditionViews.btnNextIcon.X = Application.GetRealWidth(303);
            andConditionViews.btnNextIcon.Width = Application.GetMinRealAverage(28);
            andConditionViews.btnNextIcon.Height = Application.GetMinRealAverage(28);
            andConditionViews.btnNextIcon.UnSelectedImagePath = "LogicIcon/weekoff.png";
            andConditionViews.btnNextIcon.SelectedImagePath = "LogicIcon/weekon.png";
            meetTheConditionView.frameLayout.AddChidren(andConditionViews.FLayoutView());
            LogicView.SelectTypeView orConditionView = new LogicView.SelectTypeView();
            orConditionView.frameLayout.BackgroundColor = CSS.CSS_Color.viewTranslucence;
            orConditionView.frameLayout.Y = Application.GetRealHeight(56 + 50);
            orConditionView.btnIcon.Visible = false;
            orConditionView.btnText.X = Application.GetRealWidth(20);
            orConditionView.btnText.TextID = StringId.orCondition;
            orConditionView.btnLine.X = Application.GetRealWidth(20);
            orConditionView.btnLine.Width = Application.GetRealWidth(303);
            orConditionView.btnNextIcon.X = Application.GetRealWidth(303);
            orConditionView.btnNextIcon.Width = Application.GetMinRealAverage(28);
            orConditionView.btnNextIcon.Height = Application.GetMinRealAverage(28);
            orConditionView.btnNextIcon.UnSelectedImagePath = "LogicIcon/weekoff.png";
            orConditionView.btnNextIcon.SelectedImagePath = "LogicIcon/weekon.png";
            meetTheConditionView.frameLayout.AddChidren(orConditionView.FLayoutView());
            if (Logic.currlogic.relation == "and")
            {
                andConditionViews.btnNextIcon.IsSelected = true;
                condition = "and";
            }
            else
            {
                orConditionView.btnNextIcon.IsSelected = true;
                condition = "or";
            }
            andConditionViews.btnClick.MouseUpEventHandler += (sen1, e) =>
            {
                condition = "and";
                andConditionViews.btnNextIcon.IsSelected = true;
                orConditionView.btnNextIcon.IsSelected = false;
            };
            orConditionView.btnClick.MouseUpEventHandler += (sen1, e) =>
            {
                condition = "or";
                andConditionViews.btnNextIcon.IsSelected = false;
                orConditionView.btnNextIcon.IsSelected = true;
            };
            //确定点击事件
            meetTheConditionView.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
            {
                if (string.IsNullOrEmpty(condition))
                {
                    //提示:还没选中执行周期
                    return;
                }
                Logic.currlogic.relation = condition;
                if (condition == "or")
                {
                    button.Text = Language.StringByID(StringId.orCondition);
                }
                else
                {
                    button.Text = Language.StringByID(StringId.andCondition);
                }
                fLayout.RemoveFromParent();
            };
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
New file
@@ -0,0 +1,284 @@
using System;
using System.Collections.Generic;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class AddTarget : FrameLayout
    {
        public AddTarget()
        {
            Tag = "Logic";
        }
        public void Show()
        {
            LogicView.TopView topView = new LogicView.TopView();
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
            {
                RemoveFromParent();
            };
            topView.topNameBtn.TextID = StringId.addtarget;
            FrameLayout viewLayout = new FrameLayout
            {
                Y = Application.GetRealHeight(64),
                Width = Application.GetRealWidth(LogicView.TextSize.view375),
                Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64),
                BackgroundColor = CSS.CSS_Color.viewMiddle,
            };
            this.AddChidren(viewLayout);
            #region 功能
            //功能
            LogicView.SelectTypeView functionView = new LogicView.SelectTypeView();
            functionView.btnText.TextID = StringId.funLogic;
            functionView.btnIcon.UnSelectedImagePath = "LogicIcon/functionicon.png";
            viewLayout.AddChidren(functionView.FLayoutView());
            //场景
            LogicView.SelectTypeView sceneView = new LogicView.SelectTypeView();
            sceneView.frameLayout.Y = functionView.frameLayout.Bottom;
            sceneView.btnText.TextID = StringId.Scenes;
            sceneView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
            viewLayout.AddChidren(sceneView.FLayoutView());
            //延时
            LogicView.SelectTypeView delayView = new LogicView.SelectTypeView();
            delayView.frameLayout.Y = sceneView.frameLayout.Bottom;
            delayView.btnText.TextID = StringId.delayLogic;
            delayView.btnIcon.UnSelectedImagePath = "LogicIcon/delayed.png";
            viewLayout.AddChidren(delayView.FLayoutView());
            #endregion
            #region  所有点击事件
            functionView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                FunTpye funTpye = new FunTpye();
                MainPage.BasePageView.AddChidren(funTpye);
                funTpye.Show(LogicMethod.target_if);
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            sceneView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                FrameLayout fLayout = new FrameLayout
                {
                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                };
                this.AddChidren(fLayout);
                SceneMethod(fLayout);
            };
            delayView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                FrameLayout fLayout = new FrameLayout
                {
                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                };
                this.AddChidren(fLayout);
                Delayed(fLayout,false,1000);
            };
            #endregion
        }
        /// <summary>
        /// 添加场景
        /// </summary>
        /// <param name="fLayout">弹框主控件</param>
        public void SceneMethod(FrameLayout fLayout)
        {
            LogicView.DateView dateView = new LogicView.DateView();
            dateView.btnTitle.TextID = StringId.addSceneLogic;
            dateView.FLayoutView(fLayout, 5);
            dateView.btnCancel.MouseUpEventHandler += (sender2, e2) =>
            {
                fLayout.RemoveFromParent();
            };
            VerticalRefreshLayout verticalRefresh = new VerticalRefreshLayout
            {
                Y = Application.GetRealHeight(56),
                Height = Application.GetRealHeight(50 * 5),
            };
            dateView.frameLayout.AddChidren(verticalRefresh);
            //定义一个局部变量记录选中状态
            Button buttonClick = new Button();
            HDL_ON.Entity.Scene sceneSelecetd = null;
            var sceneList = LogicMethod.GetSceneList();
            verticalRefresh.BeginHeaderRefreshingAction += () =>
            {
                //关闭刷新View;
                verticalRefresh.EndHeaderRefreshing();
            };
            for (int i = 0; i < sceneList.Count; i++)
            {
                var scene = sceneList[i];
                LogicView.SelectTypeView sceneView = new LogicView.SelectTypeView();
                sceneView.frameLayout.BackgroundColor = CSS.CSS_Color.viewTranslucence;
                sceneView.btnIcon.Visible = false;
                sceneView.btnText.X = Application.GetRealWidth(20);
                sceneView.btnText.Text = scene.name;
                sceneView.btnLine.X = Application.GetRealWidth(20);
                sceneView.btnLine.Width = Application.GetRealWidth(303);
                sceneView.btnNextIcon.X = Application.GetRealWidth(303);
                sceneView.btnNextIcon.Width = Application.GetMinRealAverage(28);
                sceneView.btnNextIcon.Height = Application.GetMinRealAverage(28);
                sceneView.btnNextIcon.UnSelectedImagePath = "LogicIcon/weekoff.png";
                sceneView.btnNextIcon.SelectedImagePath = "LogicIcon/weekon.png";
                verticalRefresh.AddChidren(sceneView.FLayoutView());
                sceneView.btnClick.Tag = scene;//标记索引
                //场景的点击事件
                sceneView.btnClick.MouseUpEventHandler += (sender, e) =>
                {
                    buttonClick.IsSelected = false;
                    sceneView.btnNextIcon.IsSelected = true;
                    buttonClick = sceneView.btnNextIcon;
                    sceneSelecetd =sceneView.btnClick.Tag as HDL_ON.Entity.Scene;
                };
            }
            //确认点击事件
            dateView.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
            {
                if (sceneSelecetd == null)
                {
                    //提示:还没选中执行周期
                    return;
                }
                Output outputDevice = new Output();
                outputDevice.target_type = "2";
                outputDevice.sid = sceneSelecetd.sid;
                //没啥作用,为了数据格式统一,发送时不再判断
                outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "scene"},{ "value", "0" } } };
                AddOutput(outputDevice);
                fLayout.RemoveFromParent();
                LogicMethod.RemoveAllView();
                AddLogic addLogic = new AddLogic();
                MainPage.BasePageView.AddChidren(addLogic);
                addLogic.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
        }
        /// <summary>
        /// 延时时间方法
        /// </summary>
        /// <param name="fLayout">在哪个界面显示</param>
        /// <param name="edit">(true=编辑;false=新建)</param>
        /// <param name="index">编辑条件的索引</param>
        public void Delayed(FrameLayout fLayout, bool edit, int index)
        {
            LogicView.TimeView timePointView = new LogicView.TimeView();
            timePointView.FLayoutView(fLayout);
            EventHandler<MouseEventArgs> RemovefLayout = (sender, e1) =>
            {
                //移除fLayout界面
                fLayout.RemoveFromParent();
            };
            //取消点击事件
            timePointView.btnCancel.MouseUpEventHandler += RemovefLayout;
            //加载数据界面的设置方法(列表互不联动)
            timePointView.mUIPickerView.setNPicker(timePointView.GethStringList0(), timePointView.GetmStringList(), null);
            //默认初始选中状态
            timePointView.mUIPickerView.setCurrentItems(0, 5, 0);
            //定义一个局部变量记录选中时间
            string timepoint = "00:05";
            if (edit)
            {
                Output output = Logic.currlogic.output[index];
                if (output.target_type == "3")
                {
                    List<Dictionary<string, string>> dicList = output.status as List<Dictionary<string, string>>;
                    foreach (var dic in dicList)
                    {
                        string timeValue = dic["value"];
                        int hIndex = timePointView.GetValueIndex(timeValue, 0, 1, timePointView.GethIntList0());
                        int mIndex = timePointView.GetValueIndex(timeValue, 1, 0, timePointView.GetmIntList());
                        //更新初始状态
                        timePointView.mUIPickerView.setCurrentItems(hIndex, mIndex, 0);
                        timepoint = timeValue;
                    }
                }
            }
            //选中时间回调方法,时间变化一次回调一次
            timePointView.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) =>
            {
                string hour = timePointView.GethStringList0()[index1].Split(' ')[0];
                string minuet = timePointView.GetmStringList()[index2].Split(' ')[0];
                timepoint = hour + ":" + minuet;
            };
            //确定点击事件
            timePointView.btnConfirm.MouseUpEventHandler += (sender, e3) =>
            {
                if (timepoint=="00:00") {
                    //提示
                    return;
                }
                Output outputTime= new Output();
                outputTime.sid = LogicMethod.NewSid();
                outputTime.target_type = "3";
                Dictionary<string, string> dic = new Dictionary<string, string>();
                LogicMethod.dictionary(dic, "key", "delay");
                LogicMethod.dictionary(dic, "value", timepoint);
                outputTime.status.Add(dic);
                if (edit)
                {
                    //移除旧数据
                    Logic.currlogic.output.RemoveAt(index);
                    //新数据插入旧数据的位置;
                    Logic.currlogic.output.Insert(index, outputTime);
                }
                else
                {
                    //添加一个新的时间点条件
                    AddOutput(outputTime);
                }
                fLayout.RemoveFromParent();
                LogicMethod.RemoveAllView();
                AddLogic addLogic = new AddLogic();
                MainPage.BasePageView.AddChidren(addLogic);
                addLogic.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
        }
        /// <summary>
        /// 添加目标
        /// </summary>
        /// <param name="target"></param>
        private void AddOutput(Output target)
        {
            int indexValue = -1;
            for (int i = 0; i < Logic.currlogic.output.Count; i++)
            {
                if (Logic.currlogic.output[i].sid == target.sid)
                {
                    indexValue = i;
                    break;
                }
            }
            if (indexValue != -1)
            {
                Logic.currlogic.output.RemoveAt(indexValue);
                Logic.currlogic.output.Insert(indexValue, target);
            }
            else
            {
                Logic.currlogic.output.Add(target);
            }
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/Automation/.DS_Store
Binary files differ
HDL_ON/UI/UI2/3-Intelligence/Automation/DeviceFunList.cs
New file
@@ -0,0 +1,386 @@
using System;
using Shared;
using System.Collections.Generic;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class DeviceFunList : FrameLayout
    {
        public DeviceFunList()
        {
            Tag = "Logic";
        }
        /// <summary>
        /// 表示是(条件/目标)
        /// </summary>
        private string if_type;
        public void Show(Entity.Function device, int index, bool edit, string str)
        {
            if_type = str;
            #region 界面布局
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            LogicView.TopView topView = new LogicView.TopView();
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
            {
                RemoveFromParent();
            };
            topView.topNameBtn.Text = device.name;
            FrameLayout fLayout = new FrameLayout
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(667 - 64),
            };
            this.AddChidren(fLayout);
            #endregion
            //定义一个记录选中设备状态列表;
            List<Dictionary<string, string>> dicSateteList = new List<Dictionary<string, string>>();
            //定义一个变量,记录选中状态
            string selectedState = "unknown";
            //定义一个变量,记录选中状态记录属性
            string keyVlaue = "";
            switch (device.functionType)
            {
                //开关灯光
                case FunctionType.Relay:
                    {
                        //for (int i = 0; i < device.function.Count; i++)
                        //{
                        //}
                        LogicView.SelectTypeView relayView = new LogicView.SelectTypeView();
                        relayView.btnIcon.Visible = false;
                        relayView.btnState.Visible = true;
                        relayView.btnText.TextSize = LogicView.TextSize.text16;
                        relayView.btnText.Height = Application.GetRealHeight(22);
                        relayView.btnText.TextID = StringId.switchLogic;
                        relayView.btnText.X = Application.GetRealWidth(16);
                        relayView.btnText.Width = Application.GetRealWidth(130);
                        relayView.btnLine.X = Application.GetRealWidth(16);
                        relayView.btnLine.Width = Application.GetRealWidth(343);
                        relayView.btnState.Text = "";
                        fLayout.AddChidren(relayView.FLayoutView());
                        relayView.btnClick.MouseUpEventHandler += (sender, e) =>
                        {
                            FrameLayout relayFunView = new FrameLayout
                            {
                                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                            };
                            this.AddChidren(relayFunView);
                            LogicView.SwitchView switchView = new LogicView.SwitchView();
                            switchView.FLayoutView(relayFunView, 2);
                            Button btnOn = new Button
                            {
                                TextAlignment = TextAlignment.Center,
                                TextSize = LogicView.TextSize.text16,
                                TextColor = CSS.CSS_Color.textCancelColor,
                                TextID = StringId.onLogic,
                                Height = Application.GetRealHeight(44),
                                Width = Application.GetRealWidth(343),
                            };
                            switchView.frameLayout.AddChidren(btnOn);
                            Button btnLine = new Button
                            {
                                Height = 1,
                                BackgroundColor = CSS.CSS_Color.viewLine,
                                Y = btnOn.Bottom,
                            };
                            switchView.frameLayout.AddChidren(btnLine);
                            Button btnOff = new Button
                            {
                                Y = btnLine.Bottom,
                                TextAlignment = TextAlignment.Center,
                                TextSize = LogicView.TextSize.text16,
                                TextColor = CSS.CSS_Color.textCancelColor,
                                TextID = StringId.offLogic,
                                Height = Application.GetRealHeight(44),
                                Width = Application.GetRealWidth(343),
                            };
                            switchView.frameLayout.AddChidren(btnOff);
                            Dictionary<string, string> dic = new Dictionary<string, string>();
                            switch (if_type)
                            {
                                case LogicMethod.condition_if:
                                    {
                                        LogicMethod.dictionary(dic, "key", "on_off");
                                        LogicMethod.dictionary(dic, "comparator", "=");
                                        LogicMethod.dictionary(dic, "data_type", "string");
                                        keyVlaue = "on_off";
                                    }
                                    break;
                                case LogicMethod.target_if:
                                    {
                                        LogicMethod.dictionary(dic, "key", "on_off");
                                        keyVlaue = "on_off";
                                    }
                                    break;
                            }
                            btnOn.MouseUpEventHandler += (sender2, e2) =>
                            {
                                LogicMethod.dictionary(dic, "value", "on");
                                RemView(relayFunView);
                                relayView.btnState.TextID = StringId.onLogic;
                                selectedState = device.functionType + "_on";
                                AddDictionaryData(dicSateteList, keyVlaue, dic);
                            };
                            btnOff.MouseUpEventHandler += (sender3, e3) =>
                            {
                                LogicMethod.dictionary(dic, "value", "off");
                                RemView(relayFunView);
                                relayView.btnState.TextID = StringId.offLogic;
                                selectedState = device.functionType + "_off";
                                AddDictionaryData(dicSateteList, keyVlaue, dic);
                            };
                            if (relayView.btnState.Text != "")
                            {
                                if (relayView.btnState.Text == btnOn.Text)
                                {
                                    btnOn.TextColor = CSS.CSS_Color.textConfirmColor;
                                }
                                else
                                {
                                    btnOff.TextColor = CSS.CSS_Color.textConfirmColor;
                                }
                            }
                        };
                        if (edit)
                        {
                            GetEditState(device, edit, index, relayView.btnState, null, null, null);
                        }
                    }
                    break;
            }
            #region  保存
            ///保存View
            LogicView.SaveView saveView = new LogicView.SaveView();
            saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
            saveView.btnSave.TextID = StringId.completeLogic;
            this.AddChidren(saveView.FLayoutView());
            saveView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                if (selectedState != "unknown")
                {
                    if (if_type == LogicMethod.condition_if)
                    {
                        Input inputDevice = new Input();
                        inputDevice.condition_type = "3";
                        inputDevice.sid = device.sid;
                        inputDevice.condition = dicSateteList;
                        if (edit)
                        {
                            //移除旧数据
                            Logic.currlogic.input.RemoveAt(index);
                            //新数据插入旧数据的位置;
                            Logic.currlogic.input.Insert(index, inputDevice);
                        }
                        else
                        {
                            //添加一个条件
                            AddCondition(inputDevice);
                        }
                    }
                    else
                    {
                        Output outputDevice = new Output();
                        outputDevice.target_type = "1";
                        outputDevice.sid = device.sid;
                        outputDevice.status = dicSateteList;
                        if (edit)
                        {
                            //移除旧数据
                            Logic.currlogic.output.RemoveAt(index);
                            //新数据插入旧数据的位置;
                            Logic.currlogic.output.Insert(index, outputDevice);
                        }
                        else
                        {
                            //添加一个条件
                            AddTarget(outputDevice);
                        }
                    }
                }
                else
                {
                    if (!edit)
                    {
                        //提示用户
                        return;
                    }
                    this.RemoveFromParent();
                    return;
                }
                LogicMethod.RemoveAllView();
                AddLogic addLogic = new AddLogic();
                MainPage.BasePageView.AddChidren(addLogic);
                addLogic.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            #endregion
        }
        /// <summary>
        /// 移除控件
        /// </summary>
        /// <param name="frame"></param>
        private void RemView(FrameLayout frame)
        {
            frame.RemoveFromParent();
        }
        /// <summary>
        /// 显示编辑之前的设备状态
        /// </summary>
        /// <param name="device">编辑设备</param>
        /// <param name="edit">编辑状态</param>
        /// <param name="index">编辑数据的索引</param>
        /// <param name="button1">显示Btn</param>
        /// <param name="button2">显示Btn</param>
        /// <param name="button3">显示Btn</param>
        /// <param name="button4">显示Btn</param>
        private void GetEditState(Entity.Function device, bool edit, int index, Button button1, Button button2, Button button3, Button button4)
        {
            var dicList = new List<Dictionary<string, string>>();
            switch (if_type)
            {
                case LogicMethod.condition_if:
                    {
                        Input inputs = Logic.currlogic.input[index];
                        dicList = inputs.condition as List<Dictionary<string, string>>;
                    }
                    break;
                case LogicMethod.target_if:
                    {
                        Output outputs = Logic.currlogic.output[index];
                        dicList = outputs.status as List<Dictionary<string, string>>;
                    }
                    break;
            }
            switch (device.functionType)
            {
                //开关灯光
                case FunctionType.Relay:
                    {
                        foreach (var dic in dicList)
                        {
                            string value = dic["value"];
                            if (value == "on")
                            {
                                button1.Text = Language.StringByID(StringId.onLogic);
                            }
                            else
                            {
                                button1.Text = Language.StringByID(StringId.offLogic);
                            }
                        }
                    }
                    break;
            }
        }
        /// <summary>
        /// 添加选中数据
        /// </summary>
        /// <param name="dicList">数据列表</param>
        /// <param name="keyValue">识别设备</param>
        /// <param name="dictionary">选中数据</param>
        /// <returns></returns>
        private void AddDictionaryData(List<Dictionary<string, string>> dicList, string keyValue, Dictionary<string, string> dictionary)
        {
            int indexValue = -1;
            for (int i = 0; i < dicList.Count; i++)
            {
                var dic = dicList[i];
                if (dic.ContainsValue(keyValue))
                {
                    //判断是否存在
                    indexValue = i;
                    break;
                }
            }
            if (indexValue != -1)
            {
                //存在移除
                dicList.RemoveAt(indexValue);
                //重新添加
                dicList.Insert(indexValue, dictionary);
            }
            else
            {
                //新添加
                dicList.Add(dictionary);
            }
        }
        /// <summary>
        /// 添加条件
        /// </summary>
        /// <param name="input"></param>
        private void AddCondition(Input input)
        {
            int indexValue = -1;
            for (int i = 0; i < Logic.currlogic.input.Count; i++)
            {
                if (Logic.currlogic.input[i].sid == input.sid)
                {
                    indexValue = i;
                    break;
                }
            }
            if (indexValue != -1)
            {
                Logic.currlogic.input.RemoveAt(indexValue);
                Logic.currlogic.input.Insert(indexValue, input);
            }
            else
            {
                Logic.currlogic.input.Add(input);
            }
        }
        /// <summary>
        /// 添加目标
        /// </summary>
        /// <param name="target"></param>
        private void AddTarget(Output target)
        {
            int indexValue = -1;
            for (int i = 0; i < Logic.currlogic.output.Count; i++)
            {
                if (Logic.currlogic.output[i].sid == target.sid)
                {
                    indexValue = i;
                    break;
                }
            }
            if (indexValue != -1)
            {
                Logic.currlogic.output.RemoveAt(indexValue);
                Logic.currlogic.output.Insert(indexValue, target);
            }
            else
            {
                Logic.currlogic.output.Add(target);
            }
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
New file
@@ -0,0 +1,256 @@
using System;
using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
using Shared;
using System.Collections.Generic;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class FunTpye : FrameLayout
    {
        public FunTpye()
        {
            Tag = "Logic";
        }
        /// <summary>
        /// 默认选中是房间时:全部区域
        /// </summary>
        private Entity.Room selectedRoom = new Entity.Room { sid = Language.StringByID(StringId.allAreas) };
        /// <summary>
        /// 表示是(条件/目标)
        /// </summary>
        private string if_type;
        public void Show(string str)
        {
            if_type = str;
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            LogicView.TopView topView = new LogicView.TopView();
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
            {
                RemoveFromParent();
            };
            topView.topNameBtn.TextID = StringId.selectedFunCondition;
            LogicView.FunAllAreaView funAllAreaView = new LogicView.FunAllAreaView();
            funAllAreaView.frameLayout.Y = topView.frameLayout.Bottom;
            this.AddChidren(funAllAreaView.FLayoutView());
            VerticalScrolViewLayout vv = new VerticalScrolViewLayout
            {
                Y = Application.GetRealHeight(117),
                Height = Application.GetRealHeight(667 - 117),
            };
            this.AddChidren(vv);
            //房间点击事件
            EventHandler<MouseEventArgs> roomClick = (sender, e) =>
            {
                #region 区域弹框界面
                FrameLayout fLayout = new FrameLayout
                {
                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                };
                this.AddChidren(fLayout);
                fLayout.MouseUpEventHandler += (sender1, e1) =>
                {
                    fLayout.RemoveFromParent();
                };
                FrameLayout bghFrameLyout = new FrameLayout
                {
                    X = Application.GetRealWidth(10),
                    Y = Application.GetRealHeight(103),
                    Width = Application.GetRealWidth(160),
                    Height = Application.GetRealHeight(21 + 44),
                    BackgroundImagePath = "LogicIcon/bjicon.png",
                };
                fLayout.AddChidren(bghFrameLyout);
                FrameLayout areaBgh = new FrameLayout
                {
                    X = Application.GetRealWidth(8),
                    Y = Application.GetRealHeight(14),
                    Width = Application.GetRealWidth(144),
                    Height = Application.GetRealHeight(44),
                };
                VerticalScrolViewLayout vvBgh = new VerticalScrolViewLayout
                {
                    X = Application.GetRealWidth(8),
                    Y = Application.GetRealHeight(14),
                    Width = Application.GetRealWidth(144),
                    Height = Application.GetRealHeight(44 * 5),
                };
                var roomList = LogicMethod.GetGatewayRoomList(Language.StringByID(StringId.allAreas));
                if (roomList.Count > 5)
                {
                    bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * 5);
                    bghFrameLyout.AddChidren(vvBgh);
                }
                else
                {
                    bghFrameLyout.AddChidren(areaBgh);
                    bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * roomList.Count);
                    areaBgh.Height = Application.GetRealHeight(44 * roomList.Count);
                }
                #endregion
                for (int i = 0; i < roomList.Count; i++)
                {
                    var room = roomList[i];
                    LogicView.AreaView areaView = new LogicView.AreaView();
                    if (roomList.Count > 5)
                    {
                        vvBgh.AddChidren(areaView.FLayoutView());
                    }
                    else
                    {
                        areaView.frameLayout.Y = Application.GetRealHeight(i * 44);
                        areaBgh.AddChidren(areaView.FLayoutView());
                    }
                    areaView.btnRoomName.Text = room.name;
                    areaView.btnClick.Tag = room;
                    areaView.btnClick.MouseUpEventHandler += (sender2, e2) =>
                    {
                        fLayout.RemoveFromParent();
                        funAllAreaView.btnText1.Text = (areaView.btnClick.Tag as Entity.Room).name;
                        ///切换房间默认功能类型全部;
                        funAllAreaView.btnText2.Text = Language.StringByID(StringId.allFun);
                        selectedRoom = (areaView.btnClick.Tag as Entity.Room);
                        ///获取显示设备列表
                        var list = LogicMethod.GetFunctionDeviceList(areaView.btnClick.Tag as Entity.Room,if_type);
                        DeviceListView(vv, list);
                    };
                }
            };
            funAllAreaView.btnText1.MouseUpEventHandler += roomClick;
            funAllAreaView.btnIcon1.MouseUpEventHandler += roomClick;
            //功能点击事件
            EventHandler<MouseEventArgs> funClick = (sender3, e3) =>{
                #region 区域弹框界面
                FrameLayout fLayout = new FrameLayout
                {
                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                };
                this.AddChidren(fLayout);
                fLayout.MouseUpEventHandler += (sender1, e1) =>
                {
                    fLayout.RemoveFromParent();
                };
                FrameLayout bghFrameLyout = new FrameLayout
                {
                    X = Application.GetRealWidth(10),
                    Y = Application.GetRealHeight(103),
                    Width = Application.GetRealWidth(160),
                    Height = Application.GetRealHeight(21 + 44),
                    BackgroundImagePath = "LogicIcon/bjicon.png",
                };
                fLayout.AddChidren(bghFrameLyout);
                FrameLayout areaBgh = new FrameLayout
                {
                    X = Application.GetRealWidth(8),
                    Y = Application.GetRealHeight(14),
                    Width = Application.GetRealWidth(144),
                    Height = Application.GetRealHeight(44),
                };
                VerticalScrolViewLayout vvBgh = new VerticalScrolViewLayout
                {
                    X = Application.GetRealWidth(8),
                    Y = Application.GetRealHeight(14),
                    Width = Application.GetRealWidth(144),
                    Height = Application.GetRealHeight(44 * 5),
                };
                //获取最终显示列表
                var functionList = LogicMethod.GetFunctionDeviceList(selectedRoom, if_type);
                //获取设备列表的类型(例如:灯光类,窗帘类。。。)
                var deviceTypeList = LogicMethod.GetDeviceTypeList(functionList);
                if (deviceTypeList.Count > 5)
                {
                    bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * 5);
                    bghFrameLyout.AddChidren(vvBgh);
                }
                else
                {
                    bghFrameLyout.AddChidren(areaBgh);
                    bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * deviceTypeList.Count);
                    areaBgh.Height = Application.GetRealHeight(44 * deviceTypeList.Count);
                }
                #endregion
                for (int i = 0; i < deviceTypeList.Count; i++)
                {
                    var deviceTypeName = deviceTypeList[i];
                    LogicView.AreaView areaView = new LogicView.AreaView();
                    if (deviceTypeList.Count > 5)
                    {
                        vvBgh.AddChidren(areaView.FLayoutView());
                    }
                    else
                    {
                        areaView.frameLayout.Y = Application.GetRealHeight(i * 44);
                        areaBgh.AddChidren(areaView.FLayoutView());
                    }
                    areaView.btnRoomName.Text = deviceTypeName;
                    areaView.btnClick.Tag = deviceTypeName;
                    areaView.btnClick.MouseUpEventHandler += (sender, e2) =>
                    {
                        fLayout.RemoveFromParent();
                        funAllAreaView.btnText2.Text = areaView.btnClick.Tag.ToString();
                        ///获取单个类型(例如:灯光类。。)设备FunctionType列表
                        var typeFunctionList = LogicMethod.GetDeviceTypeFunctionList(areaView.btnClick.Tag.ToString());
                        ///获取单个类型(例如:灯光类。。)显示设备列表
                        var lists = LogicMethod.GetShowDeviceList(typeFunctionList, functionList);
                        DeviceListView(vv, lists);
                    };
                }
            };
            funAllAreaView.btnText2.MouseUpEventHandler += funClick;
            funAllAreaView.btnIcon2.MouseUpEventHandler += funClick;
            ///获取显示设备列表
            var deviceList = LogicMethod.GetFunctionDeviceList(selectedRoom, if_type);
            DeviceListView(vv, deviceList);
        }
        /// <summary>
        /// 显示设备的View
        /// </summary>
        /// <param name="verticalScrolView">上下滑动</param>
        /// <param name="deviceList"></param>
        public void DeviceListView(VerticalScrolViewLayout verticalScrolView, List<HDL_ON.Entity.Function>  deviceList)
        {
            verticalScrolView.RemoveAll();
            foreach (var dev in deviceList)
            {
                LogicView.SelectTypeView funView = new LogicView.SelectTypeView();
                funView.btnText.Visible = false;
                funView.btnDeviceName.Visible = true;
                funView.btnRoomName.Visible = true;
                funView.btnLine.X = Application.GetRealWidth(16);
                funView.btnLine.Width = Application.GetRealWidth(343);
                verticalScrolView.AddChidren(funView.FLayoutView());
                funView.btnIcon.UnSelectedImagePath = LogicMethod.GetIconPath(dev.functionType);
                funView.btnDeviceName.Text = dev.name;
                funView.btnRoomName.Text = dev.GetRoomListName();
                funView.btnClick.MouseUpEventHandler += (sen,e) => {
                    DeviceFunList deviceFunList = new DeviceFunList();
                    MainPage.BasePageView.AddChidren(deviceFunList);
                    deviceFunList.Show(dev,0,false,if_type);
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
            }
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
New file
@@ -0,0 +1,262 @@
using System;
using Shared;
using System.Collections.Generic;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class InpOrOutLogicMethod
    {
        /// <summary>
        /// 输入条件处理方法
        /// </summary>
        /// <param name="thisView">当前界面</param>
        /// <param name="viewLayout">上下滑动控件</param>
        public static void InputCondition(FrameLayout thisView,VerticalScrolViewLayout viewLayout)
        {
            for (int i = 0; i < Logic.currlogic.input.Count; i++)
            {
                Input inputCondition = Logic.currlogic.input[i];
                ///各种条件的View
                LogicView.AddOutputInputView inputView = new LogicView.AddOutputInputView();
                viewLayout.AddChidren(inputView.FLayoutView());
                ///记录条件类型
                inputView.btnClick.Name = inputCondition.condition_type;
                ///记录条件索引
                inputView.btnClick.Tag = i;
                ///条件状态数组
                List<Dictionary<string, string>> dicList = inputCondition.condition as List<Dictionary<string, string>>;
                //显示条件各种类型状态
                switch (inputCondition.condition_type)
                {
                    case "1":
                        {
                            inputView.btnIcon.UnSelectedImagePath = "LogicIcon/timecondition.png";
                            foreach (var dic in dicList)
                            {
                                string value = dic["value"];
                                inputView.btnText.Text = Language.StringByID(StringId.hour) + ": " + value;
                                inputView.btnClick.AddTag("timepoint", value);
                            }
                        }
                        break;
                    case "2":
                        {
                            inputView.btnIcon.UnSelectedImagePath = "LogicIcon/timecondition.png";
                            foreach (var dic in dicList)
                            {
                                string value = dic["value"];
                                inputView.btnText.Text = Language.StringByID(StringId.timeHorizon) + ": " + value;
                                inputView.btnClick.AddTag("timeHorizon", value);
                            }
                        }
                        break;
                    case "3":
                        {
                            //用sid找到设备;
                            var device = LogicMethod.GetDevice(inputCondition.sid);
                            //用设备的functionType类型找到对应图标;
                            inputView.btnIcon.UnSelectedImagePath = LogicMethod.GetIconPath(device.functionType);
                            //显示设备名称
                            inputView.btnText.Text = device.name;
                            //改变设备名称显示控件宽度
                            inputView.btnText.Width = Application.GetRealWidth(80);
                            //区别不同设备,显示不同设备状态
                            switch (device.functionType)
                            {
                                case FunctionType.Relay:
                                    {//开关灯
                                        foreach (var dic in dicList)
                                        {
                                            string value = dic["value"];
                                            if (value == "on")
                                            {
                                                inputView.btnState.Text = Language.StringByID(StringId.onLogic);
                                            }
                                            else
                                            {
                                                inputView.btnState.Text = Language.StringByID(StringId.offLogic);
                                            }
                                        }
                                    }
                                    break;
                            }
                        }
                        break;
                }
                //再次编辑条件状态点击事件
                inputView.btnClick.MouseUpEventHandler += (sen, e) =>
                {
                    Button button = (Button)sen;
                    //找到当前编辑的索引
                    int indexVulae = int.Parse(inputView.btnClick.Tag.ToString());
                    //标记编辑状态
                    bool edit = true;
                    //表示是条件
                    string if_type = LogicMethod.condition_if;
                    switch (button.Name)
                    {
                        case "1":
                            {
                                FrameLayout fLayout = new FrameLayout
                                {
                                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                                };
                                thisView.AddChidren(fLayout);
                                TimeTpye timeTpye = new TimeTpye();
                                timeTpye.TimePoint(fLayout, edit, indexVulae);
                            }
                            break;
                        case "2":
                            {
                                FrameLayout fLayout = new FrameLayout
                                {
                                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                                };
                                thisView.AddChidren(fLayout);
                                TimeTpye timeTpye = new TimeTpye();
                                timeTpye.TimeHorizon(fLayout, edit, indexVulae);
                            }
                            break;
                        case "3":
                            {
                                //用sid找到设备;
                                var device = LogicMethod.GetDevice(inputCondition.sid);
                                DeviceFunList deviceFunList = new DeviceFunList();
                                MainPage.BasePageView.AddChidren(deviceFunList);
                                deviceFunList.Show(device, indexVulae,edit, if_type);
                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                            }
                            break;
                    }
                };
            }
        }
        /// <summary>
        /// 输出条件处理方法
        /// </summary>
        /// <param name="thisView">当前界面</param>
        /// <param name="viewLayout">上下滑动控件</param>
        public static void OutputTarget(FrameLayout thisView, VerticalScrolViewLayout viewLayout)
        {
            for (int i = 0; i < Logic.currlogic.output.Count; i++)
            {
                Output outputTarget = Logic.currlogic.output[i];
                ///各种条件的View
                LogicView.AddOutputInputView targetView = new LogicView.AddOutputInputView();
                viewLayout.AddChidren(targetView.FLayoutView());
                ///记录条件类型
                targetView.btnClick.Name = outputTarget.target_type;
                ///记录条件索引
                targetView.btnClick.Tag = i;
                ///条件状态数组
                List<Dictionary<string, string>> dicList = outputTarget.status as List<Dictionary<string, string>>;
                //显示条件各种类型状态
                switch (outputTarget.target_type)
                {
                    case "1":
                        {
                            //用sid找到设备;
                            var device = LogicMethod.GetDevice(outputTarget.sid);
                            //用设备的functionType类型找到对应图标;
                            targetView.btnIcon.UnSelectedImagePath = LogicMethod.GetIconPath(device.functionType);
                            //显示设备名称
                            targetView.btnText.Text = device.name;
                            //改变设备名称显示控件宽度
                            targetView.btnText.Width = Application.GetRealWidth(80);
                            //区别不同设备,显示不同设备状态
                            switch (device.functionType)
                            {
                                case FunctionType.Relay:
                                    {//开关灯
                                        foreach (var dic in dicList)
                                        {
                                            string value = dic["value"];
                                            if (value == "on")
                                            {
                                                targetView.btnState.Text = Language.StringByID(StringId.onLogic);
                                            }
                                            else
                                            {
                                                targetView.btnState.Text = Language.StringByID(StringId.offLogic);
                                            }
                                        }
                                    }
                                    break;
                            }
                        }
                        break;
                    case "2":
                        {
                            //用sid找到场景;
                            var scene = LogicMethod.GetSecne(outputTarget.sid);
                            targetView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
                            targetView.btnNextIcon.Visible = false;
                            //显示场景名称
                            targetView.btnText.Text = scene.name;
                        }
                        break;
                    case "3":
                        {
                            targetView.btnIcon.UnSelectedImagePath = "LogicIcon/delayed.png";
                            foreach (var dic in dicList)
                            {
                                string value = dic["value"];
                                targetView.btnText.Text =value;
                            }
                        }
                        break;
                }
                //再次编辑条件状态点击事件
                targetView.btnClick.MouseUpEventHandler += (sen, e) =>
                {
                    Button button = (Button)sen;
                    //找到当前编辑的索引
                    int indexVulae = int.Parse(targetView.btnClick.Tag.ToString());
                    //标记编辑状态
                    bool edit = true;
                    //表示是目标
                    string if_type = LogicMethod.target_if;
                    switch (button.Name)
                    {
                        case "1":
                            {
                                //用sid找到设备;
                                var device = LogicMethod.GetDevice(outputTarget.sid);
                                DeviceFunList deviceFunList = new DeviceFunList();
                                MainPage.BasePageView.AddChidren(deviceFunList);
                                deviceFunList.Show(device, indexVulae, edit, if_type);
                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                            }
                            break;
                        case "3":
                            {
                                FrameLayout fLayout = new FrameLayout
                                {
                                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                                };
                                thisView.AddChidren(fLayout);
                                AddTarget addTarget = new AddTarget();
                                addTarget.Delayed(fLayout, edit, indexVulae);
                            }
                            break;
                    }
                };
            }
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
New file
@@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    /// <summary>
    /// 逻辑存储数据对象
    /// </summary>
    public class Logic
    {
        /// <summary>
        /// 逻辑列表
        /// </summary>
        public static List<Logic> LogicList = new List<Logic>();
        /// <summary>
        /// 当前逻辑
        /// </summary>
        public static Logic currlogic;
        /// <summary>
        /// 逻辑唯一标识
        /// </summary>
        public string sid = "";
        /// <summary>
        /// 逻辑名称
        /// </summary>
        public string name = "逻辑一";
        /// <summary>
        /// 逻辑条件关系(与and:,或:or)
        /// </summary>
        public string relation = "or";
        /// <summary>
        /// 逻辑状态(true,false)
        /// </summary>
        public string enable = "true";
        /// <summary>
        /// 逻辑执行循环周期(执行一次,每天,每月,星期)
        /// </summary>
        public Cycle cycle = new Cycle();
        /// <summary>
        /// 逻辑输入条件数组
        /// </summary>
        public List<Input> input = new List<Input>();
        /// <summary>
        /// 逻辑输出目标数组
        /// </summary>
        public List<Output> output = new List<Output>();
    }
    /// <summary>
    /// 执行周期对象
    /// </summary>
    public class Cycle
    {
        /// <summary>
        /// 时间类型
        /// (执行一次:once,每天:day,每月:mon,星期:week,日期段:date_to_date)
        /// </summary>
        public string type = "day";
        public List<string> value = new List<string>();
    }
    /// <summary>
    /// 输入条件对象
    /// </summary>
    public class Input
    {
        /// <summary>
        /// 逻辑输入条件唯一标识
        /// </summary>
        public string sid = "";
        /// <summary>
        /// 逻辑输入条件类型
        /// 时间点条件=1;
        /// 时间段条件=2;
        /// 设备状态变化条件=3;
        /// 环境信息条件=4;
        /// 安防条件=5;
        /// 云端天气条件=6;
        /// 某个逻辑/场景的输出条件=7;
        /// 地理围栏=8;
        /// </summary>
        public string condition_type = "";
        public List<Dictionary<string, string>> condition = new List<Dictionary<string, string>>();
    }
    /// <summary>
    /// 输出目标对象
    /// </summary>
    public class Output
    {
        /// <summary>
        /// 逻辑输出目标唯一标识
        /// </summary>
        public string sid = "";
        /// <summary>
        /// 逻辑输出目标类型
        /// 设备=1;
        /// 场景=2;
        /// 延时=3;
        /// </summary>
        public string target_type = "";
        public List<Dictionary<string, string>> status = new List<Dictionary<string, string>>();
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
New file
@@ -0,0 +1,344 @@
using System;
using System.Collections.Generic;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class LogicMethod
    {
        /// <summary>
        /// 表示是条件
        /// </summary>
        public const string condition_if = "条件";
        /// <summary>
        /// 表示是目标
        /// </summary>
        public const string target_if = "目标";
        /// <summary>
        /// 移除所有"Logic"界面
        /// </summary>
        public static void RemoveAllView()
        {
            MainPage.BasePageView.RemoveViewByTag("Logic");
        }
        /// <summary>
        /// 生成逻辑sid方法
        /// </summary>
        public static string NewSid()
        {
            string logicId = "";
            try
            {
                string sOidBeginsWith = "000101";//厂商 + 通讯方式
                DateTime dt = DateTime.Now;
                DateTime startTime = TimeZoneInfo.ConvertTimeToUtc(new DateTime(2020, 1, 1));
                long m = (long)((dt - startTime).TotalMilliseconds / 10);
                string sTimeSpan = "00000000";
                byte[] arry = new byte[4];
                arry[0] = (byte)(m & 0xFF);
                arry[1] = (byte)((m & 0xFF00) >> 8);
                arry[2] = (byte)((m & 0xFF0000) >> 16);
                arry[3] = (byte)((m >> 24) & 0xFF);
                sTimeSpan = arry[0].ToString("X2") + arry[1].ToString("X2") + arry[2].ToString("X2") + arry[3].ToString("X2");
                if (sTimeSpan.Length > 8)
                {
                    sTimeSpan = sTimeSpan.Substring(0, 8);
                }
                else
                {
                    sTimeSpan = "00000000";
                }
                logicId = sOidBeginsWith + sTimeSpan;
                logicId += "0A";
                logicId += "0A01";
                //0A01 物模型为逻辑, 0001 表示 1 号逻辑功能
                int iTopLogicId = 1;
                Random random = new Random();
                iTopLogicId = random.Next(0, 255);
                iTopLogicId += random.Next(0, 255);
                logicId += iTopLogicId.ToString("X4");//逻辑号 两个byte
                logicId += "1100";
            }
            catch
            {
                return logicId;
            }
            return logicId;
        }
        /// <summary>
        /// 封装Dictionary对象
        /// </summary>
        /// <param name="dic">Dictionary类</param>
        /// <param name="key">健</param>
        /// <param name="value">值</param>
        public static void dictionary(Dictionary<string, string> dic, string key, string value)
        {
            if (dic.ContainsKey(key)) //判断是否存在键值
            {
                //键存在移除
                dic.Remove(key);
            }
            //添加键值
            dic.Add(key, value);
        }
        /// <summary>
        /// 获取网关房间列表
        /// </summary>
        /// <returns></returns>
        public static List<HDL_ON.Entity.Room> GetGatewayRoomList()
        {
            return HDL_ON.Entity.DB_ResidenceData.rooms;
        }
        /// <summary>
        /// 获取网关房间列表
        /// </summary>
        /// <returns></returns>
        public static List<HDL_ON.Entity.Room> GetGatewayRoomList(string name)
        {
            List<Entity.Room> roomList = new List<Entity.Room>();
            Entity.Room room1 = new Entity.Room();
            room1.name = name;//默认一个房间名为:全部区域
            room1.sid = "全部区域";//默认sid用识别该房间
            roomList.Add(room1);//默认添加到房间列表里
            var roomLists = GetGatewayRoomList();
            foreach (var room in roomLists)
            {
                roomList.Add(room);
            }
            return roomList;
        }
        /// <summary>
        /// 获取网关设备列表
        /// </summary>
        /// <returns></returns>
        public static List<HDL_ON.Entity.Function> GetGatewayDeviceList()
        {
            return HDL_ON.Entity.DB_ResidenceData.functionList.GetAllFunction();
        }
        /// <summary>
        /// 获取网关场景列表
        /// </summary>
        /// <returns></returns>
        public static List<HDL_ON.Entity.Scene> GetSceneList()
        {
           return  HDL_ON.Entity.DB_ResidenceData.functionList.scenes;
        }
        /// <summary>
        /// 获取房间的设备列表
        /// </summary>
        /// <param name="room">当前房间</param>
        /// <returns></returns>
        public static List<HDL_ON.Entity.Function> GetRoomDevice(HDL_ON.Entity.Room room)
        {
            List<HDL_ON.Entity.Function> deviceLists = new List<Entity.Function>();
            List<HDL_ON.Entity.Function> lists = GetGatewayDeviceList();
            foreach (var dev in lists)
            {
                if (dev.roomIdList.Find((id) => id == room.sid) != null)
                {
                    deviceLists.Add(dev);
                }
                if (room.sid == "全部区域")
                {
                    //房间名为全部区域时,显示网关全部设备
                    deviceLists = lists;
                }
            }
            return deviceLists;
        }
        /// <summary>
        /// 获取当个设备
        /// </summary>
        /// <param name="sid">设备唯一标识</param>
        /// <returns></returns>
        public static HDL_ON.Entity.Function GetDevice(string sid)
        {
            HDL_ON.Entity.Function device = new Entity.Function() { name= "Unknown",sid="设备不存在"};
            List<HDL_ON.Entity.Function> deviceLists = GetGatewayDeviceList();
            foreach (var dev in deviceLists)
            {
                if (dev.sid == sid)
                {
                    device = dev;
                    break;
                }
            }
            return device;
        }
        /// <summary>
        /// 获取当个场景
        /// </summary>
        /// <param name="sid">场景唯一标识</param>
        /// <returns></returns>
        public static HDL_ON.Entity.Scene GetSecne(string sid)
        {
            HDL_ON.Entity.Scene scene = new Entity.Scene() { name = "Unknown", sid = "场景不存在" };
            List<HDL_ON.Entity.Scene> sceneLists = GetSceneList();
            foreach (var sce in sceneLists)
            {
                if (sce.sid == sid)
                {
                    scene = sce;
                    break;
                }
            }
            return scene;
        }
        /// <summary>
        /// 获取房间名(即是=区域名称)
        /// </summary>
        /// <param name="device">设备</param>
        /// <returns></returns>
        public static string GetGetRoomName(HDL_ON.Entity.Function device)
        {
            string roomName = "";
            List<HDL_ON.Entity.Room> roomLists = GetGatewayRoomList();
            foreach (var dev in device.roomIdList)
            {
                var room = roomLists.Find((c) => c.sid == dev);
                if (room != null)
                {
                    roomName += room.floorName + "." + room.name + ",";
                }
            }
            return roomName.TrimEnd(',');
        }
        /// <summary>
        /// 获取设备类型图标
        /// </summary>
        /// <param name="functionType">设备类型</param>
        /// <returns></returns>
        public static string GetIconPath(FunctionType functionType)
        {
            string strPath = "";
            switch (functionType)
            {
                case FunctionType.Relay:
                    {
                        strPath = "LogicIcon/lightloguc.png";
                    }
                    break;
            }
            return strPath;
        }
        /// <summary>
        /// 设备类型的列表(灯光类,窗帘类。。。)
        /// </summary>
        /// <param name="deviceList">设备列表</param>
        /// <returns></returns>
        public static List<string> GetDeviceTypeList(List<HDL_ON.Entity.Function> deviceList)
        {
            List<string> deviceStrTypeList = new List<string>();
            deviceStrTypeList.Clear();
            var lightjosn = deviceList.Find((device) => device.functionType == FunctionType.Relay || device.functionType == FunctionType.Dimmer);
            if (lightjosn != null)
            {
                deviceStrTypeList.Add(Language.StringByID(StringId.Lights));
            }
            var curtainjosn = deviceList.Find((device) => device.functionType ==FunctionType.Curtain);
            if (curtainjosn != null)
            {
                deviceStrTypeList.Add(Language.StringByID(StringId.Curtain));
            }
            var ac = deviceList.Find((device) => device.functionType == FunctionType.AC);
            if (ac != null)
            {
                deviceStrTypeList.Add(Language.StringByID(StringId.AC));
            }
            return deviceStrTypeList;
        }
        /// <summary>
        /// 设备类型FunctionType列表
        /// </summary>
        /// <param name="deviceType">设备类型(灯光类,窗帘类。)</param>
        /// <returns></returns>
        public static List<FunctionType> GetDeviceTypeFunctionList(string deviceType)
        {
            List<FunctionType> functionTypeList = new List<FunctionType>();
            if (deviceType == Language.StringByID(StringId.Lights))
            {
                functionTypeList.Add(FunctionType.Relay);
                functionTypeList.Add(FunctionType.Dimmer);
            }
            else if (deviceType == Language.StringByID(StringId.Curtain))
            {
                functionTypeList.Add(FunctionType.Curtain);
            }
            return functionTypeList;
        }
        /// <summary>
        /// 条件/目标支持设备
        /// </summary>
        /// <returns></returns>
        public static List<FunctionType> GetSupportEquipment(string if_type)
        {
            List<FunctionType> deviceTypeList = new List<FunctionType>();
            switch (if_type) {
                case condition_if: {
                        deviceTypeList.Add(FunctionType.Relay);
                    }
                    break;
                case target_if:
                    {
                        deviceTypeList.Add(FunctionType.Relay);
                    }
                    break;
            }
            return deviceTypeList;
        }
        /// <summary>
        /// 显示的设备列表
        /// </summary>
        /// <param name="functionType">源数据列表1</param>
        /// <param name="deviceList">源数据列表2</param>
        /// <returns></returns>
        public static List<Entity.Function> GetShowDeviceList(List<FunctionType> functionType, List<HDL_ON.Entity.Function> deviceList)
        {
            List<HDL_ON.Entity.Function> devList = new List<Entity.Function>();
            foreach (var dev in deviceList)
            {
                if (functionType.Contains(dev.functionType))
                {
                    ///过滤掉不需要显示的设备
                    devList.Add(dev);
                }
            }
            return devList;
        }
        /// <summary>
        /// 返回最终支持显示出来的设备列表
        /// </summary>
        /// <param name="room">当前房间</param>
        /// <param name="str">判断符(表示=输入设备和输出设备)</param>
        /// <returns></returns>
        public static List<Entity.Function> GetFunctionDeviceList(Entity.Room room, string str)
        {
            List<FunctionType> functionTypeList = GetSupportEquipment(str);
            //返回房间设备列表
            var roomDeviceList = GetRoomDevice(room);
            //返回最终支持显示出来的设备列表
            var list = GetShowDeviceList(functionTypeList, roomDeviceList);
            return list;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputTextView.cs
New file
@@ -0,0 +1,42 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class AddOutputInputTextView
    {
        /// <summary>
        /// 主控件
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            Height = Application.GetRealHeight(46),
        };
        /// <summary>
        /// 显示(如果/就执行)
        /// </summary>
        public Button btnIf = new Button
        {
            TextSize = TextSize.text16,
            TextColor = CSS.CSS_Color.textColor,
            Width = Application.GetRealWidth(32 + 32),
            Height = Application.GetRealHeight(22),
            Y = Application.GetRealHeight(12),
            X = Application.GetRealWidth(TextSize.left16),
            TextAlignment = TextAlignment.CenterLeft,
            TextID = StringId.ifCondition,
            IsBold = true,
        };
        /// <summary>
        /// (如果/就执行)的方法
        /// </summary>
        /// <returns></returns>
        public FrameLayout FLayoutView(int flHeight,int btnY)
        {
            frameLayout.Height = Application.GetRealHeight(flHeight);
            btnIf.Y= Application.GetRealHeight(btnY);
            frameLayout.AddChidren(btnIf);
            return frameLayout;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs
New file
@@ -0,0 +1,106 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class AddOutputInputView
    {
        /// <summary>
        /// 主控件View
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            Height = Application.GetRealHeight(44),
            Width = Application.GetRealWidth(343),
           BackgroundColor= CSS.CSS_Color.view,
            X = Application.GetRealWidth(LogicView.TextSize.left16),
        };
        /// <summary>
        /// (条件或者目标)图标
        /// </summary>
        public Button btnIcon= new Button
        {
            Width= Application.GetMinRealAverage(28),
            Height =Application.GetMinRealAverage(28),
            //Y = Application.GetRealHeight(8),
            X = Application.GetRealWidth(TextSize.left12),
        };
        /// <summary>
        /// (条件或者目标)文本描述
        /// </summary>
        public Button btnText= new Button
        {
            TextSize = TextSize.text14,
            Width = Application.GetRealWidth(250),
            Height = Application.GetRealHeight(20),
            TextColor= CSS.CSS_Color.textColor,
            //Y=Application.GetRealHeight(12),
            X = Application.GetRealWidth(52),
        };
        /// <summary>
        /// (条件或者目标)设备状态文本描述
        /// </summary>
        public Button btnState = new Button
        {
            TextSize = TextSize.text12,
            Width = Application.GetRealWidth(130),
            Height = Application.GetRealHeight(17),
            TextColor = CSS.CSS_Color.textCancelColor,
            Y=Application.GetRealHeight(14),
            X = Application.GetRealWidth(165),
            TextAlignment=TextAlignment.CenterRight,
        };
        /// <summary>
        /// (条件或者目标)图标
        /// </summary>
        public Button btnNextIcon = new Button
        {
            Width = Application.GetMinRealAverage(16),
            Height = Application.GetMinRealAverage(16),
            UnSelectedImagePath = "LogicIcon/next.png",
            //Y = Application.GetRealHeight(14),
            X = Application.GetRealWidth(315),
        };
        /// <summary>
        /// 线
        /// </summary>
        public Button btnLine = new Button
        {
            Width=Application.GetRealWidth(279),
            Y = Application.GetRealHeight(44-1),
            X = Application.GetRealWidth(52),
            Height = 1,
            BackgroundColor = CSS.CSS_Color.viewLine,
        };
        public Button btnClick = new Button
        {
            Height = Application.GetRealHeight(44),
            Width = Application.GetRealWidth(343),
        };
        /// <summary>
        /// View的方法
        /// </summary>
        /// <returns></returns>
        public FrameLayout FLayoutView()
        {
            btnIcon.Gravity = Gravity.CenterVertical;
            btnText.Gravity = Gravity.CenterVertical;
            btnText.TextAlignment = TextAlignment.CenterLeft;
            btnNextIcon.Gravity = Gravity.CenterVertical;
            frameLayout.AddChidren(btnIcon);
            frameLayout.AddChidren(btnText);
            frameLayout.AddChidren(btnState);
            frameLayout.AddChidren(btnNextIcon);
            btnLine.Y = frameLayout.Height - 1;
            frameLayout.AddChidren(btnLine);
            frameLayout.AddChidren(btnClick);
            return frameLayout;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AreaView.cs
New file
@@ -0,0 +1,57 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class AreaView
    {
        /// <summary>
        /// 主控件
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            Width = Application.GetRealWidth(144),
            Height = Application.GetRealHeight(44),
        };
        /// <summary>
        /// 房间名
        /// </summary>
        public Button btnRoomName = new Button
        {
            Width = Application.GetRealWidth(100),
            Height = Application.GetRealHeight(20),
            X = Application.GetRealWidth(16),
            TextAlignment = TextAlignment.CenterLeft,
            Gravity = Gravity.CenterVertical,
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textColor,
        };
        /// <summary>
        /// 线
        /// </summary>
        public Button btnLine = new Button
        {
            Width = Application.GetRealWidth(112),
            X = Application.GetRealWidth(16),
            Height = 1,
            BackgroundColor = CSS.CSS_Color.viewLine,
        };
        public Button btnClick = new Button
        {
            Width = Application.GetRealWidth(144),
            Height = Application.GetRealHeight(44),
        };
        /// <summary>
        /// View的方法
        /// </summary>
        /// <returns></returns>
        public FrameLayout FLayoutView()
        {
            frameLayout.AddChidren(btnRoomName);
            btnLine.Y = frameLayout.Height - 1;
            frameLayout.AddChidren(btnLine);
            frameLayout.AddChidren(btnClick);
            return frameLayout;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/ConfirmPopView.cs
New file
@@ -0,0 +1,10 @@
using System;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class ConfirmPopView
    {
        public ConfirmPopView()
        {
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/DateView.cs
New file
@@ -0,0 +1,82 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class DateView
    {
        /// <summary>
        /// 主控件
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            Y = Application.GetRealHeight(460),
            Height = Application.GetRealHeight(56 + 150),
            Width = Application.GetRealWidth(343),
            X = Application.GetRealWidth(16),
            BackgroundColor = CSS.CSS_Color.view,
            Radius = (uint)Application.GetRealHeight(12),
        };
        /// <summary>
        /// 标题Btn
        /// </summary>
        public Button btnTitle = new Button
        {
            TextID = StringId.timeHorizon,
            TextSize = TextSize.text16,
            TextColor = CSS.CSS_Color.textColor,
            IsBold = true,
            Width = Application.GetRealWidth(343 - (52 + 4 + 10) * 2),
            Height = Application.GetRealHeight(22),
            Y = Application.GetRealHeight(17),
            X = Application.GetRealWidth(52 + 4 + 10)
        };
        /// <summary>
        /// 取消Btn
        /// </summary>
        public Button btnCancel = new Button
        {
            TextID = StringId.cancelSelected,
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textCancelColor,
            Width = Application.GetRealWidth(52),
            Height = Application.GetRealHeight(32),
            Y = Application.GetRealHeight(10),
            X = Application.GetRealWidth(4)
        };
        /// <summary>
        /// 确定Btn
        /// </summary>
        public Button btnConfirm = new Button
        {
            TextID = StringId.confirmSelected,
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textConfirmColor,
            Width = Application.GetRealWidth(52),
            Height = Application.GetRealHeight(32),
            X = Application.GetRealWidth(343 - 4 - 52),
            Y = Application.GetRealHeight(10),
        };
        /// <summary>
        /// View的方法
        /// </summary>
        /// <param name="fLayout"></param>
        /// <param name="i"></param>
        public void FLayoutView(FrameLayout fLayout, int i)
        {
            frameLayout.Y = Application.GetRealHeight(667 - 20 - 56 - 50 * i);
            frameLayout.Height = Application.GetRealHeight(56 + 50 * i);
            frameLayout.AddChidren(btnTitle);
            frameLayout.AddChidren(btnCancel);
            frameLayout.AddChidren(btnConfirm);
            fLayout.AddChidren(frameLayout);
            ////界面点击事件
            //fLayout.MouseUpEventHandler += (sender, e1) =>
            //{
            //    //移除fLayout界面
            //    fLayout.RemoveFromParent();
            //};
            //取消点击事件
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/EditPopView.cs
New file
@@ -0,0 +1,10 @@
using System;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class EditPopView
    {
        public EditPopView()
        {
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/FunAllAreaView.cs
New file
@@ -0,0 +1,84 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class FunAllAreaView
    {
        /// <summary>
        /// 主控件View
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            Height = Application.GetRealHeight(53),
            BackgroundColor = CSS.CSS_Color.view,
        };
        /// <summary>
        /// 第一个下拉图标
        /// </summary>
        public Button btnIcon1 = new Button
        {
            Width = Application.GetMinRealAverage(16),
            Height = Application.GetMinRealAverage(16),
            Y = Application.GetRealHeight(19),
            X = Application.GetRealWidth(TextSize.left16),
            UnSelectedImagePath = "LogicIcon/down.png",
        };
        /// <summary>
        /// 第一个文本描述
        /// </summary>
        public Button btnText1 = new Button
        {
            TextSize = TextSize.text12,
            Width = Application.GetRealWidth(70),
            Height = Application.GetRealHeight(17),
            TextColor = CSS.CSS_Color.textColor,
            Y=Application.GetRealHeight(18),
            X = Application.GetRealWidth(34),
            TextAlignment = TextAlignment.CenterLeft,
            TextID=StringId.allAreas,
        };
        /// <summary>
        /// 第二个下拉图标
        /// </summary>
        public Button btnIcon2 = new Button
        {
            Width = Application.GetMinRealAverage(16),
            Height = Application.GetMinRealAverage(16),
            Y = Application.GetRealHeight(19),
            X = Application.GetRealWidth(122),
            UnSelectedImagePath = "LogicIcon/down.png",
        };
        /// <summary>
        /// 第二个文本描述
        /// </summary>
        public Button btnText2 = new Button
        {
            TextSize = TextSize.text12,
            Width = Application.GetRealWidth(70),
            Height = Application.GetRealHeight(17),
            TextColor = CSS.CSS_Color.textColor,
            Y=Application.GetRealHeight(18),
            X = Application.GetRealWidth(140),
            TextAlignment = TextAlignment.CenterLeft,
            TextID = StringId.allFun,
        };
        /// <summary>
        ///View的方法
        /// </summary>
        /// <returns></returns>
        public FrameLayout FLayoutView()
        {
            frameLayout.AddChidren(btnIcon1);
            frameLayout.AddChidren(btnText1);
            frameLayout.AddChidren(btnIcon2);
            frameLayout.AddChidren(btnText2);
            return frameLayout;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicAddView.cs
New file
@@ -0,0 +1,45 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class LogicAddView
    {
        /// <summary>
        /// 主控件
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            Height = Application.GetRealHeight(80),
            Width = Application.GetRealWidth(343),
            BackgroundColor = CSS.CSS_Color.view,
            X = Application.GetRealWidth(LogicView.TextSize.left16),
        };
        /// <summary>
        /// 添加设备类型的图标控件
        /// </summary>
        public Button btnAddIcon= new Button
        {
            Width = Application.GetMinRealAverage(20),
            Height = Application.GetMinRealAverage(20),
            UnSelectedImagePath = "LogicIcon/addconditiontarget.png",
            Y = Application.GetRealHeight(22),
            X = Application.GetRealWidth(162),
        };
        public Button btnClick = new Button
        {
            Height = Application.GetRealHeight(80),
            Width = Application.GetRealWidth(343),
        };
        /// <summary>
        /// 返回父控件的方法
        /// </summary>
        /// <returns></returns>
        public FrameLayout FLayoutView()
        {
            frameLayout.AddChidren(btnAddIcon);
            frameLayout.AddChidren(btnClick);
            return frameLayout;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs
New file
@@ -0,0 +1,79 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class LogicTypeTitleView
    {
        /// <summary>
        /// 主控件View
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            Height = Application.GetRealHeight(44),
            Width = Application.GetRealWidth(343),
            BackgroundColor= CSS.CSS_Color.view,
            X=Application.GetRealWidth(LogicView.TextSize.left16),
           // Radius=(uint)Application.GetRealHeight(12),
        };
        /// <summary>
        /// 文本描述
        /// </summary>
        public Button btnText = new Button
        {
            TextSize = LogicView.TextSize.text14,
            Width = Application.GetRealWidth(250),
            Height = Application.GetRealHeight(20),
            TextColor = CSS.CSS_Color.textColor,
            //TextAlignment = TextAlignment.CenterLeft,
            //Y = Application.GetRealHeight(12),
            X = Application.GetRealWidth(12),
           Gravity=Gravity.CenterVertical,
        };
        /// <summary>
        /// 图标
        /// </summary>
        public Button btnNextIcon = new Button
        {
            Width = Application.GetMinRealAverage(16),
            Height = Application.GetMinRealAverage(16),
            UnSelectedImagePath = "LogicIcon/next.png",
            //Y = Application.GetRealHeight(14),
            X = Application.GetRealWidth(315),
            //Gravity = Gravity.CenterVertical,
        };
        /// <summary>
        /// 线
        /// </summary>
        public Button btnLine = new Button
        {
            Height = 1,
            Width = Application.GetRealWidth(343 - 12 - 12),
            X = Application.GetRealWidth(12),
            BackgroundColor = CSS.CSS_Color.viewLine,
        };
        public Button btnClick = new Button
        {
            Height = Application.GetRealHeight(44),
            Width = Application.GetRealWidth(343),
        };
        /// <summary>
        /// View的方法
        /// </summary>
        /// <returns></returns>
        public FrameLayout FLayoutView()
        {
            btnText.TextAlignment = TextAlignment.BottomLeft;
            btnNextIcon.Gravity = Gravity.CenterVertical;
            frameLayout.AddChidren(btnText);
            frameLayout.AddChidren(btnNextIcon);
            btnLine.Y = frameLayout.Height - 1;
            frameLayout.AddChidren(btnLine);
            frameLayout.AddChidren(btnClick);
            return frameLayout;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/MonView.cs
New file
@@ -0,0 +1,71 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class MonView
    {
        /// <summary>
        /// 主控件
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            Y = Application.GetRealHeight(379),
            Height = Application.GetRealHeight(268),
            Width = Application.GetRealWidth(343),
            X = Application.GetRealWidth(16),
            BackgroundColor = CSS.CSS_Color.view,
            Radius = (uint)Application.GetRealHeight(12),
        };
        /// <summary>
        /// 标题Btn
        /// </summary>
        public Button btnTitle = new Button
        {
            TextID = StringId.timeHorizon,
            TextSize = TextSize.text16,
            TextColor = CSS.CSS_Color.textColor,
            IsBold = true,
            Width = Application.GetRealWidth(343 - (52 + 4 + 10) * 2),
            Height = Application.GetRealHeight(22),
            Y = Application.GetRealHeight(17),
            X = Application.GetRealWidth(52 + 4 + 10)
        };
        /// <summary>
        /// 取消Btn
        /// </summary>
        public Button btnCancel = new Button
        {
            TextID = StringId.cancelSelected,
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textCancelColor,
            Width = Application.GetRealWidth(52),
            Height = Application.GetRealHeight(32),
            Y = Application.GetRealHeight(10),
            X = Application.GetRealWidth(4)
        };
        /// <summary>
        /// 确定Btn
        /// </summary>
        public Button btnConfirm = new Button
        {
            TextID = StringId.confirmSelected,
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textConfirmColor,
            Width = Application.GetRealWidth(52),
            Height = Application.GetRealHeight(32),
            X = Application.GetRealWidth(343 - 4 - 52),
            Y = Application.GetRealHeight(10),
        };
        /// <summary>
        /// View的方法
        /// </summary>
        /// <param name="fLayout"></param>
        public void FLayoutView(FrameLayout fLayout)
        {
            frameLayout.AddChidren(btnTitle);
            frameLayout.AddChidren(btnCancel);
            frameLayout.AddChidren(btnConfirm);
            fLayout.AddChidren(frameLayout);
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SaveView.cs
New file
@@ -0,0 +1,51 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class SaveView
    {
        /// <summary>
        /// 主控件View
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            Y = Application.GetRealHeight(TextSize.view667 - 76),
            Height = Application.GetRealHeight(76),
            Width = Application.GetRealWidth(TextSize.view375),
            Gravity=Gravity.BottomCenter,//置底的属性
           BackgroundColor = CSS.CSS_Color.view,
        };
        /// <summary>
        /// (条件或者目标)文本描述
        /// </summary>
        public Button btnSave= new Button
        {
            Width = Application.GetRealWidth(220),
            Height = Application.GetRealHeight(44),
            Y = Application.GetRealHeight(12),
            X = Application.GetRealWidth(78),
            TextID = StringId.save,
            TextSize = TextSize.text16,
            TextColor = CSS.CSS_Color.textWhiteColor,
            TextAlignment = TextAlignment.Center,
            BackgroundColor= CSS.CSS_Color.btnSaveBackgroundColor,
            Radius = (uint)Application.GetRealHeight(44),
        };
        public Button btnClick = new Button
        {
            Height = Application.GetRealHeight(76),
        };
        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        public FrameLayout FLayoutView()
        {
            frameLayout.AddChidren(btnSave);
            frameLayout.AddChidren(btnClick);
            return frameLayout;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SelectTypeView.cs
New file
@@ -0,0 +1,135 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class SelectTypeView
    {
        /// <summary>
        /// 主控件View
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            Height = Application.GetRealHeight(50),
            BackgroundColor = CSS.CSS_Color.view,
        };
        /// <summary>
        /// 图标
        /// </summary>
        public Button btnIcon = new Button
        {
            Width = Application.GetMinRealAverage(28),
            Height = Application.GetMinRealAverage(28),
            //Y = Application.GetRealHeight(8),
            X = Application.GetRealWidth(TextSize.left12),
        };
        /// <summary>
        /// 文本描述
        /// </summary>
        public Button btnText = new Button
        {
            TextSize = TextSize.text14,
            Width = Application.GetRealWidth(250),
            Height = Application.GetRealHeight(20),
            TextColor = CSS.CSS_Color.textColor,
            //Y=Application.GetRealHeight(12),
            X = Application.GetRealWidth(52),
        };
        /// <summary>
        /// 设备名称
        /// </summary>
        public Button btnDeviceName = new Button
        {
            Width = Application.GetRealWidth(250),
            Height = Application.GetRealHeight(20),
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textColor,
            Y =Application.GetRealHeight(6),
            X = Application.GetRealWidth(52),
            TextAlignment = TextAlignment.CenterLeft,
            Visible =false,
        };
        /// <summary>
        /// 房间名(即是=区域名称)
        /// </summary>
        public Button btnRoomName= new Button
        {
            Width = Application.GetRealWidth(250),
            Height = Application.GetRealHeight(14),
            TextSize = TextSize.text10,
            TextColor = CSS.CSS_Color.textCancelColor,
            Y=Application.GetRealHeight(30),
            X = Application.GetRealWidth(52),
            TextAlignment = TextAlignment.CenterLeft,
            Visible = false,
        };
        /// <summary>
        /// (条件或者目标)设备状态文本描述
        /// </summary>
        public Button btnState = new Button
        {
            TextSize = TextSize.text12,
            Width = Application.GetRealWidth(130),
            Height = Application.GetRealHeight(17),
            TextColor = CSS.CSS_Color.textCancelColor,
            Y = Application.GetRealHeight(17),
            X = Application.GetRealWidth(375-48-130),
            TextAlignment = TextAlignment.CenterRight,
            Visible=false,
        };
        /// <summary>
        /// 图标
        /// </summary>
        public Button btnNextIcon = new Button
        {
            Width = Application.GetMinRealAverage(16),
            Height = Application.GetMinRealAverage(16),
            UnSelectedImagePath = "LogicIcon/next.png",
            X = Application.GetRealWidth(339),
        };
        /// <summary>
        /// 线
        /// </summary>
        public Button btnLine = new Button
        {
            Width = Application.GetRealWidth(307),
            X = Application.GetRealWidth(52),
            Height = 1,
            BackgroundColor = CSS.CSS_Color.viewLine,
        };
        public Button btnClick = new Button
        {
            Height = Application.GetRealHeight(50),
        };
        /// <summary>
        /// View的方法
        /// </summary>
        /// <returns></returns>
        public FrameLayout FLayoutView()
        {
            btnIcon.Gravity = Gravity.CenterVertical;
            btnText.Gravity = Gravity.CenterVertical;
            btnText.TextAlignment = TextAlignment.CenterLeft;
            btnNextIcon.Gravity = Gravity.CenterVertical;
            frameLayout.AddChidren(btnIcon);
            frameLayout.AddChidren(btnText);
            frameLayout.AddChidren(btnDeviceName);
            frameLayout.AddChidren(btnRoomName);
            frameLayout.AddChidren(btnState);
            frameLayout.AddChidren(btnNextIcon);
            btnLine.Y = frameLayout.Height - 1;
            frameLayout.AddChidren(btnLine);
            frameLayout.AddChidren(btnClick);
            return frameLayout;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SingleLogicView.cs
New file
@@ -0,0 +1,107 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class SingleLogicView
    {
        /// <summary>
        /// 主控件View
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            X = Application.GetRealWidth(16),
            Y = Application.GetRealHeight(12),
            Width = Application.GetRealWidth(343),
            Height = Application.GetRealHeight(102),
            BackgroundColor = CSS.CSS_Color.view,
            Radius = (uint)Application.GetRealHeight(12),
        };
        /// <summary>
        /// 逻辑名称
        /// </summary>
        public Button btnLogicName = new Button
        {
            Width = Application.GetRealWidth(250),
            Height = Application.GetRealHeight(20),
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textColor,
            Y = Application.GetRealHeight(12),
            X = Application.GetRealWidth(TextSize.left12),
            TextAlignment = TextAlignment.CenterLeft,
        };
        /// <summary>
        /// 周期重复文本
        /// </summary>
        public Button btnWeekText = new Button
        {
            Width = Application.GetRealWidth(250),
            Height = Application.GetRealHeight(14),
            TextSize = TextSize.text12,
            TextColor = CSS.CSS_Color.textCancelColor,
            Y = Application.GetRealHeight(36),
            X = Application.GetRealWidth(TextSize.left12),
            TextAlignment = TextAlignment.CenterLeft,
        };
        /// <summary>
        /// 功能图标
        /// </summary>
        public Button btnStateIcon = new Button
        {
            Width = Application.GetMinRealAverage(28),
            Height = Application.GetMinRealAverage(28),
            Y = Application.GetRealHeight(8),
            X = Application.GetRealWidth(TextSize.left12),
        };
        /// <summary>
        /// 连线图标
        /// </summary>
        public Button btnLienIcon = new Button
        {
            Width = Application.GetMinRealAverage(20),
            Height = Application.GetMinRealAverage(20),
            Y = Application.GetRealHeight(66),
            X = Application.GetRealWidth(48),
        };
        /// <summary>
        /// 图标开关
        /// </summary>
        public Button btnSwitchIcon = new Button
        {
            Width = Application.GetMinRealAverage(36),
            Height = Application.GetMinRealAverage(36),
            Y = Application.GetRealHeight(58),
            X = Application.GetRealWidth(295),
            UnSelectedImagePath = "LogicIcon/off.png",
            SelectedImagePath = "LogicIcon/on.png",
        };
        /// <summary>
        /// 图标开关
        /// </summary>
        public Button btnclick= new Button
        {
            Width = Application.GetRealWidth(343),
            Height = Application.GetRealHeight(102),
        };
        /// <summary>
        /// View的方法
        /// </summary>
        /// <returns></returns>
        public FrameLayout FLayoutView()
        {
            frameLayout.AddChidren(btnLogicName);
            frameLayout.AddChidren(btnWeekText);
            frameLayout.AddChidren(btnStateIcon);
            frameLayout.AddChidren(btnLienIcon);
            frameLayout.AddChidren(btnclick);
            frameLayout.AddChidren(btnSwitchIcon);
            return frameLayout;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs
New file
@@ -0,0 +1,55 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class SwitchView
    {
        /// <summary>
        /// 主控件
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            BackgroundColor = CSS.CSS_Color.view,
            Y = Application.GetRealHeight(515),
            X = Application.GetRealWidth(16),
            Height = Application.GetRealHeight(44*44),
            Width = Application.GetRealWidth(343),
            Radius=(uint)Application.GetRealHeight(12)
        };
        /// <summary>
        /// 取消
        /// </summary>
        public Button btnCancel = new Button
        {
            TextAlignment = TextAlignment.Center,
            TextSize = TextSize.text16,
            TextColor = CSS.CSS_Color.textRedColor,
            TextID=StringId.cancelSelected,
            Y = Application.GetRealHeight(611),
            X = Application.GetRealWidth(16),
            Height = Application.GetRealHeight(44),
            Width = Application.GetRealWidth(343),
            BackgroundColor = CSS.CSS_Color.view,
            Radius = (uint)Application.GetRealHeight(12)
        };
        /// <summary>
        /// View的方法
        /// </summary>
        ///  <param name="frame">父控件</param>
        /// <param name="i">显示View数量</param>
        /// <returns></returns>
        public void FLayoutView(FrameLayout frame,int i)
        {
            frameLayout.Y = Application.GetRealHeight(603 - (44 * i));
            frameLayout.Height = Application.GetRealHeight(44 * i);
            frame.AddChidren(frameLayout);
            frame.AddChidren(btnCancel);
            btnCancel.MouseUpEventHandler += (sender1, e1) =>
            {
                frame.RemoveFromParent();
            };
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TextSize.cs
New file
@@ -0,0 +1,21 @@
using System;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public static class TextSize
    {
        public const int text10 = 10;
        public const int text12 = 12;
        public const int text14 = 14;
        public const int text16 = 16;
        public const int text18 = 18;
        public const int view375 = 375;
        public const int view667 = 667;
        public const int left16 = 16;
        public const int left12 = 12;
        public const int layout_Right16 = 16;
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeHorizonView.cs
New file
@@ -0,0 +1,98 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class TimeHorizonView : FrameLayout
    {
        /// <summary>
        /// 主控件
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            Y = Application.GetRealHeight(460),
            Height = Application.GetRealHeight(187),
            Width = Application.GetRealWidth(343),
            X = Application.GetRealWidth(16),
            BackgroundColor = CSS.CSS_Color.view,
            Radius=(uint)Application.GetRealHeight(12),
        };
        /// <summary>
        /// 标题Btn
        /// </summary>
        public Button btnTitle = new Button
        {
            TextID = StringId.timeHorizon,
            TextSize = TextSize.text16,
            TextColor = CSS.CSS_Color.textColor,
            IsBold = true,
            Width = Application.GetRealWidth(343-(52 + 4 + 10)*2),
            Height = Application.GetRealHeight(22),
            Y = Application.GetRealHeight(15),
            X = Application.GetRealWidth(52 + 4 + 10)
        };
        /// <summary>
        /// 取消Btn
        /// </summary>
        public Button btnCancel = new Button
        {
            TextID = StringId.cancelSelected,
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textCancelColor,
            Width = Application.GetRealWidth(52),
            Height = Application.GetRealHeight(32),
            Y = Application.GetRealHeight(10),
            X = Application.GetRealWidth(4)
        };
        /// <summary>
        /// 确定Btn
        /// </summary>
        public Button btnConfirm = new Button
        {
            TextID = StringId.confirmSelected,
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textConfirmColor,
            Width = Application.GetRealWidth(52),
            Height = Application.GetRealHeight(32),
            X = Application.GetRealWidth(343 - 4 - 52),
            Y = Application.GetRealHeight(10),
        };
        /// <summary>
        ///  红色提示文本
        /// </summary>
        public Button btnTip = new Button
        {
            TextID = StringId.timeTipText,
            TextSize = TextSize.text12,
            TextColor = CSS.CSS_Color.textRedColor,
            Width = Application.GetRealWidth(306),
            Height = Application.GetRealHeight(17),
            X = Application.GetRealWidth(20),
            Y = Application.GetRealHeight(58),
        };
        /// <summary>
        /// View的方法
        /// </summary>
        /// <returns></returns>
        public void FLayoutView(FrameLayout fLayout)
        {
            frameLayout.AddChidren(btnTitle);
            frameLayout.AddChidren(btnTip);
            frameLayout.AddChidren(btnCancel);
            frameLayout.AddChidren(btnConfirm);
            fLayout.AddChidren(frameLayout);
            ////界面点击事件
            //fLayout.MouseUpEventHandler += (sender, e1) =>
            //{
            //    //移除fLayout界面
            //    fLayout.RemoveFromParent();
            //};
            //取消点击事件
            btnCancel.MouseUpEventHandler += (sender, e2) =>
            {
                //移除fLayout界面
                fLayout.RemoveFromParent();
            };
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeView.cs
New file
@@ -0,0 +1,269 @@
using System;
using Shared;
using System.Collections.Generic;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class TimeView
    {
        /// <summary>
        /// 主控件
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            Y = Application.GetRealHeight(350),
            Height = Application.GetRealHeight(297),
            Width = Application.GetRealWidth(343),
            X = Application.GetRealWidth(16),
            BackgroundColor = CSS.CSS_Color.view,
            Radius=(uint)Application.GetRealHeight(12),
        };
        /// <summary>
        /// 时间控件UIPickerView
        /// </summary>
        public UIPickerView mUIPickerView = new UIPickerView
        {
            //Y = Application.GetRealHeight(44),
            Height = Application.GetRealHeight(297),
            Width = Application.GetRealWidth(343),
            BackgroundColor = CSS.CSS_Color.viewTranslucence,
        };
        /// <summary>
        /// 取消Btn
        /// </summary>
        public Button btnCancel = new Button
        {
            TextID = StringId.cancelSelected,
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textCancelColor,
            Width = Application.GetRealWidth(52),
            Height = Application.GetRealHeight(32),
            Y = Application.GetRealHeight(6),
            X = Application.GetRealWidth(8)
        };
        /// <summary>
        /// 确定Btn
        /// </summary>
        public Button btnConfirm = new Button
        {
            TextID = StringId.confirmSelected,
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textConfirmColor,
            Width = Application.GetRealWidth(52),
            Height = Application.GetRealHeight(32),
            X = Application.GetRealWidth(283),
            Y = Application.GetRealHeight(6),
        };
        /// <summary>
        ///  线
        /// </summary>
        public Button btnLine = new Button
        {
            BackgroundColor = CSS.CSS_Color.viewLine,
            Width = Application.GetRealWidth(343),
            Height = 1,
            Y = Application.GetRealWidth(44)
        };
        /// <summary>
        /// 时间View的方法
        /// </summary>
        /// <returns></returns>
        public void FLayoutView(FrameLayout fLayout)
        {
            frameLayout.AddChidren(mUIPickerView);
            frameLayout.AddChidren(btnCancel);
            frameLayout.AddChidren(btnConfirm);
            frameLayout.AddChidren(btnLine);
            fLayout.AddChidren(frameLayout);
        }
        /// <summary>
        /// 获取1-24小时列表
        /// </summary>
        /// <returns></returns>
        public List<string> GethStringList()
        {
            //初始化列表
            var hList = new List<string>();
            for (int i = 1; i < 24; i++)
            {
                if (i < 10)
                {
                    var a = "0" + i.ToString();
                    //添加数据
                    hList.Add(a + " " + Language.StringByID(StringId.h));
                }
                else
                {
                    //添加数据
                    hList.Add(i.ToString() + " " + Language.StringByID(StringId.h));
                }
            }
            return hList;
        }
        /// <summary>
        /// 获取0-23小时列表
        /// </summary>
        /// <returns></returns>
        public List<string> GethStringList0()
        {
            //初始化列表
            var hList = new List<string>();
            for (int i = 0; i < 23; i++)
            {
                if (i < 10)
                {
                    var a = "0" + i.ToString();
                    //添加数据
                    hList.Add(a + " " + Language.StringByID(StringId.h));
                }
                else
                {
                    //添加数据
                    hList.Add(i.ToString() + " " + Language.StringByID(StringId.h));
                }
            }
            return hList;
        }
        /// <summary>
        /// 获取60分钟列表
        /// </summary>
        /// <returns></returns>
        public List<string> GetmStringList()
        {
            //初始化列表
            var mList = new List<string>();
            for (int i = 0; i < 60; i++)
            {
                if (i < 10)
                {
                    var a = "0" + i.ToString();
                    //添加数据
                    mList.Add(a + " " + Language.StringByID(StringId.m));
                }
                else
                {
                    //添加数据
                    mList.Add(i.ToString() + " " + Language.StringByID(StringId.m));
                }
            }
            return mList;
        }
        /// <summary>
        /// 获取023小时列表
        /// </summary>
        /// <returns></returns>
        public List<int> GethIntList0()
        {
            //初始化列表
            var hList = new List<int>();
            for (int i = 1; i < 24; i++)
            {
                //添加数据
                hList.Add(i);
            }
            return hList;
        }
        /// <summary>
        /// 获取24小时列表
        /// </summary>
        /// <returns></returns>
        public List<int> GethIntList()
        {
            //初始化列表
            var hList = new List<int>();
            for (int i = 1; i < 24; i++)
            {
                //添加数据
                hList.Add(i);
            }
            return hList;
        }
        /// <summary>
        /// 获取60分钟列表
        /// </summary>
        /// <returns></returns>
        public List<int> GetmIntList()
        {
            //初始化列表
            var mList = new List<int>();
            for (int i = 0; i < 60; i++)
            {
                //添加数据
                mList.Add(i);
            }
            return mList;
        }
        /// <summary>
        /// 返回指定单位列表
        /// </summary>
        /// <param name="min">最小值</param>
        /// <param name="max">最大值</param>
        /// <param name="name">单位(时,分,秒)</param>
        /// <param name="digit">位数(10以下用(1位还是2位)显示)</param>
        /// <returns></returns>
        public List<string> GetStringList(int min, int max, string name, int digit)
        {
            //初始化列表
            var list = new List<string>();
            for (int i = min; i < max; i++)
            {
                if (i < 10 && digit == 2)
                {
                    var a = "0" + i.ToString();
                    //添加数据
                    list.Add(a + " " + name);
                }
                else
                {
                    //添加数据
                    list.Add(i.ToString() + " " + name);
                }
            }
            return list;
        }
        /// <summary>
        /// 获取时间值
        /// </summary>
        /// <param name="str">源数据</param>
        /// <param name="digit">返回源数据数组里面某个值索引</param>
        /// <param name="startIndex"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public int GetValueIndex(string str, int digit, int startIndex, List<int> list)
        {
            int index = 0;
            int value = 0;
            if (str.Contains(":"))
            {
                value = int.Parse(str.Split(':')[digit]);
            }
            for (int i = startIndex; i < list.Count; i++)
            {
                if (value == i)
                {
                    index = i;
                    break;
                }
            }
            return index;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
New file
@@ -0,0 +1,569 @@
using System;
using System.Collections.Generic;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class TipPopView
    {
        /// <summary>
        /// 大框圆角值
        /// </summary>
        public int RradiusFrameLayout = 15;
        /// <summary>
        /// 小框圆角值
        /// </summary>
        public int radiusEditFrameLayout = 4;
        /// <summary>
        /// 输入框
        /// </summary>
        /// <param name="titleId">标题文本</param>
        /// <param name="tnputEditTxet">显示文本</param>
        /// <param name="errorId_IsNullOrEmpty">输入框文本为空自定义提示错误文本</param>
        /// <param name="errorId_PresenceP">检索已存在名称自定义提示错误文本</param>
        /// <param name="confirmAction">回调函数</param>
        /// <param name="List">被检索列表</param>
        /// <param name="confirmAction">回调函数</param>
        public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, int errorId_PresenceP, List<string> List, Action<string> confirmAction)
        {
            Dialog dialog = new Dialog()
            {
                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
            };
            FrameLayout whiteView = new FrameLayout()
            {
                //Gravity = Gravity.Center,
                X = Application.GetRealWidth(53),
                Y = Application.GetRealHeight(264),
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealHeight(172),
                BackgroundColor = CSS_Color.view,
                BorderColor = CSS_Color.viewTranslucence,
                BorderWidth = 0,
                Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
            };
            dialog.AddChidren(whiteView);
            Button btnTitle = new Button()
            {
                Y = Application.GetRealHeight(20),
                X = Application.GetRealWidth(35),
                Height = Application.GetRealHeight(22),
                Width = Application.GetRealWidth(200),
                TextColor =CSS_Color.textConfirmColor,
                TextSize = TextSize.text16,
                TextAlignment = TextAlignment.Center,
                TextID = titleId,
            };
            whiteView.AddChidren(btnTitle);
            FrameLayout editBjView = new FrameLayout()
            {
                // Gravity = Gravity.CenterHorizontal,
                Y = btnTitle.Bottom + Application.GetRealHeight(16),
                X = Application.GetRealWidth(24),
                Width = Application.GetRealWidth(222),
                Height = Application.GetRealHeight(40),
                BackgroundColor = CSS_Color.viewMiddle,
                BorderColor = CSS_Color.viewTranslucence,
                BorderWidth = 0,
                Radius = (uint)Application.GetMinRealAverage(radiusEditFrameLayout),
            };
            whiteView.AddChidren(editBjView);
            EditText editText = new EditText()
            {
                X = Application.GetRealWidth(12),
                Y = Application.GetRealHeight(10),
                Width = Application.GetRealWidth(160),
                Height = Application.GetRealHeight(20),
                Text = tnputEditTxet,
                TextColor = CSS_Color.textColor,
                TextSize = TextSize.text14,
                TextAlignment = TextAlignment.CenterLeft,
            };
            editBjView.AddChidren(editText);
            Button clearIconBtn = new Button
            {
                X = Application.GetRealWidth(194),
                Y = Application.GetRealHeight(8),
                Width = Application.GetMinRealAverage(24),
                Height = Application.GetMinRealAverage(24),
                UnSelectedImagePath = "MusicIcon/clear.png",
            };
            editBjView.AddChidren(clearIconBtn);
            clearIconBtn.MouseUpEventHandler += (sender, e) =>
            {
                editText.Text = "";
            };
            Button btnLine = new Button()
            {
                Y = whiteView.Height - Application.GetRealHeight(44 + 1),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.viewLine,
            };
            whiteView.AddChidren(btnLine);
            Button btnCancel = new Button()
            {
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                TextColor =CSS_Color.textTipColor,
                TextSize = TextSize.text16,
                TextID = StringId.cancelMusic,
                Gravity = Gravity.BottomLeft,
            };
            whiteView.AddChidren(btnCancel);
            btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
            Button btnConfirm = new Button()
            {
                X = btnCancel.Right,
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.view,
                IsBold = true,
                TextSize = TextSize.text16,
                TextID = StringId.confirmMusic,
                BackgroundColor = CSS_Color.textConfirmColor,
                Gravity = Gravity.BottomRight,
            };
            whiteView.AddChidren(btnConfirm);
            btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
            dialog.Show();
            btnCancel.MouseUpEventHandler += (sender, e) =>
            {
                dialog.Close();
            };
            Button btnTip = new Button
            {
                Width = Application.GetRealWidth(0),
            };
            whiteView.AddChidren(btnTip);//一直错误,一直猛点,一直加控件
            btnConfirm.MouseUpEventHandler += (sender, e) =>
            {
                string listNameText = editText.Text.Trim();
                if (string.IsNullOrEmpty(listNameText) || List.Contains(listNameText))
                {
                    string tipMsgString = "";
                    if (string.IsNullOrEmpty(editText.Text.Trim()))
                    {
                        tipMsgString = Language.StringByID(errorId_IsNullOrEmpty);
                    }
                    else
                    {
                        tipMsgString = Language.StringByID(errorId_PresenceP);
                    }
                    whiteView.Height = Application.GetRealHeight(183);
                    btnLine.Y = whiteView.Height - Application.GetRealHeight(44 + 1);
                    btnCancel.Y = btnLine.Bottom;
                    btnCancel.Gravity = Gravity.BottomLeft;
                    btnConfirm.Y = btnLine.Bottom;
                    btnConfirm.Gravity = Gravity.BottomRight;
                    btnTip.X = Application.GetRealWidth(24);
                    btnTip.Y = editBjView.Bottom + Application.GetRealHeight(12);
                    btnTip.Width = Application.GetRealWidth(222);
                    btnTip.Height = Application.GetRealHeight(17);
                    btnTip.Text = tipMsgString;
                    btnTip.TextColor = CSS_Color.textRedColor;
                    btnTip.TextSize = TextSize.text12;
                    btnTip.TextAlignment = TextAlignment.CenterLeft;
                    return;
                }
                confirmAction(editText.Text.Trim());
                dialog.Close();
            };
        }
        /// <summary>
        /// 输入框
        /// </summary>
        /// <param name="titleId">标题文本</param>
        /// <param name="tnputEditTxet">显示文本</param>
        /// <param name="errorId_IsNullOrEmpty">输入框本文为空自定义提示错误文本</param>
        /// <param name="confirmAction">回调函数</param>
        public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, Action<string> confirmAction)
        {
            Dialog dialog = new Dialog()
            {
                BackgroundColor = CSS_Color.viewTrans60lucence,
            };
            FrameLayout whiteView = new FrameLayout()
            {
                //Gravity = Gravity.Center,
                X = Application.GetRealWidth(53),
                Y = Application.GetRealHeight(264),
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealHeight(172),
                BackgroundColor = CSS_Color.view,
                BorderColor = CSS_Color.viewTranslucence,
                BorderWidth = 0,
                Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
            };
            dialog.AddChidren(whiteView);
            Button btnTitle = new Button()
            {
                Y = Application.GetRealHeight(20),
                X = Application.GetRealWidth(35),
                Height = Application.GetRealHeight(22),
                Width = Application.GetRealWidth(200),
                TextColor = CSS_Color.textConfirmColor,
                TextSize = TextSize.text16,
                TextAlignment = TextAlignment.Center,
                TextID = titleId,
            };
            whiteView.AddChidren(btnTitle);
            FrameLayout editBjView = new FrameLayout()
            {
                // Gravity = Gravity.CenterHorizontal,
                Y = btnTitle.Bottom + Application.GetRealHeight(16),
                X = Application.GetRealWidth(24),
                Width = Application.GetRealWidth(222),
                Height = Application.GetRealHeight(40),
                BackgroundColor = CSS_Color.viewMiddle,
                BorderColor = CSS_Color.viewTranslucence,
                BorderWidth = 0,
                Radius = (uint)Application.GetMinRealAverage(radiusEditFrameLayout),
            };
            whiteView.AddChidren(editBjView);
            EditText editText = new EditText()
            {
                X = Application.GetRealWidth(12),
                Y = Application.GetRealHeight(10),
                Width = Application.GetRealWidth(160),
                Height = Application.GetRealHeight(20),
                Text = tnputEditTxet,
                TextColor = CSS_Color.textColor,
                TextSize = TextSize.text14,
                TextAlignment = TextAlignment.CenterLeft,
            };
            editBjView.AddChidren(editText);
            Button clearIconBtn = new Button
            {
                X = Application.GetRealWidth(194),
                Y = Application.GetRealHeight(8),
                Width = Application.GetMinRealAverage(24),
                Height = Application.GetMinRealAverage(24),
                UnSelectedImagePath = "MusicIcon/clear.png",
            };
            editBjView.AddChidren(clearIconBtn);
            clearIconBtn.MouseUpEventHandler += (sender, e) =>
            {
                editText.Text = "";
            };
            Button btnLine = new Button()
            {
                Y = whiteView.Height - Application.GetRealHeight(44 + 1),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.viewLine,
            };
            whiteView.AddChidren(btnLine);
            Button btnCancel = new Button()
            {
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.textTipColor,
                TextSize = TextSize.text16,
                TextID = StringId.cancelMusic,
                Gravity = Gravity.BottomLeft,
            };
            whiteView.AddChidren(btnCancel);
            btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
            Button btnConfirm = new Button()
            {
                X = btnCancel.Right,
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.view,
                IsBold = true,
                TextSize = TextSize.text16,
                TextID = StringId.confirmMusic,
                BackgroundColor = CSS_Color.textConfirmColor,
                Gravity = Gravity.BottomRight,
            };
            whiteView.AddChidren(btnConfirm);
            btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
            dialog.Show();
            btnCancel.MouseUpEventHandler += (sender, e) =>
            {
                dialog.Close();
            };
            Button btnTip = new Button
            {
                Width = Application.GetRealWidth(0),
            };
            whiteView.AddChidren(btnTip);//一直错误,一直猛点,一直加控件
            btnConfirm.MouseUpEventHandler += (sender, e) =>
            {
                if (string.IsNullOrEmpty(editText.Text.Trim()))
                {
                    whiteView.Height = Application.GetRealHeight(183);
                    btnLine.Y = whiteView.Height - Application.GetRealHeight(44 + 1);
                    btnCancel.Y = btnLine.Bottom;
                    btnCancel.Gravity = Gravity.BottomLeft;
                    btnConfirm.Y = btnLine.Bottom;
                    btnConfirm.Gravity = Gravity.BottomRight;
                    btnTip.X = Application.GetRealWidth(24);
                    btnTip.Y = editBjView.Bottom + Application.GetRealHeight(12);
                    btnTip.Width = Application.GetRealWidth(222);
                    btnTip.Height = Application.GetRealHeight(17);
                    btnTip.Text = Language.StringByID(errorId_IsNullOrEmpty);
                    btnTip.TextColor = CSS_Color.textRedColor;
                    btnTip.TextSize = TextSize.text12;
                    btnTip.TextAlignment = TextAlignment.CenterLeft;
                    return;
                }
                confirmAction(editText.Text.Trim());
                dialog.Close();
            };
        }
        /// <summary>
        /// 确定提示框
        /// </summary>
        /// <param name="titleId">标题文本</param>
        /// <param name="tipTxet">自定义提示文本</param>
        /// <param name="confirmAction">回调函数</param>
        public void TipBox(int titleId, int tipTxet, Action confirmAction)
        {
            Dialog dialog = new Dialog()
            {
                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
            };
            FrameLayout whiteView = new FrameLayout()
            {
                //Gravity = Gravity.Center,
                X = Application.GetRealWidth(53),
                Y = Application.GetRealHeight(264),
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealHeight(140),
                BackgroundColor = CSS_Color.view,
                BorderColor = CSS_Color.viewTranslucence,
                BorderWidth = 0,
                Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
            };
            dialog.AddChidren(whiteView);
            Button titleBtn = new Button()
            {
                Y = Application.GetRealHeight(20),
                X = Application.GetRealWidth(35),
                Height = Application.GetRealHeight(22),
                Width = Application.GetRealWidth(270 - 35 * 2),
                TextColor = CSS_Color.textConfirmColor,
                TextSize = TextSize.text16,
                TextAlignment = TextAlignment.Center,
                TextID = titleId,
            };
            whiteView.AddChidren(titleBtn);
            Button tipBtn = new Button()
            {
                Y = titleBtn.Bottom + Application.GetRealHeight(8),
                X = Application.GetRealWidth(20),
                Height = Application.GetRealHeight(22),
                Width = Application.GetRealWidth(270 - 20 * 2),
                TextColor =CSS_Color.textTipColor,
                TextSize = TextSize.text12,
                TextAlignment = TextAlignment.Center,
                TextID = tipTxet,
            };
            whiteView.AddChidren(tipBtn);
            Button btnLine = new Button()
            {
                Y = whiteView.Height - Application.GetRealHeight(44 + 1),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.viewLine,
            };
            whiteView.AddChidren(btnLine);
            Button btnCancel = new Button()
            {
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                TextColor =CSS_Color.textTipColor,
                TextSize = TextSize.text16,
                TextID = StringId.cancelMusic,
                Gravity = Gravity.BottomLeft,
            };
            whiteView.AddChidren(btnCancel);
            btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
            Button btnConfirm = new Button()
            {
                X = btnCancel.Right,
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.view,
                IsBold = true,
                TextSize = TextSize.text16,
                TextID = StringId.confirmMusic,
                BackgroundColor = CSS_Color.textConfirmColor,
                Gravity = Gravity.BottomRight,
            };
            whiteView.AddChidren(btnConfirm);
            btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
            dialog.Show();
            btnCancel.MouseUpEventHandler += (sender, e) =>
            {
                dialog.Close();
            };
            btnConfirm.MouseUpEventHandler += (sender, e) =>
            {
                confirmAction();
                dialog.Close();
            };
        }
        /// <summary>
        /// 确定提示框
        /// </summary>
        /// <param name="titleId">标题文本</param>
        /// <param name="tipTxet">自定义提示文本(换行)</param>
        /// <param name="confirmAction">回调函数</param>
        public void TipBox1(int titleId, int tipTxet, Action confirmAction)
        {
            Dialog dialog = new Dialog()
            {
                BackgroundColor = CSS_Color.viewTrans60lucence,
            };
            FrameLayout whiteView = new FrameLayout()
            {
                //Gravity = Gravity.Center,
                X = Application.GetRealWidth(53),
                Y = Application.GetRealHeight(264),
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealHeight(155),
                BackgroundColor = CSS_Color.view,
                BorderColor = CSS_Color.viewTranslucence,
                BorderWidth = 0,
                Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
            };
            dialog.AddChidren(whiteView);
            Button titleBtn = new Button()
            {
                Y = Application.GetRealHeight(20),
                X = Application.GetRealWidth(35),
                Height = Application.GetRealHeight(22),
                Width = Application.GetRealWidth(270 - 35 * 2),
                TextColor = CSS_Color.textConfirmColor,
                TextSize = TextSize.text16,
                TextAlignment = TextAlignment.Center,
                TextID = titleId,
            };
            whiteView.AddChidren(titleBtn);
            Button tipBtn = new Button()
            {
                Y = titleBtn.Bottom + Application.GetRealHeight(8),
                X = Application.GetRealWidth(20),
                Height = Application.GetRealHeight(22 + 15),
                Width = Application.GetRealWidth(270 - 20 * 2),
                TextColor = CSS_Color.textTipColor,
                TextSize = TextSize.text12,
                TextAlignment = TextAlignment.Center,
                Text = Language.StringByID(tipTxet).Replace("{\\r\\n}", "\r\n"),
                IsMoreLines = true,
            };
            whiteView.AddChidren(tipBtn);
            Button btnLine = new Button()
            {
                Y = whiteView.Height - Application.GetRealHeight(44 + 1),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.viewLine,
            };
            whiteView.AddChidren(btnLine);
            Button btnCancel = new Button()
            {
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.viewLine,
                TextSize = TextSize.text16,
                TextID = StringId.cancelMusic,
                Gravity = Gravity.BottomLeft,
            };
            whiteView.AddChidren(btnCancel);
            btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
            Button btnConfirm = new Button()
            {
                X = btnCancel.Right,
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.view,
                IsBold = true,
                TextSize = TextSize.text16,
                TextID = StringId.confirmMusic,
                BackgroundColor = CSS_Color.textConfirmColor,
                Gravity = Gravity.BottomRight,
            };
            whiteView.AddChidren(btnConfirm);
            btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
            dialog.Show();
            btnCancel.MouseUpEventHandler += (sender, e) =>
            {
                dialog.Close();
            };
            btnConfirm.MouseUpEventHandler += (sender, e) =>
            {
                confirmAction();
                dialog.Close();
            };
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TopView.cs
New file
@@ -0,0 +1,87 @@
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class TopView
    {
        #region 最上面那块控件
        /// <summary>
        /// 最上面块View
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            BackgroundColor = CSS.CSS_Color.viewTop,
            Height = Application.GetRealHeight(64),
            Width = Application.GetRealWidth(375),
        };
        /// <summary>
        /// 标题Btn
        /// </summary>
        public Button topNameBtn = new Button
        {
            TextSize = TextSize.text18,
            TextColor = CSS.CSS_Color.textColor,
            Width = Application.GetRealWidth(TextSize.view375-60-60),
            Height = Application.GetRealHeight(25),
            Y = Application.GetRealHeight(30),
            X = Application.GetRealWidth(60)
        };
        /// <summary>
        /// 后退Btn
        /// </summary>
        public Button backBtn = new Button
        {
            Width = Application.GetRealWidth(12),
            Height = Application.GetRealHeight(20),
            X = Application.GetRealWidth(TextSize.left16),
            Y = Application.GetRealHeight(32),
            UnSelectedImagePath = "LogicIcon/back.png",
        };
        /// <summary>
        /// 设置图标Btn
        /// </summary>
        public Button setBtn = new Button
        {
            Y = Application.GetRealHeight(28),
            X = Application.GetRealWidth(337),
            Width = Application.GetMinRealAverage(32),
            Height = Application.GetMinRealAverage(32),
            UnSelectedImagePath = "LogicIcon/set.png",
            Visible = false,
        };
        /// <summary>
        /// 增加热键大小Btn
        /// </summary>
        public Button clickBackBtn = new Button
        {
            Width = Application.GetRealWidth(16 + 12 + 16),
            Height = Application.GetRealHeight(64),
        };
        /// <summary>
        /// 设置图标增加热键大小
        /// </summary>
        public Button clickSetBtn = new Button
        {
            X = Application.GetRealWidth(337 - 37),
            Width = Application.GetMinRealAverage(28 + 37),
            Height = Application.GetMinRealAverage(28 + 7 + 29),
        };
        /// <summary>
        /// 最上面的那块方法
        /// </summary>
        /// <returns></returns>
        public FrameLayout FLayoutView()
        {
            frameLayout.AddChidren(topNameBtn);
            frameLayout.AddChidren(backBtn);
            frameLayout.AddChidren(setBtn);
            frameLayout.AddChidren(clickBackBtn);
            frameLayout.AddChidren(clickSetBtn);
            return frameLayout;
        }
        #endregion
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
New file
@@ -0,0 +1,193 @@
using System;
using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
using Shared;
using System.Collections.Generic;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class MainView
    {
        /// <summary>
        /// 记录逻辑自动化父控件
        /// </summary>
        public static FrameLayout automationPage;
        /// <summary>
        /// 加载逻辑列表显示界面
        /// </summary>
        public static void MainShow()
        {
            automationPage.RemoveAll();
            VerticalScrolViewLayout vv = new VerticalScrolViewLayout();
            automationPage.AddChidren(vv);
            for (int i = 0; i < Logic.LogicList.Count; i++)
            {
                var currLogic = Logic.LogicList[i];
                ///上下间隔12像素
                vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) });
                LogicView.SingleLogicView logicView = new LogicView.SingleLogicView();
                vv.AddChidren(logicView.FLayoutView());
                logicView.btnLogicName.Text = currLogic.name;
                logicView.btnWeekText.Text = GetWeekText(currLogic);
                logicView.btnclick.MouseUpEventHandler += (sen, e) =>
                {
                    Logic.currlogic = currLogic;
                    var addLogic = new AddLogic();
                    MainPage.BasePageView.AddChidren(addLogic);
                    addLogic.Show();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
                logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) =>
                {
                    logicView.btnSwitchIcon.IsSelected = !logicView.btnSwitchIcon.IsSelected;
                    if (logicView.btnSwitchIcon.IsSelected)
                    {
                        logicView.btnSwitchIcon.IsSelected = true;
                    }
                    else
                    {
                        logicView.btnSwitchIcon.IsSelected = false;
                    }
                };
                if (currLogic.enable == "true")
                {
                    logicView.btnSwitchIcon.IsSelected = true;
                }
                else
                {
                    logicView.btnSwitchIcon.IsSelected = false;
                }
            }
            if (Logic.LogicList.Count == 0)
            {
                Button btnTipNot = new Button()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Y = Application.GetRealHeight(120),
                    Width = Application.GetRealWidth(180),
                    Height = Application.GetRealWidth(180),
                    UnSelectedImagePath = "TipNot.png",
                };
                automationPage.AddChidren(btnTipNot);
                Button btnTipNotText = new Button()
                {
                    Y = btnTipNot.Bottom,
                    Height = Application.GetRealWidth(100),
                    TextID = StringId.TipNotOpen,
                    TextAlignment = TextAlignment.Center,
                    TextColor = CSS.CSS_Color.TextualColor,
                    TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel,
                };
                automationPage.AddChidren(btnTipNotText);
            }
        }
        /// <summary>
        ///  按+跳转到逻辑界面的方法
        /// </summary>
        public static void SkipAddLogicPage()
        {
            Logic.currlogic = new Logic();
            var addLogic = new AddLogic();
            MainPage.BasePageView.AddChidren(addLogic);
            addLogic.Show();
            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
        }
        /// <summary>
        ///返回循环描述文本
        /// </summary>
        /// <param name="logic"></param>
        public static string GetWeekText(Logic logic)
        {
            string weekName = "";
            /// (执行一次:once,每天:day,每月:mon,星期:week,日期段:date_to_date)
            switch (logic.cycle.type)
            {
                case "once":
                    {
                        weekName = Language.StringByID(StringId.performA);
                    }
                    break;
                case "day":
                    {
                        weekName = Language.StringByID(StringId.days);
                    }
                    break;
                case "week":
                    {
                        weekName = GetWeekString(logic.cycle.value);
                    }
                    break;
                case "mon":
                    {
                        weekName = GetMonString(logic.cycle.value);
                    }
                    break;
            }
            return weekName;
        }
        /// <summary>
        /// 获取星期的字符串
        /// </summary>
        /// <param name="weekList"></param>
        /// <returns></returns>
        public static string GetWeekString(List<string> weekList)
        {
            string weekTextName = "";
            if (weekList.Contains("0"))
            {
                weekTextName += Language.StringByID(StringId.monday) + ",";
            }
            if (weekList.Contains("1"))
            {
                weekTextName += Language.StringByID(StringId.tuesday) + ",";
            }
            if (weekList.Contains("2"))
            {
                weekTextName += Language.StringByID(StringId.wednesday) + ",";
            }
            if (weekList.Contains("3"))
            {
                weekTextName += Language.StringByID(StringId.thursday) + ",";
            }
            if (weekList.Contains("4"))
            {
                weekTextName += Language.StringByID(StringId.friday) + ",";
            }
            if (weekList.Contains("5"))
            {
                weekTextName += Language.StringByID(StringId.saturday) + ",";
            }
            if (weekList.Contains("6"))
            {
                weekTextName += Language.StringByID(StringId.sunday) + ",";
            }
            if (weekTextName == "")
            {
                return "";
            }
            return weekTextName.TrimEnd(',');
        }
        /// <summary>
        /// 获取每月的字符串
        /// </summary>
        /// <param name="monList"></param>
        /// <returns></returns>
        public static string GetMonString(List<string> monList)
        {
            string monTextName = Language.StringByID(StringId.monthly);
            for (int i = 1; i < 32; i++)
            {
                if (monList.Contains(i.ToString()))
                {
                    monTextName += i.ToString() + ",";
                }
            }
            return monTextName.TrimEnd(',');
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
New file
@@ -0,0 +1,263 @@
using System;
using System.IO;
using System.Net;
using HDL_ON.DAL.Server;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class Send
    {
        ///// <summary>
        ///// 住宅ID
        ///// </summary>
        //public static string homeId = Entity.DB_ResidenceData.residenceData.CurReginID;
        ///// <summary>
        ///// 网关ID
        ///// </summary>
        //public static string gatewayId = DriverLayer.Control.Ins.GatewayId;
        /// <summary>
        /// 住宅ID
        /// </summary>
        public static string homeId = "1333681497069043713";
        /// <summary>
        /// 网关ID
        /// </summary>
        public static string gatewayId = "1333682616549752834";
        /// <summary>
        /// 获取逻辑ID列表
        /// </summary>
        /// <returns></returns>
        public static ResponsePackNew getLogicIdList()
        {
            var jObject = new JObject { { "homeId", homeId } };
            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_List);
            return responsePackNew;
        }
        /// <summary>
        /// 获取逻辑
        /// </summary>
        /// <returns></returns>
        public static ResponsePackNew getLogic(Logic logic)
        {
            var jArray = new JArray { };
            jArray.Add(logic.sid);
            var jObject = new JObject { { "userLogicIds", jArray } };
            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Info);
            return responsePackNew;
        }
        /// <summary>
        /// 添加自动化命令
        /// </summary>
        /// <param name="logic"></param>
        /// <returns></returns>
        public static ResponsePackNew AddLogic(Logic logic)
        {
            ResponsePackNew responsePackNew = null;
            try
            {
                var cycleJObject = new JObject { };
                var cyclevaluejArray = new JArray { };
                cycleJObject.Add("type", logic.cycle.type);
                foreach (var dictionary in logic.cycle.value)
                {
                    cyclevaluejArray.Add(dictionary);
                }
                cycleJObject.Add("value", cyclevaluejArray);
                var inputArray = new JArray { };
                foreach (var dictionary in logic.input)
                {
                    var inputTypeJOb = new JObject { };
                    inputTypeJOb.Add("sid", dictionary.sid);
                    inputTypeJOb.Add("condition_type", dictionary.condition_type);
                    var conditionArray = new JArray { };
                    foreach (var dic in dictionary.condition)
                    {
                        var conditionJOb = new JObject { };
                        conditionJOb.Add("key", dic["key"]);
                        conditionJOb.Add("comparator", dic["comparator"]);
                        conditionJOb.Add("data_type", dic["data_type"]);
                        conditionJOb.Add("value", dic["value"]);
                        conditionArray.Add(conditionJOb);
                    }
                    inputTypeJOb.Add("condition",conditionArray);
                    inputArray.Add(inputTypeJOb);
                }
                var outputArray = new JArray { };
                foreach (var dictionary in logic.output)
                {
                    var outputTypeJOb = new JObject { };
                    outputTypeJOb.Add("sid", dictionary.sid);
                    outputTypeJOb.Add("target_type", dictionary.target_type);
                    var statusArray = new JArray { };
                    foreach (var dic in dictionary.status)
                    {
                        var statusJOb = new JObject { };
                        statusJOb.Add("key", dic["key"]);
                        statusJOb.Add("value", dic["value"]);
                        statusArray.Add(statusJOb);
                    }
                    outputTypeJOb.Add("status", statusArray);
                    outputArray.Add(outputTypeJOb);
                }
                var logicjArray = new JArray { };
                var logicIfon = new JObject { };
                logicIfon.Add("sid", logic.sid);
                logicIfon.Add("gatewayId", gatewayId);
                logicIfon.Add("name", logic.name);
                logicIfon.Add("relation", logic.relation);
                logicIfon.Add("enable", logic.enable);
                logicIfon.Add("cycle", cycleJObject);
                logicIfon.Add("input", inputArray);
                logicIfon.Add("output", outputArray);
                logicjArray.Add(logicIfon);
                var jObject = new JObject { { "homeId", homeId }, { "logics", logicjArray } };
                responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Add);
            }
            catch (Exception e)
            {
                var dd = e.Message;
            }
            return responsePackNew;
        }
        /// <summary>
        /// 编辑更新逻辑
        /// </summary>
        /// <param name="logic"></param>
        /// <returns></returns>
        public static ResponsePackNew updateLogic(Logic logic)
        {
            ResponsePackNew responsePackNew = null;
            try
            {
                var cycleJObject = new JObject { };
                var cyclevaluejArray = new JArray { };
                cycleJObject.Add("type", logic.cycle.type);
                foreach (var dictionary in logic.cycle.value)
                {
                    cyclevaluejArray.Add(dictionary);
                }
                cycleJObject.Add("value", cyclevaluejArray);
                var inputArray = new JArray { };
                foreach (var dictionary in logic.input)
                {
                    var inputTypeJOb = new JObject { };
                    inputTypeJOb.Add("sid", dictionary.sid);
                    inputTypeJOb.Add("condition_type", dictionary.condition_type);
                    var conditionArray = new JArray { };
                    foreach (var dic in dictionary.condition)
                    {
                        var conditionJOb = new JObject { };
                        conditionJOb.Add("key", dic["key"]);
                        conditionJOb.Add("comparator", dic["comparator"]);
                        conditionJOb.Add("data_type", dic["data_type"]);
                        conditionJOb.Add("value", dic["value"]);
                        conditionArray.Add(conditionJOb);
                    }
                    inputTypeJOb.Add("condition", conditionArray);
                    inputArray.Add(inputTypeJOb);
                }
                var outputArray = new JArray { };
                foreach (var dictionary in logic.output)
                {
                    var outputTypeJOb = new JObject { };
                    outputTypeJOb.Add("sid", dictionary.sid);
                    outputTypeJOb.Add("target_type", dictionary.target_type);
                    var statusArray = new JArray { };
                    foreach (var dic in dictionary.status)
                    {
                        var statusJOb = new JObject { };
                        statusJOb.Add("key", dic["key"]);
                        statusJOb.Add("value", dic["value"]);
                        statusArray.Add(statusJOb);
                    }
                    outputTypeJOb.Add("status", statusArray);
                    outputArray.Add(outputTypeJOb);
                }
                var logicjArray = new JArray { };
                var logicIfon = new JObject { };
                logicIfon.Add("sid", logic.sid);
                logicIfon.Add("gatewayId", gatewayId);
                logicIfon.Add("name", logic.name);
                logicIfon.Add("relation", logic.relation);
                logicIfon.Add("enable", logic.enable);
                logicIfon.Add("cycle", cycleJObject);
                logicIfon.Add("input", inputArray);
                logicIfon.Add("output", outputArray);
                logicjArray.Add(logicIfon);
                var jObject = new JObject { { "homeId", homeId }, { "logics", logicjArray } };
                responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Update);
            }
            catch (Exception e)
            {
                var dd = e.Message;
            }
            return responsePackNew;
        }
        /// <summary>
        /// 删除逻辑
        /// </summary>
        /// <returns></returns>
        public static ResponsePackNew delLogic(Logic logic)
        {
            var jArray = new JArray { };
            jArray.Add(logic.sid);
            var jObject = new JObject { { "userLogicIds", jArray } };
            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Delete);
            return responsePackNew;
        }
        /// <summary>
        /// 逻辑开关
        /// </summary>
        /// <returns></returns>
        public static ResponsePackNew switchLogic(Logic logic)
        {
            logic.enable ="false";
            var jArray = new JArray { };
            var job = new JObject { { "userLogicId", logic.sid } , { "enable", logic.enable } };
            jArray.Add(job);
            var jObject = new JObject { { "logics", jArray } };
            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Enable);
            return responsePackNew;
        }
        /// <summary>
        ///请求服务器(与住宅有关:例如;homeId)
        /// </summary>
        /// <returns></returns>
        public static ResponsePackNew RequestServerhomeId(object o, string api_Url, int mTimeout = 10)
        {
            var requestJson = HttpUtil.GetSignRequestJson(o);
            return HttpUtil.RequestHttpsPostFroHome(api_Url, requestJson, mTimeout);
        }
        /// <summary>
        /// 请求服务器
        /// </summary>
        /// <returns></returns>
        public static ResponsePackNew RequestServer(object o, string api_Url)
        {
            var requestJson = HttpUtil.GetSignRequestJson(o);
            return HttpUtil.RequestHttpsPost(api_Url, requestJson);
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs
New file
@@ -0,0 +1,114 @@
using System;
using System.Collections.Generic;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class Set:FrameLayout
    {
        public Set()
        {
            Tag = "Logic";
        }
        public void Show()
        {
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            LogicView.TopView topView = new LogicView.TopView();
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
            {
                RemoveFromParent();
            };
            topView.topNameBtn.TextID = StringId.setlogic;
            FrameLayout viewLayout = new FrameLayout
            {
                Y = Application.GetRealHeight(64),
                Width = Application.GetRealWidth(LogicView.TextSize.view375),
                Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64 - 76),
                BackgroundColor = CSS.CSS_Color.viewMiddle,
            };
            this.AddChidren(viewLayout);
            LogicView.SelectTypeView nameView = new LogicView.SelectTypeView();
            nameView.btnText.X = Application.GetRealWidth(16);
            nameView.btnText.Height = Application.GetRealHeight(22);
            nameView.btnText.TextID = StringId.namelogic;
            nameView.btnIcon.Visible = false;
            nameView.btnNextIcon.Height = Application.GetMinRealAverage(28);
            nameView.btnNextIcon.Width = Application.GetMinRealAverage(28);
            nameView.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png";
            viewLayout.AddChidren(nameView.FLayoutView());
            Button btnAutomationName = new Button
            {
                TextSize = LogicView.TextSize.text14,
                Width = Application.GetRealWidth(375 - 40 - 52),
                Height = Application.GetRealHeight(20),
                TextColor = CSS.CSS_Color.textCancelColor,
                X = Application.GetRealWidth(40),
                Gravity = Gravity.CenterVertical,
                TextAlignment = TextAlignment.CenterRight,
                Text =Logic.currlogic.name,
            };
            nameView.frameLayout.AddChidren(btnAutomationName);
            EventHandler<MouseEventArgs> editClick = (sender, e) =>
            {
                List<string> list = new List<string>();
                foreach (var logic in Logic.LogicList) {
                    list.Add(logic.name);
                }
                new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) =>
                {
                    btnAutomationName.Text = logicName;
                    Logic.currlogic.name = logicName;
                });
            };
            nameView.btnClick.MouseUpEventHandler += editClick;
            btnAutomationName.MouseUpEventHandler += editClick;
            #region  删除
            FrameLayout frameLayout = new FrameLayout
            {
                Y = Application.GetRealHeight(LogicView.TextSize.view667 - 50),
                Height = Application.GetRealHeight(50),
                BackgroundColor = CSS.CSS_Color.view,
                Gravity = Gravity.BottomCenter,//置底的属性
            };
            this.AddChidren(frameLayout);
            Button btnDel = new Button
            {
                TextSize = LogicView.TextSize.text16,
                Width = Application.GetRealWidth(50),
                Height = Application.GetRealHeight(22),
                TextColor = CSS.CSS_Color.textRedColor,
                Gravity = Gravity.Center,
                TextID = StringId.Del,
            };
            frameLayout.AddChidren(btnDel);
            EventHandler<MouseEventArgs> delClick = (sender, e) =>
            {
                new LogicView.TipPopView().TipBox(StringId.tip, StringId.delAutomation, () =>
                {
                    LogicMethod.RemoveAllView();
                    Logic.LogicList.Remove(Logic.currlogic);
                    MainView.MainShow();
                    //发送删除逻辑命令;
                });
            };
            btnDel.MouseUpEventHandler += delClick;
            frameLayout.MouseUpEventHandler += delClick;
            #endregion
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs
New file
@@ -0,0 +1,386 @@
using System;
using System.Collections.Generic;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class TimeTpye : FrameLayout
    {
        public TimeTpye()
        {
            Tag = "Logic";
        }
        public void Show()
        {
            #region  界面布局
            LogicView.TopView topView = new LogicView.TopView();
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
            {
                RemoveFromParent();
            };
            topView.topNameBtn.TextID = StringId.selectionTimeCondition;
            FrameLayout viewLayout = new FrameLayout
            {
                Y = Application.GetRealHeight(64),
                Width = Application.GetRealWidth(LogicView.TextSize.view375),
                Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64),
                BackgroundColor = CSS.CSS_Color.viewMiddle,
            };
            this.AddChidren(viewLayout);
            //时刻
            LogicView.SelectTypeView timepointView = new LogicView.SelectTypeView();
            timepointView.btnIcon.Visible = false;
            timepointView.btnText.X = Application.GetRealWidth(16);
            timepointView.btnLine.X = Application.GetRealWidth(16);
            timepointView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
            timepointView.btnText.TextID = StringId.hour;
            viewLayout.AddChidren(timepointView.FLayoutView());
            //时间范围
            LogicView.SelectTypeView timeHorizonView = new LogicView.SelectTypeView();
            timeHorizonView.frameLayout.Y = timepointView.frameLayout.Bottom;
            timeHorizonView.btnIcon.Visible = false;
            timeHorizonView.btnText.X = Application.GetRealWidth(16);
            timeHorizonView.btnLine.X = Application.GetRealWidth(16);
            timeHorizonView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
            timeHorizonView.btnText.TextID = StringId.timeHorizon;
            viewLayout.AddChidren(timeHorizonView.FLayoutView());
            #endregion
            #region  时间点  时间范围点击事件
            //时间点点击事件
            timepointView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                //主界面控件
                FrameLayout fLayout = new FrameLayout
                {
                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                };
                this.AddChidren(fLayout);
                TimePoint(fLayout, false, 100);
            };
            //时间范围点击事件
            timeHorizonView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                //主界面控件
                FrameLayout fLayout = new FrameLayout
                {
                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                };
                //添加主界面
                this.AddChidren(fLayout);
                TimeHorizon(fLayout, false, 0);
            };
            #endregion
        }
        /// <summary>
        /// 时间点方法
        /// </summary>
        /// <param name="fLayout">在哪个界面显示</param>
        /// <param name="edit">(true=编辑;false=新建)</param>
        /// <param name="index">编辑条件的索引</param>
        public void TimePoint(FrameLayout fLayout, bool edit, int index)
        {
            LogicView.TimeView timePointView = new LogicView.TimeView();
            timePointView.FLayoutView(fLayout);
            EventHandler<MouseEventArgs> RemovefLayout = (sender, e1) =>
             {
                //移除fLayout界面
                fLayout.RemoveFromParent();
             };
            //取消点击事件
            timePointView.btnCancel.MouseUpEventHandler += RemovefLayout;
            //加载数据界面的设置方法(列表互不联动)
            timePointView.mUIPickerView.setNPicker(timePointView.GethStringList(), timePointView.GetmStringList(), null);
            //默认初始选中状态
            timePointView.mUIPickerView.setCurrentItems(0, 30, 0);
            //定义一个局部变量记录选中时间
            string timepoint = "01:30";
            if (edit)
            {
                Input inputs = Logic.currlogic.input[index];
                if (inputs.condition_type == "1")
                {
                    List<Dictionary<string, string>> dicList = inputs.condition as List<Dictionary<string, string>>;
                    foreach (var dic in dicList)
                    {
                        string timeValue = dic["value"];
                        int hIndex = timePointView.GetValueIndex(timeValue, 0, 1, timePointView.GethIntList());
                        int mIndex = timePointView.GetValueIndex(timeValue, 1, 0, timePointView.GetmIntList());
                        //更新初始状态
                        timePointView.mUIPickerView.setCurrentItems(hIndex - 1, mIndex, 0);
                        timepoint = timeValue;
                    }
                }
            }
            //选中时间回调方法,时间变化一次回调一次
            timePointView.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) =>
            {
                string hour = timePointView.GethStringList()[index1].Split(' ')[0];
                string minuet = timePointView.GetmStringList()[index2].Split(' ')[0];
                timepoint = hour + ":" + minuet;
            };
            //确定点击事件
            timePointView.btnConfirm.MouseUpEventHandler += (sender, e3) =>
            {
                Input inputTime = new Input();
                inputTime.sid = LogicMethod.NewSid();
                inputTime.condition_type = "1";
                Dictionary<string, string> dic = new Dictionary<string, string>();
                LogicMethod.dictionary(dic, "key", "timepoint");
                LogicMethod.dictionary(dic, "comparator", "=");
                LogicMethod.dictionary(dic, "data_type", "string");
                LogicMethod.dictionary(dic, "value", timepoint);
                inputTime.condition.Add(dic);
                if (edit)
                {
                    //移除旧数据
                    Logic.currlogic.input.RemoveAt(index);
                    //新数据插入旧数据的位置;
                    Logic.currlogic.input.Insert(index, inputTime);
                }
                else
                {
                    //添加一个新的时间点条件
                    Logic.currlogic.input.Add(inputTime);
                }
                LogicMethod.RemoveAllView();
                AddLogic addLogic = new AddLogic();
                MainPage.BasePageView.AddChidren(addLogic);
                addLogic.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
        }
        /// <summary>
        /// 时间范围方法
        /// </summary>
        /// <param name="fLayout">在哪个界面显示</param>
        /// <param name="edit">(true=编辑;false=新建)</param>
        /// <param name="index">编辑条件的索引</param>
        public void TimeHorizon(FrameLayout fLayout,bool edit,int index)
        {
            #region 界面布局
            LogicView.TimeHorizonView timeHorizonView = new LogicView.TimeHorizonView();
            timeHorizonView.FLayoutView(fLayout);
            //开始时间
            LogicView.SelectTypeView startTimeView = new LogicView.SelectTypeView();
            startTimeView.frameLayout.Y = Application.GetRealHeight(87);
            startTimeView.btnIcon.Visible = false;
            startTimeView.btnText.X = Application.GetRealWidth(16);
            startTimeView.btnText.TextID = StringId.startTime;
            startTimeView.btnLine.X = Application.GetRealWidth(16);
            startTimeView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
            startTimeView.btnNextIcon.X = Application.GetRealWidth(307);
            timeHorizonView.frameLayout.AddChidren(startTimeView.FLayoutView());
            //显示开始时间文本
            Button btnStartTimeText = new Button
            {
                TextSize = LogicView.TextSize.text12,
                Width = Application.GetRealWidth(32 + 3),
                Height = Application.GetRealHeight(20),
                TextColor = CSS.CSS_Color.textCancelColor,
                Y = Application.GetRealHeight(17),
                X = Application.GetRealWidth(260),
                Tag = "0",
            };
            startTimeView.frameLayout.AddChidren(btnStartTimeText);
            //结束时间
            LogicView.SelectTypeView endTimeView = new LogicView.SelectTypeView();
            endTimeView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
            endTimeView.frameLayout.Y = startTimeView.frameLayout.Bottom;
            endTimeView.btnIcon.Visible = false;
            endTimeView.btnLine.Visible = false;
            endTimeView.btnText.X = Application.GetRealWidth(16);
            endTimeView.btnText.TextID = StringId.endTime;
            endTimeView.btnNextIcon.X = Application.GetRealWidth(307);
            timeHorizonView.frameLayout.AddChidren(endTimeView.FLayoutView());
            //显示结束时间文本
            Button btnEndTimeText = new Button
            {
                TextSize = LogicView.TextSize.text12,
                Width = Application.GetRealWidth(32 + 3),
                Height = Application.GetRealHeight(20),
                TextColor = CSS.CSS_Color.textCancelColor,
                Y = Application.GetRealHeight(17),
                X = Application.GetRealWidth(260),
                Tag = "0",
            };
            endTimeView.frameLayout.AddChidren(btnEndTimeText);
            #endregion
            #region 点击事件
            //开始时间点击事件
            startTimeView.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                SelectedTimeHorizon(fLayout, btnStartTimeText);
            };
            //结束时间点击事件
            endTimeView.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                SelectedTimeHorizon(fLayout, btnEndTimeText);
            };
            //确定点击事件
            timeHorizonView.btnConfirm.MouseUpEventHandler += (sender, e) =>
            {
                if (btnStartTimeText.Tag.ToString() == "0")
                {
                    //提示:请选中开始时间
                    return;
                }
                if (btnEndTimeText.Tag.ToString() == "0")
                {
                    //提示:请选中结束时间
                    return;
                }
                if (btnStartTimeText.Tag.ToString() == btnEndTimeText.Tag.ToString())
                {
                    //提示:时间一样的
                    return;
                }
                if (int.Parse(btnStartTimeText.Tag.ToString()) > int.Parse(btnEndTimeText.Tag.ToString()))
                {
                    //提示:开始时间不能大于结束时间
                    return;
                }
                Input inputTime = new Input();
                inputTime.sid = LogicMethod.NewSid();
                inputTime.condition_type = "2";
                Dictionary<string, string> dic = new Dictionary<string, string>();
                LogicMethod.dictionary(dic, "key", "timesection");
                LogicMethod.dictionary(dic, "comparator", "=");
                LogicMethod.dictionary(dic, "data_type", "string");
                LogicMethod.dictionary(dic, "value", btnStartTimeText.Text+"~"+btnEndTimeText.Text);
                inputTime.condition.Add(dic);
                if (edit)
                {
                    //移除旧数据
                    Logic.currlogic.input.RemoveAt(index);
                    //新数据插入旧数据的位置
                    Logic.currlogic.input.Insert(index, inputTime);
                    fLayout.RemoveFromParent();
                }
                else
                {
                    //添加一个新的时间点条件
                    Logic.currlogic.input.Add(inputTime);
                }
                LogicMethod.RemoveAllView();
                AddLogic addLogic = new AddLogic();
                MainPage.BasePageView.AddChidren(addLogic);
                addLogic.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            #endregion
            if (edit)
            {
                Input inputs = Logic.currlogic.input[index];
                if (inputs.condition_type == "2")
                {
                    List<Dictionary<string, string>> dicList = inputs.condition as List<Dictionary<string, string>>;
                    foreach (var dic in dicList)
                    {
                        string value = dic["value"];
                        string startTime = value.Split('~')[0];
                        string endtTime = value.Split('~')[1];
                        btnStartTimeText.Text = startTime;
                        btnStartTimeText.Tag = int.Parse(startTime.Split(':')[0]) * 60 + int.Parse(startTime.Split(':')[1]);
                        btnEndTimeText.Text = endtTime;
                        btnEndTimeText.Tag = int.Parse(endtTime.Split(':')[0]) * 60 + int.Parse(endtTime.Split(':')[1]);
                    }
                }
            }
        }
        /// <summary>
        /// 设置时间段时间的方法
        /// </summary>
        /// <param name="fLayout"></param>
        /// <param name="btn"></param>
        public void SelectedTimeHorizon(FrameLayout fLayout, Button btn)
        {
            LogicView.TimeView timePointView = new LogicView.TimeView();
            timePointView.FLayoutView(fLayout);
            EventHandler<MouseEventArgs> RemovefLayout = (sender, e1) =>
            {
                //只移除时间弹窗界面
                timePointView.frameLayout.RemoveFromParent();
            };
            //取消点击事件
            timePointView.btnCancel.MouseUpEventHandler += RemovefLayout;
            //加载数据界面的设置方法(列表互不联动)
            timePointView.mUIPickerView.setNPicker(timePointView.GethStringList(), timePointView.GetmStringList(), null);
            //默认初始选中状态
            timePointView.mUIPickerView.setCurrentItems(0, 30, 0);
            //定义一个局部变量记录选中时间
            string timepoint = "01:30";
            int sumTime = 90;
            if (btn.Tag.ToString() != "0")
            {
                string h = "", m = "";
                sumTime = int.Parse(btn.Tag.ToString());
                if ((sumTime / 60) < 10)
                {
                    h = "0" + (sumTime / 60).ToString();
                }
                else
                {
                    h = (sumTime / 60).ToString();
                }
                if ((sumTime % 60) < 10)
                {
                    m = "0" + (sumTime % 60).ToString();
                }
                else
                {
                    m = (sumTime % 60).ToString();
                }
                timepoint = h + ":" + m;
                int hourIndex = timePointView.GetValueIndex(timepoint, 0, 1, timePointView.GethIntList());
                int minuteIndex = timePointView.GetValueIndex(timepoint, 1, 0, timePointView.GetmIntList());
                //更新状态
                timePointView.mUIPickerView.setCurrentItems(hourIndex - 1, minuteIndex, 0);
            }
            //选中时间回调方法,时间变化一次回调一次
            timePointView.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) =>
            {
                string hour = timePointView.GethStringList()[index1].Split(' ')[0];
                string minuet = timePointView.GetmStringList()[index2].Split(' ')[0];
                timepoint = hour + ":" + minuet;
                sumTime = int.Parse(hour) * 60 + int.Parse(minuet);
            };
            //确定点击事件
            timePointView.btnConfirm.MouseUpEventHandler += (sender1, e3) =>
            {
                btn.Tag = sumTime;
                btn.Text = timepoint;
                //只移除时间弹窗界面
                timePointView.frameLayout.RemoveFromParent();
            };
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs
@@ -4,7 +4,7 @@
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
namespace HDL_ON.UI
{
    public partial class IntelligencePage : FrameLayout
    {
@@ -177,7 +177,8 @@
            #endregion
            sceneFunctionView = new VerticalScrolViewLayout() {
            sceneFunctionView = new VerticalScrolViewLayout()
            {
                Y = floorChangeView.Bottom,
                Height = Application.GetRealHeight(667 - 64 - 49 - 52 + 30),
            };
@@ -365,30 +366,11 @@
        void LoadAutomationPageView()
        {
            //btnAddIcon.RemoveFromParent();
            automationPage = new FrameLayout();
            contentPageView.AddChidren(automationPage);
            HDL_ON.UI.UI2.Intelligence.Automation.MainView.automationPage = automationPage;
            HDL_ON.UI.UI2.Intelligence.Automation.MainView.MainShow();
            Button btnTipNot = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(120),
                Width = Application.GetRealWidth(180),
                Height = Application.GetRealWidth(180),
                UnSelectedImagePath = "TipNot.png",
            };
            automationPage.AddChidren(btnTipNot);
            Button btnTipNotText = new Button()
            {
                Y = btnTipNot.Bottom,
                Height = Application.GetRealWidth(100),
                TextID = StringId.TipNotOpen,
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.TextualColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            };
            automationPage.AddChidren(btnTipNotText);
        }
        #endregion
    }
@@ -441,9 +423,9 @@
                btnSceneTilte.TextSize = CSS_FontSize.HeadlineFontSize;
                btnAutomationTitle.IsSelected = false;
                btnAutomationTitle.TextSize = CSS_FontSize.TextFontSize;
                contentPageView.PageIndex = 0;
            };
            //逻辑点击事件
            btnAutomationTitle.MouseUpEventHandler = (sender, e) => {
                if (btnAutomationTitle.IsSelected)
                {
@@ -454,6 +436,7 @@
                btnSceneTilte.IsSelected = false;
                btnSceneTilte.TextSize = CSS_FontSize.TextFontSize;
                contentPageView.PageIndex = 1;
            };
        }
        #endregion
@@ -465,13 +448,22 @@
        {
            btnAddIcon.MouseUpEventHandler = (sender, e) =>
            {
                Action action = () => {
                    LoadSceneFunctionControlZone();
                };
                var aep = new NewSceneMenuListPage(action);
                MainPage.BasePageView.AddChidren(aep);
                aep.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                if (!btnAutomationTitle.IsSelected)
                {
                    Action action = () =>
                    {
                        LoadSceneFunctionControlZone();
                    };
                    var aep = new NewSceneMenuListPage(action);
                    MainPage.BasePageView.AddChidren(aep);
                    aep.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                }
                else
                {
                    //跳转到逻辑界面
                    HDL_ON.UI.UI2.Intelligence.Automation.MainView.SkipAddLogicPage();
                }
            };
        }
@@ -492,6 +484,7 @@
            btnName.MouseUpEventHandler = eventHandler;
            btnZone.MouseUpEventHandler = eventHandler;
        }
    }
}