xm
2021-12-01 6d73bf6e816570291865674bef8bce8972e4de3f
2021-12-01-01
4个文件已添加
6个文件已修改
7734 ■■■■ 已修改文件
.vs/HDL_APP_Project/xs/UserPrefs.xml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/inputlocation.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/selectTheautomAtion.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/selectTheautomLocation.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/selectTheautomSecurity.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/HDL-ON_Android.csproj 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs 4454 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs 1139 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs 2105 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -3,12 +3,38 @@
    <MonoDevelop.MacDev.AppleDevelopmentTeam />
  </MonoDevelop.Ide.ItemProperties.SiriIntentUI>
  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget" />
  <MonoDevelop.Ide.Workbench>
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs">
    <Files>
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs" Line="86" Column="38" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs" Line="552" Column="79" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs" Line="395" Column="1" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs" Line="100" Column="47" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/SpeciaTime.cs" Line="89" Column="41" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs" Line="137" Column="65" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs" Line="615" Column="29" />
    </Files>
    <Pads>
      <Pad Id="ProjectPad">
        <State name="__root__">
          <Node name="HDL_APP_Project" expanded="True">
            <Node name="HDL-ON_Android" selected="True" />
            <Node name="HDL_ON" expanded="True">
              <Node name="UI" expanded="True">
                <Node name="UI2" expanded="True">
                  <Node name="3-Intelligence" expanded="True">
                    <Node name="Automation" expanded="True">
                      <Node name="PublicInterface.cs" selected="True" />
                    </Node>
                  </Node>
                </Node>
              </Node>
            </Node>
            <Node name="HDL-ON_Android" expanded="True">
              <Node name="Assets" expanded="True">
                <Node name="Phone" expanded="True">
                  <Node name="LogicIcon" expanded="True" />
                </Node>
              </Node>
            </Node>
          </Node>
        </State>
      </Pad>
HDL-ON_Android/Assets/Phone/LogicIcon/inputlocation.png
HDL-ON_Android/Assets/Phone/LogicIcon/selectTheautomAtion.png
HDL-ON_Android/Assets/Phone/LogicIcon/selectTheautomLocation.png
HDL-ON_Android/Assets/Phone/LogicIcon/selectTheautomSecurity.png
HDL-ON_Android/HDL-ON_Android.csproj
@@ -211,6 +211,10 @@
    <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\btnCloseIcon.png" />
    <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\btnInfoIcon.png" />
    <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\HumiOnIcon.png" />
    <AndroidAsset Include="Assets\Phone\LogicIcon\inputlocation.png" />
    <AndroidAsset Include="Assets\Phone\LogicIcon\selectTheautomAtion.png" />
    <AndroidAsset Include="Assets\Phone\LogicIcon\selectTheautomLocation.png" />
    <AndroidAsset Include="Assets\Phone\LogicIcon\selectTheautomSecurity.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\values\colors.xml" />
HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
@@ -70,7 +70,7 @@
      LogicView.SelectTypeView likiadaodaView = new LogicView.SelectTypeView();
      likiadaodaView.frameLayout.Y = shiwaiView.frameLayout.Bottom;
      likiadaodaView.btnText.TextID = StringId.likiadaoda;
      likiadaodaView.btnIcon.UnSelectedImagePath = "LogicIcon/location.png";
      likiadaodaView.btnIcon.UnSelectedImagePath = "LogicIcon/inputlocation.png";
      if (MainView.IsGatewayType)
      {
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
Diff too large
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -6,585 +6,598 @@
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class MainView
  public class MainView
  {
    /// <summary>
    /// VerticalRefreshLayout父控件
    /// </summary>
    public static FrameLayout automationPage;
    /// <summary>
    /// 加载逻辑列表显示界面
    /// </summary>
    public static void MainShow()
    {
        /// <summary>
        /// VerticalRefreshLayout父控件
        /// </summary>
        public static FrameLayout automationPage;
        /// <summary>
        /// 加载逻辑列表显示界面
        /// </summary>
        public static void MainShow()
      automationPage.RemoveAll();
      VerticalRefreshLayout vv = new VerticalRefreshLayout();
      vv.Height = Application.GetRealHeight(667 - 64 - 49);//模拟高度
      automationPage.AddChidren(vv);
      vv.BeginHeaderRefreshingAction += () =>
      {
        //清除之前自动化列表;
        Logic.LogicList.Clear();
        //获取自动列表
        GetLogicList();
        //刷新自动化界面
        MainShow();
        //关闭刷新View;
        vv.EndHeaderRefreshing();
      };
      //获取自动化列表
      GetLogicList();
      for (int i = Logic.LogicList.Count - 1; i >= 0; i--)//降序排列
                                                          //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 = GetCyclicText(currLogic);
        logicView.btnclick.MouseUpEventHandler += (sen, e) =>
        {
            automationPage.RemoveAll();
            VerticalRefreshLayout vv = new VerticalRefreshLayout();
            vv.Height = Application.GetRealHeight(667 - 64 - 49);//模拟高度
            automationPage.AddChidren(vv);
            vv.BeginHeaderRefreshingAction += () =>
            {
                //清除之前自动化列表;
                Logic.LogicList.Clear();
                //获取自动列表
                GetLogicList();
                //刷新自动化界面
                MainShow();
                //关闭刷新View;
                vv.EndHeaderRefreshing();
            };
            //获取自动化列表
            GetLogicList();
            for (int i = Logic.LogicList.Count - 1; i >= 0; i--)//降序排列
            //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 = GetCyclicText(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;
                    new MainView { }.SkipAddLogicPage(currLogic);
                };
                //开关图标的点击事件
                logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) =>
                {
                    logicView.btnSwitchIcon.IsSelected = !logicView.btnSwitchIcon.IsSelected;
                    if (logicView.btnSwitchIcon.IsSelected)
                    {
                        logicView.btnSwitchIcon.IsSelected = true;
                        currLogic.enable = "true";
                    }
                    else
                    {
                        logicView.btnSwitchIcon.IsSelected = false;
                        currLogic.enable = "false";
                    }
                    //Send.switchLogic(currLogic);
                    new System.Threading.Thread(() =>
                    {
                        try
                        {
                            //逻辑使能的命令
                            Send.SwitchLogic(currLogic);
                        }
                        catch { }
                    })
                    { IsBackground = true }.Start();
                };
                GetSelectIcon(logicView.frameLayout, currLogic);
                if (i == 0)//降序排列
                //if (Logic.LogicList.Count - 1 == i)
                {
                    ///最后一个距离最底部12,界面显示效果作用;
                    vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) });
                }
                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 + Application.GetRealHeight(16),
                    Height = Application.GetRealHeight(20),
                    TextID = StringId.logicnull,
                    TextAlignment = TextAlignment.Center,
                    TextSize = LogicView.TextSize.text14,
                    TextColor = CSS.CSS_Color.textConfirmColor,
                };
                automationPage.AddChidren(btnTipNotText);
            }
        }
        /// <summary>
        ///  按+跳转到逻辑界面的方法
        /// </summary>
        public void SkipAddLogicPage(Logic logic=null)
          //Logic.currlogic = currLogic;
          //var addLogic = new AddLogic();
          //MainPage.BasePageView.AddChidren(addLogic);
          //addLogic.Show();
          //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
          new MainView { }.SkipAddLogicPage(currLogic);
        };
        //开关图标的点击事件
        logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) =>
        {
            if (logic == null)
          logicView.btnSwitchIcon.IsSelected = !logicView.btnSwitchIcon.IsSelected;
          if (logicView.btnSwitchIcon.IsSelected)
          {
            logicView.btnSwitchIcon.IsSelected = true;
            currLogic.enable = "true";
          }
          else
          {
            logicView.btnSwitchIcon.IsSelected = false;
            currLogic.enable = "false";
          }
          //Send.switchLogic(currLogic);
          new System.Threading.Thread(() =>
          {
            try
            {
                Logic.currlogic = new Logic();
            }
            else {
                Logic.currlogic = logic;
            }
            if (IsGatewayType)
            {
                var addLogic = new AddLogic();
                MainPage.BasePageView.AddChidren(addLogic);
                addLogic.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            }
            else
            {
              //逻辑使能的命令
              Send.SwitchLogic(currLogic);
                var onePortAutomation = new OnePortAutomation();
                MainPage.BasePageView.AddChidren(onePortAutomation);
                onePortAutomation.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            }
        }
        /// <summary>
        ///返回循环描述文本
        /// </summary>
        /// <param name="logic"></param>
        public static string GetCyclicText(Logic logic)
            catch { }
          })
          { IsBackground = true }.Start();
        };
        GetSelectIcon(logicView.frameLayout, currLogic);
        if (i == 0)//降序排列
                   //if (Logic.LogicList.Count - 1 == i)
        {
            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;
          ///最后一个距离最底部12,界面显示效果作用;
          vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) });
        }
        /// <summary>
        /// 返回星期描述文本
        /// </summary>
        /// <param name="weekList"></param>
        /// <returns></returns>
        public static string GetWeekString(List<string> weekList)
        if (currLogic.enable == "true")
        {
            string weekTextName = "";
            if (weekList.Contains("1"))
            {
                weekTextName += Language.StringByID(StringId.monday) + ",";
            }
            if (weekList.Contains("2"))
            {
                weekTextName += Language.StringByID(StringId.tuesday) + ",";
            }
            if (weekList.Contains("3"))
            {
                weekTextName += Language.StringByID(StringId.wednesday) + ",";
            }
            if (weekList.Contains("4"))
            {
                weekTextName += Language.StringByID(StringId.thursday) + ",";
            }
            if (weekList.Contains("5"))
            {
                weekTextName += Language.StringByID(StringId.friday) + ",";
            }
            if (weekList.Contains("6"))
            {
                weekTextName += Language.StringByID(StringId.saturday) + ",";
            }
            if (weekList.Contains("0"))
            {
                weekTextName += Language.StringByID(StringId.sunday) + ",";
            }
            if (weekTextName == "")
            {
                return "";
            }
            return weekTextName.TrimEnd(',');
          logicView.btnSwitchIcon.IsSelected = true;
        }
        /// <summary>
        /// 获取每月的字符串
        /// </summary>
        /// <param name="monList"></param>
        /// <returns></returns>
        public static string GetMonString(List<string> monList)
        else
        {
            string monTextName = Language.StringByID(StringId.monthly);
            for (int i = 1; i < 32; i++)
            {
                if (monList.Contains(i.ToString()))
                {
                    monTextName += i.ToString() + ",";
                }
            }
            return monTextName.TrimEnd(',');
          logicView.btnSwitchIcon.IsSelected = false;
        }
        /// <summary>
        /// 获取逻辑列表
        /// </summary>
        public static void GetLogicList()
      }
      if (Logic.LogicList.Count == 0)
      {
        Button btnTipNot = new Button()
        {
            if (Logic.LogicList.Count != 0)
            {
                //自动化列表为0才去获取自动化列表;
                return;
            }
            List<string> logicIdList = new List<string>();
            //获取逻辑ID列表
            var idStr = Send.GetLogicIdList();
            if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "")
            {
                var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data);
                var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date);
                for (int i = 0; i < dateList.Count; i++)
                {
                    //添加逻辑ID
                    logicIdList.Add(dateList[i].userLogicId);
                }
            }
            //获取自动化列表
            var logicStr = Send.GetLogic(logicIdList);
            if (logicStr.Code == "0" && logicStr.Data != null && logicStr.Data.ToString() != "")
            {
                //获取逻辑详细返回是一个数组(object类型转换为数组);
                var jArray = JArray.Parse(logicStr.Data.ToString());
                for (int a = 0; a < jArray.Count; a++)
                {
                    var jay = jArray[a];
                    //数据返序列化为Logic对象
                    var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
                    var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str);
                    if (logic != null)
                    {
                        //查找是否已经存在该逻辑
                        var if_logic = Logic.LogicList.Find((c) => c.userLogicId == logic.userLogicId);
                        if (if_logic == null)
                        {
                            Logic newlogic = new Logic();
                            newlogic.name = logic.name;
                            newlogic.userLogicId = logic.userLogicId;
                            newlogic.sid = logic.sid;
                            newlogic.relation = logic.relation;
                            newlogic.enable = logic.enable;
                            newlogic.cycle = logic.cycle;
                            for (int i = 0; i < logic.input.Count; i++)
                            {
                                if (logic.input[i] == null || string.IsNullOrEmpty(logic.input[i].condition_type))
                                {
                                    //防止调试软件乱传东西上来;
                                    //防止有空对象;
                                    //正常情况下不会出现的现象;
                                    continue;
                                }
                                newlogic.input.Add(logic.input[i]);
                            }
                            for (int i = 0; i < logic.output.Count; i++)
                            {
                                if (logic.output[i] == null || string.IsNullOrEmpty(logic.output[i].target_type))
                                {
                                    //防止调试软件乱传东西上来;
                                    //防止有空对象;
                                    //正常情况下不会该现象;
                                    continue;
                                }
                                newlogic.output.Add(logic.output[i]);
                            }
                            newlogic.noticeConfig = logic.noticeConfig;
                            newlogic.pushConfigs = logic.pushConfigs;
                            //添加逻辑
                            Logic.LogicList.Add(newlogic);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 判断JObject对象是存在健值
        /// </summary>
        /// <param name="jObject"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        private bool Exist(JObject jObject, string key)
          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()
        {
            if (jObject.Property(key) != null)
            {
                return true;
            }
            return false;
        }
        /// <summary>
        /// 显示条件或者目标类型图标
        /// </summary>
        /// <param name="layouFrame">父控件</param>
        /// <param name="logic">当前自动化</param>
        private static void GetSelectIcon(FrameLayout layouFrame, Logic logic)
        {
            //重新排列图标序号
            List<int> iconIntValue = new List<int>();
            iconIntValue.Clear();
            //1-10(表示条件图标)自己局部定义为了显示选中条件类型图标
            //1-时间图标
            //2-功能图标
            //3-云端图标
            //4-场景图标
            for (int i = 0; i < logic.input.Count; i++)
            {
                if (logic.input[i] == null)
                    continue;
                var int1 = int.Parse(logic.input[i].condition_type);
                int iconInt = 0;
                switch (int1)
                {
                    case 1:
                    case 2:
                        {
                            iconInt = 1;
                        }
                        break;
                    case 3:
                        {
                            iconInt = 2;
                        }
                        break;
                    case 4:
                    case 6:
                    case 9:
                        {
                            iconInt = 3;
                        }
                        break;
                    case 10:
                        {
                            iconInt = 4;
                        }
                        break;
                }
                if (!iconIntValue.Contains(iconInt))
                {
                    iconIntValue.Add(iconInt);
                }
            }
            //分割条件和目标的图标
            iconIntValue.Add(11);
            //12-20(表示目标图标)自己局部定义为了显示选中目标类型图标
            //12-功能图标
            //13-场景图标
            //14-安防图标
            //14-延时图标
            for (int i = 0; i < logic.output.Count; i++)
            {
                var int1 = int.Parse(logic.output[i].target_type);
                int iconInt = 0;
                switch (int1)
                {
                    case 1:
                        {
                            iconInt = 12;
                        }
                        break;
                    case 2:
                        {
                            iconInt = 13;
                        }
                        break;
                    case 3:
                        {
                            iconInt = 14;
                        }
                        break;
                    case 4:
                        {
                            iconInt = 15;
                        }
                        break;
                }
                if (!iconIntValue.Contains(iconInt))
                {
                    iconIntValue.Add(iconInt);
                }
            }
            //图标控件的父控件
            FrameLayout frame = new FrameLayout
            {
                Height = Application.GetRealHeight(40),
                Width = Application.GetRealWidth(275),
                Y = Application.GetRealHeight(56),
            };
            layouFrame.AddChidren(frame);
            for (int i = 0; i < iconIntValue.Count; i++)
            {
                //图标控件
                Button btnIcon = new Button
                {
                    Width = Application.GetRealWidth(28),
                    Height = Application.GetRealWidth(28),
                    Gravity = Gravity.CenterVertical,
                };
                frame.AddChidren(btnIcon);
                if (i == 0)
                {
                    btnIcon.X = Application.GetRealWidth(12);
                }
                else
                {
                    btnIcon.X = Application.GetRealWidth(12 + (28 + 4) * i);
                }
                string strIcon = "";
                switch (iconIntValue[i])
                {
                    case 1:
                        {
                            strIcon = "LogicIcon/selectTheTime.png";
                        }
                        break;
                    case 2:
                        {
                            strIcon = "LogicIcon/selectTheFun.png";
                        }
                        break;
                    case 3:
                        {
                            strIcon = "LogicIcon/shiwaitianqi.png";
                        }
                        break;
                    case 4:
                        {
                            strIcon = "LogicIcon/selectTheScene.png";
                        }
                        break;
                    case 11:
                        {
                            //分割条件和目标的图标
                            strIcon = "LogicIcon/link.png";
                        }
                        break;
                    case 12:
                        {
                            strIcon = "LogicIcon/selectTheFun.png";
                        }
                        break;
                    case 13:
                        {
                            strIcon = "LogicIcon/selectTheScene.png";
                        }
                        break;
                    case 14:
                        {
                            strIcon = "LogicIcon/security.png";
                        }
                        break;
                    case 15:
                        {
                            //strIcon = "LogicIcon/timeicon.png";
                        }
                        break;
                }
                btnIcon.UnSelectedImagePath = strIcon;
            }
        }
        /// <summary>
        /// 判断网关类型(0:bus网关;1:A协议网关)
        /// </summary>
        /// <returns>true=A协议网关;false=bus网关</returns>
        public static bool IsGatewayType
        {
            get
            {
                if (Entity.DB_ResidenceData.Instance.GatewayType == 1)
                {
                    return true;
                }
                return false;
            }
        }
          Y = btnTipNot.Bottom + Application.GetRealHeight(16),
          Height = Application.GetRealHeight(20),
          TextID = StringId.logicnull,
          TextAlignment = TextAlignment.Center,
          TextSize = LogicView.TextSize.text14,
          TextColor = CSS.CSS_Color.textConfirmColor,
        };
        automationPage.AddChidren(btnTipNotText);
      }
    }
    class LogicData
    /// <summary>
    ///  按+跳转到逻辑界面的方法
    /// </summary>
    public void SkipAddLogicPage(Logic logic = null)
    {
        /// <summary>
        /// 云端唯一id
        /// </summary>
        public string userLogicId = "";
        /// <summary>
        /// 网关id
        /// </summary>
        public string gatewayId = "";
        /// <summary>
        /// 逻辑唯一标识
        /// </summary>
        public string sid = "";
        /// <summary>
        /// 逻辑名称
        /// </summary>
        public string name = "";
        /// <summary>
        /// 逻辑使能(开,关)
        /// </summary>
        public string enable = "";
        /// <summary>
        /// 地理围栏配置
        /// </summary>
        public Fence geo_fence = new Fence();
    }
      if (logic == null)
      {
        Logic.currlogic = new Logic();
      }
      else
      {
        Logic.currlogic = logic;
      }
      if (IsGatewayType)
      {
        var addLogic = new AddLogic();
        MainPage.BasePageView.AddChidren(addLogic);
        addLogic.Show();
        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
      }
      else
      {
    class CycleA
    {
        public string type = "";
        public string[] value;
        var onePortAutomation = new OnePortAutomation();
        MainPage.BasePageView.AddChidren(onePortAutomation);
        onePortAutomation.Show();
        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
      }
    }
    /// <summary>
    ///返回循环描述文本
    /// </summary>
    /// <param name="logic"></param>
    public static string GetCyclicText(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("1"))
      {
        weekTextName += Language.StringByID(StringId.monday) + ",";
      }
      if (weekList.Contains("2"))
      {
        weekTextName += Language.StringByID(StringId.tuesday) + ",";
      }
      if (weekList.Contains("3"))
      {
        weekTextName += Language.StringByID(StringId.wednesday) + ",";
      }
      if (weekList.Contains("4"))
      {
        weekTextName += Language.StringByID(StringId.thursday) + ",";
      }
      if (weekList.Contains("5"))
      {
        weekTextName += Language.StringByID(StringId.friday) + ",";
      }
      if (weekList.Contains("6"))
      {
        weekTextName += Language.StringByID(StringId.saturday) + ",";
      }
      if (weekList.Contains("0"))
      {
        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(',');
    }
    /// <summary>
    /// 获取逻辑列表
    /// </summary>
    public static void GetLogicList()
    {
      if (Logic.LogicList.Count != 0)
      {
        //自动化列表为0才去获取自动化列表;
        return;
      }
      List<string> logicIdList = new List<string>();
      //获取逻辑ID列表
      var idStr = Send.GetLogicIdList();
      if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "")
      {
        var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data);
        var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date);
        for (int i = 0; i < dateList.Count; i++)
        {
          //添加逻辑ID
          logicIdList.Add(dateList[i].userLogicId);
        }
      }
      //获取自动化列表
      var logicStr = Send.GetLogic(logicIdList);
      if (logicStr.Code == "0" && logicStr.Data != null && logicStr.Data.ToString() != "")
      {
        //获取逻辑详细返回是一个数组(object类型转换为数组);
        var jArray = JArray.Parse(logicStr.Data.ToString());
        for (int a = 0; a < jArray.Count; a++)
        {
          var jay = jArray[a];
          //数据返序列化为Logic对象
          var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
          var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str);
          if (logic != null)
          {
            //查找是否已经存在该逻辑
            var if_logic = Logic.LogicList.Find((c) => c.userLogicId == logic.userLogicId);
            if (if_logic == null)
            {
              Logic newlogic = new Logic();
              newlogic.name = logic.name;
              newlogic.userLogicId = logic.userLogicId;
              newlogic.sid = logic.sid;
              newlogic.relation = logic.relation;
              newlogic.enable = logic.enable;
              newlogic.cycle = logic.cycle;
              for (int i = 0; i < logic.input.Count; i++)
              {
                if (logic.input[i] == null || string.IsNullOrEmpty(logic.input[i].condition_type))
                {
                  //防止调试软件乱传东西上来;
                  //防止有空对象;
                  //正常情况下不会出现的现象;
                  continue;
                }
                newlogic.input.Add(logic.input[i]);
              }
              for (int i = 0; i < logic.output.Count; i++)
              {
                if (logic.output[i] == null || string.IsNullOrEmpty(logic.output[i].target_type))
                {
                  //防止调试软件乱传东西上来;
                  //防止有空对象;
                  //正常情况下不会该现象;
                  continue;
                }
                newlogic.output.Add(logic.output[i]);
              }
              newlogic.noticeConfig = logic.noticeConfig;
              newlogic.pushConfigs = logic.pushConfigs;
              //添加逻辑
              Logic.LogicList.Add(newlogic);
            }
          }
        }
      }
    }
    /// <summary>
    /// 判断JObject对象是存在健值
    /// </summary>
    /// <param name="jObject"></param>
    /// <param name="key"></param>
    /// <returns></returns>
    private bool Exist(JObject jObject, string key)
    {
      if (jObject.Property(key) != null)
      {
        return true;
      }
      return false;
    }
    /// <summary>
    /// 显示条件或者目标类型图标
    /// </summary>
    /// <param name="layouFrame">父控件</param>
    /// <param name="logic">当前自动化</param>
    private static void GetSelectIcon(FrameLayout layouFrame, Logic logic)
    {
      //重新排列图标序号
      List<int> iconIntValue = new List<int>();
      iconIntValue.Clear();
      //1-10(表示条件图标)自己局部定义为了显示选中条件类型图标
      //1-时间图标
      //2-功能图标
      //3-云端图标
      //4-场景图标
      for (int i = 0; i < logic.input.Count; i++)
      {
        if (logic.input[i] == null)
          continue;
        var int1 = int.Parse(logic.input[i].condition_type);
        int iconInt = 0;
        switch (int1)
        {
          case 1:
          case 2:
            {
              iconInt = 1;
            }
            break;
          case 3:
            {
              iconInt = 2;
            }
            break;
          case 4:
          case 6:
          case 9:
            {
              iconInt = 3;
            }
            break;
          case 10:
            {
              iconInt = 4;
            }
            break;
          case 8:
            {
              iconInt = 5;
            }
            break;
        }
        if (!iconIntValue.Contains(iconInt))
        {
          iconIntValue.Add(iconInt);
        }
      }
      //分割条件和目标的图标
      iconIntValue.Add(11);
      //12-20(表示目标图标)自己局部定义为了显示选中目标类型图标
      //12-功能图标
      //13-场景图标
      //14-安防图标
      //14-延时图标
      for (int i = 0; i < logic.output.Count; i++)
      {
        var int1 = int.Parse(logic.output[i].target_type);
        int iconInt = 0;
        switch (int1)
        {
          case 1:
            {
              iconInt = 12;
            }
            break;
          case 2:
            {
              iconInt = 13;
            }
            break;
          case 3:
            {
              iconInt = 14;
            }
            break;
          case 4:
            {
              iconInt = 15;
            }
            break;
        }
        if (!iconIntValue.Contains(iconInt))
        {
          iconIntValue.Add(iconInt);
        }
      }
      //图标控件的父控件
      FrameLayout frame = new FrameLayout
      {
        Height = Application.GetRealHeight(40),
        Width = Application.GetRealWidth(275),
        Y = Application.GetRealHeight(56),
      };
      layouFrame.AddChidren(frame);
      for (int i = 0; i < iconIntValue.Count; i++)
      {
        //图标控件
        Button btnIcon = new Button
        {
          Width = Application.GetRealWidth(28),
          Height = Application.GetRealWidth(28),
          Gravity = Gravity.CenterVertical,
        };
        frame.AddChidren(btnIcon);
        if (i == 0)
        {
          btnIcon.X = Application.GetRealWidth(12);
        }
        else
        {
          btnIcon.X = Application.GetRealWidth(12 + (28 + 4) * i);
        }
        string strIcon = "";
        switch (iconIntValue[i])
        {
          case 1:
            {
              strIcon = "LogicIcon/selectTheTime.png";
            }
            break;
          case 2:
            {
              strIcon = "LogicIcon/selectTheFun.png";
            }
            break;
          case 3:
            {
              strIcon = "LogicIcon/shiwaitianqi.png";
            }
            break;
          case 4:
            {
              strIcon = "LogicIcon/selectTheScene.png";
            }
            break;
          case 5:
            {
              strIcon = "LogicIcon/selectTheautomLocation.png";
            }
            break;
          case 11:
            {
              //分割条件和目标的图标
              strIcon = "LogicIcon/link.png";
            }
            break;
          case 12:
            {
              strIcon = "LogicIcon/selectTheFun.png";
            }
            break;
          case 13:
            {
              strIcon = "LogicIcon/selectTheScene.png";
            }
            break;
          case 14:
            {
              strIcon = "LogicIcon/selectTheautomSecurity.png";
            }
            break;
          case 15:
            {
              //strIcon = "LogicIcon/timeicon.png";
            }
            break;
        }
        btnIcon.UnSelectedImagePath = strIcon;
      }
    }
    /// <summary>
    /// 判断网关类型(0:bus网关;1:A协议网关)
    /// </summary>
    /// <returns>true=A协议网关;false=bus网关</returns>
    public static bool IsGatewayType
    {
      get
      {
        if (Entity.DB_ResidenceData.Instance.GatewayType == 1)
        {
          return true;
        }
        return false;
      }
    }
  }
  class LogicData
  {
    /// <summary>
    /// 云端唯一id
    /// </summary>
    public string userLogicId = "";
    /// <summary>
    /// 网关id
    /// </summary>
    public string gatewayId = "";
    /// <summary>
    /// 逻辑唯一标识
    /// </summary>
    public string sid = "";
    /// <summary>
    /// 逻辑名称
    /// </summary>
    public string name = "";
    /// <summary>
    /// 逻辑使能(开,关)
    /// </summary>
    public string enable = "";
    /// <summary>
    /// 地理围栏配置
    /// </summary>
    public Fence geo_fence = new Fence();
  }
  class CycleA
  {
    public string type = "";
    public string[] value;
  }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -3,664 +3,664 @@
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class PublicInterface
  public class PublicInterface
  {
    /// <summary>
    /// 单选择
    /// </summary>
    /// <param name="frame">显示在哪个界面的父控件</param>
    /// <param name="list">显示数据源</param>
    /// <param name="titleText"></param>
    /// <param name="stateText">之前状态文本</param>
    /// <param name="action">返回值</param>
    /// <param name="textSize">显示文本字体大小</param>
    public void SingleSelectionShow(FrameLayout frame, List<string> list, string titleText, string stateText, Action<string> action, int textSize = LogicView.TextSize.text14)
    {
        /// <summary>
        /// 单选择
        /// </summary>
        /// <param name="frame">显示在哪个界面的父控件</param>
        /// <param name="list">显示数据源</param>
        /// <param name="titleText"></param>
        /// <param name="stateText">之前状态文本</param>
        /// <param name="action">返回值</param>
        /// <param name="textSize">显示文本字体大小</param>
        public void SingleSelectionShow(FrameLayout frame, List<string> list, string titleText, string stateText, Action<string> action, int textSize = LogicView.TextSize.text14)
      if (list == null)
      {
        return;
      }
      FrameLayout frameLayout = new FrameLayout
      {
        BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
      };
      frame.AddChidren(frameLayout);
      LogicView.DateView view = new LogicView.DateView();
      view.btnTitle.Text = titleText;
      view.FLayoutView(frameLayout, list.Count);
      view.btnCancel.MouseUpEventHandler += (sender, e) =>
      {
              //移除fLayout界面
              frameLayout.RemoveFromParent();
      };
      ///定义一个Btn记录选中状态
      Button checkBtn = new Button
      {
        Tag = "unknown",
      };
      for (int i = 0; i < list.Count; i++)
      {
        string str = list[i];
        LogicView.CheckView checkView = new LogicView.CheckView();
        checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
        checkView.btnText.TextSize = textSize;
        view.frameLayout.AddChidren(checkView.FLayoutView());
        checkView.btnText.Text = str;
        checkView.btnClick.Tag = str;//标记
        if (stateText == str)
        {
            if (list == null)
          //显示之前的选中状态
          checkBtn.IsSelected = false;
          checkView.btnCheckIcon.IsSelected = true;
          checkBtn = checkView.btnCheckIcon;
          checkBtn.Tag = checkView.btnClick.Tag.ToString();
        }
        //点击事件
        checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
        {
          checkBtn.IsSelected = false;
          checkView.btnCheckIcon.IsSelected = true;
          checkBtn = checkView.btnCheckIcon;
          checkBtn.Tag = checkView.btnClick.Tag.ToString();
        };
      }
      view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
      {
        if (checkBtn.Tag.ToString() == "unknown")
        {
          return;
        }
        action(checkBtn.Tag.ToString());
              //移除fLayout界面
              frameLayout.RemoveFromParent();
      };
    }
    /// <summary>
    /// 多选择
    /// </summary>
    /// <param name="frameLayout">父控件</param>
    /// <param name="list">显示数据源</param>
    /// <param name="titleText"></param>
    /// <param name="stateTextList">之前状态文本</param>
    /// <param name="action">返回值</param>
    /// <param name="textSize">显示文本字体大小</param>
    public void MultiSelectShow(FrameLayout frameLayout, List<string> list, string titleText, List<string> stateTextList, Action<List<string>> action, int textSize = LogicView.TextSize.text14)
    {
      LogicView.DateView view = new LogicView.DateView();
      view.btnTitle.Text = titleText;
      view.FLayoutView(frameLayout, list.Count);
      view.btnCancel.MouseUpEventHandler += (sender, e) =>
      {
              //移除fLayout界面
              view.frameLayout.RemoveFromParent();
      };
      for (int i = 0; i < list.Count; i++)
      {
        string str = list[i];
        LogicView.CheckView checkView = new LogicView.CheckView();
        checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
        checkView.btnText.TextSize = textSize;
        view.frameLayout.AddChidren(checkView.FLayoutView());
        checkView.btnText.Text = str;
        checkView.btnClick.Tag = str;//标记
        if (stateTextList.Contains(str))
        {
          //显示之前的选中状态
          checkView.btnCheckIcon.IsSelected = true;
        }
        //点击事件
        checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
        {
          string clickIndex = checkView.btnClick.Tag.ToString();
          checkView.btnClick.IsSelected = !checkView.btnClick.IsSelected;
          if (checkView.btnClick.IsSelected)
          {
            checkView.btnCheckIcon.IsSelected = true;
            if (!stateTextList.Contains(clickIndex))
            {
                      //添加选中数据
                      stateTextList.Add(clickIndex);
            }
          }
          else
          {
            checkView.btnCheckIcon.IsSelected = false;
            if (stateTextList.Contains(clickIndex))
            {
                      //移除选中数据
                      stateTextList.Remove(clickIndex);
            }
          }
        };
      }
      view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
      {
        if (stateTextList.Count == 0)
        {
          return;
        }
        action(stateTextList);
              //移除fLayout界面
              frameLayout.RemoveFromParent();
      };
    }
    /// <summary>
    /// 月-多选择
    /// </summary>
    /// <param name="frameLayout">父控件</param>
    /// <param name="action">显示文本字体大小</param>
    public void MonSelectShow(FrameLayout frameLayout, Logic logic, Action<List<string>> action)
    {
      LogicView.MonView monView = new LogicView.MonView();
      monView.btnTitle.TextID = StringId.monthly;
      monView.FLayoutView(frameLayout);
      monView.btnCancel.MouseUpEventHandler += (sender, e) =>
      {
        monView.frameLayout.RemoveFromParent();
      };
      //定义一个局部monList列表用来记录选中数据;
      List<string> monList = new List<string>();
      if (logic.cycle.type == "mon")
      {
        //加载之前保存的数据
        monList.AddRange(logic.cycle.value);
      }
      //定义一个变量记录行数
      int lineSun = 0;
      for (int i = 1; i < 32; i++)
      {
        Button monTextBtn = new Button
        {
          Width = Application.GetRealWidth(30),
          Height = Application.GetRealWidth(30),
          Radius = (uint)Application.GetRealWidth(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;
            }
            FrameLayout frameLayout = new FrameLayout
            {
                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
            };
            frame.AddChidren(frameLayout);
            LogicView.DateView view = new LogicView.DateView();
            view.btnTitle.Text = titleText;
            view.FLayoutView(frameLayout, list.Count);
            view.btnCancel.MouseUpEventHandler += (sender, e) =>
            {
                //移除fLayout界面
                frameLayout.RemoveFromParent();
            };
            ///定义一个Btn记录选中状态
            Button checkBtn = new Button
            {
                Tag = "unknown",
            };
            for (int i = 0; i < list.Count; i++)
            {
                string str = list[i];
                LogicView.CheckView checkView = new LogicView.CheckView();
                checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
                checkView.btnText.TextSize = textSize;
                view.frameLayout.AddChidren(checkView.FLayoutView());
                checkView.btnText.Text = str;
                checkView.btnClick.Tag = str;//标记
                if (stateText == str)
                {
                    //显示之前的选中状态
                    checkBtn.IsSelected = false;
                    checkView.btnCheckIcon.IsSelected = true;
                    checkBtn = checkView.btnCheckIcon;
                    checkBtn.Tag = checkView.btnClick.Tag.ToString();
                }
                //点击事件
                checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
                {
                    checkBtn.IsSelected = false;
                    checkView.btnCheckIcon.IsSelected = true;
                    checkBtn = checkView.btnCheckIcon;
                    checkBtn.Tag = checkView.btnClick.Tag.ToString();
                };
            }
            view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
            {
                if (checkBtn.Tag.ToString() == "unknown")
                {
                    return;
                }
                action(checkBtn.Tag.ToString());
                //移除fLayout界面
                frameLayout.RemoveFromParent();
            };
        }
        /// <summary>
        /// 多选择
        /// </summary>
        /// <param name="frameLayout">父控件</param>
        /// <param name="list">显示数据源</param>
        /// <param name="titleText"></param>
        /// <param name="stateTextList">之前状态文本</param>
        /// <param name="action">返回值</param>
        /// <param name="textSize">显示文本字体大小</param>
        public void MultiSelectShow(FrameLayout frameLayout, List<string> list, string titleText, List<string> stateTextList, Action<List<string>> action, int textSize = LogicView.TextSize.text14)
        action(monList);
        frameLayout.RemoveFromParent();
      };
    }
    /// <summary>
    /// 超出5个元素该用滑动控件
    /// </summary>
    /// <param name="frame">显示在哪个界面的父控件</param>
    /// <param name="list">显示数据源</param>
    /// <param name="titleText">标题</param>
    /// <param name="action">返回值索引值</param>
    public void FrameOrVv(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<int> action)
    {
      int line = 0;
      if (list.Count == 0 || list.Count > 5)
      {
        //超出5个只能默认5个;
        line = 5;
      }
      else
      {
        line = list.Count;
      }
      FrameLayout frameLayout = new FrameLayout
      {
        BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
      };
      frame.AddChidren(frameLayout);
      LogicView.DateView view = new LogicView.DateView();
      view.btnTitle.TextID = titleText;
      view.FLayoutView(frameLayout, line);
      view.btnCancel.MouseUpEventHandler += (sender, e) =>
      {
              //移除fLayout界面
              frameLayout.RemoveFromParent();
      };
      //小于5使用
      FrameLayout frameL = new FrameLayout
      {
        Y = Application.GetRealHeight(56),
        Height = Application.GetRealHeight(50 * line),
      };
      //大于5使用
      VerticalRefreshLayout verticalRefresh = new VerticalRefreshLayout
      {
        Y = Application.GetRealHeight(56),
        Height = Application.GetRealHeight(50 * 5),
      };
      verticalRefresh.BeginHeaderRefreshingAction += () =>
      {
              //关闭刷新View;
              verticalRefresh.EndHeaderRefreshing();
      };
      if (list.Count == 0)
      {
        Button btnTipNot = new Button
        {
            LogicView.DateView view = new LogicView.DateView();
            view.btnTitle.Text = titleText;
            view.FLayoutView(frameLayout, list.Count);
            view.btnCancel.MouseUpEventHandler += (sender, e) =>
            {
                //移除fLayout界面
                view.frameLayout.RemoveFromParent();
            };
            for (int i = 0; i < list.Count; i++)
            {
                string str = list[i];
                LogicView.CheckView checkView = new LogicView.CheckView();
                checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
                checkView.btnText.TextSize = textSize;
                view.frameLayout.AddChidren(checkView.FLayoutView());
                checkView.btnText.Text = str;
                checkView.btnClick.Tag = str;//标记
          X = Application.GetRealWidth(93),
          Y = Application.GetRealHeight(80),
          Width = Application.GetRealWidth(158),
          Height = Application.GetRealWidth(158),
          UnSelectedImagePath = "TipNot.png",
                if (stateTextList.Contains(str))
                {
                    //显示之前的选中状态
                    checkView.btnCheckIcon.IsSelected = true;
                }
                //点击事件
                checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
                {
        };
        view.frameLayout.AddChidren(btnTipNot);
                    string clickIndex = checkView.btnClick.Tag.ToString();
                    checkView.btnClick.IsSelected = !checkView.btnClick.IsSelected;
                    if (checkView.btnClick.IsSelected)
                    {
                        checkView.btnCheckIcon.IsSelected = true;
                        if (!stateTextList.Contains(clickIndex))
                        {
                            //添加选中数据
                            stateTextList.Add(clickIndex);
                        }
                    }
                    else
                    {
                        checkView.btnCheckIcon.IsSelected = false;
                        if (stateTextList.Contains(clickIndex))
                        {
                            //移除选中数据
                            stateTextList.Remove(clickIndex);
                        }
                    }
        Button btnTipNotText = new Button()
        {
          Y = btnTipNot.Bottom + Application.GetRealHeight(16),
          Height = Application.GetRealHeight(20),
          TextID = StringId.secnenull,
          TextColor = CSS.CSS_Color.textColor,
          TextSize = LogicView.TextSize.text14,
          TextAlignment = TextAlignment.Center,
        };
        view.frameLayout.AddChidren(btnTipNotText);
      }
      else if (list.Count > 0 && list.Count <= 5)
      {
        view.frameLayout.AddChidren(frameL);
      }
      else if (list.Count > 5)
      {
        view.frameLayout.AddChidren(verticalRefresh);
                };
            }
            view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
            {
                if (stateTextList.Count == 0)
                {
                    return;
                }
                action(stateTextList);
                //移除fLayout界面
                frameLayout.RemoveFromParent();
            };
      }
      ///定义一个Btn记录选中状态
      Button checkBtn = new Button
      {
        Tag = "unknown",
      };
      for (int i = 0; i < list.Count; i++)
      {
        string strName = list[i];
        LogicView.CheckView checkView = new LogicView.CheckView();
        checkView.btnText.TextSize = LogicView.TextSize.text14;
        if (list.Count <= 5)
        {
          checkView.frameLayout.Y = Application.GetRealWidth(i * 50);
          frameL.AddChidren(checkView.FLayoutView());
          if (line - 1 == i)
          {
            checkView.btnLine.BackgroundColor = CSS.CSS_Color.view;
          }
        }
        else
        {
          verticalRefresh.AddChidren(checkView.FLayoutView());
        }
        /// <summary>
        /// 月-多选择
        /// </summary>
        /// <param name="frameLayout">父控件</param>
        /// <param name="action">显示文本字体大小</param>
        public void MonSelectShow(FrameLayout frameLayout, Logic logic, Action<List<string>> action)
        if (stateList.Contains(strName))
        {
            LogicView.MonView monView = new LogicView.MonView();
            monView.btnTitle.TextID = StringId.monthly;
            monView.FLayoutView(frameLayout);
            monView.btnCancel.MouseUpEventHandler += (sender, e) =>
            {
                monView.frameLayout.RemoveFromParent();
            };
            //定义一个局部monList列表用来记录选中数据;
            List<string> monList = new List<string>();
            if (logic.cycle.type == "mon")
            {
                //加载之前保存的数据
                monList.AddRange(logic.cycle.value);
            }
            //定义一个变量记录行数
            int lineSun = 0;
            for (int i = 1; i < 32; i++)
            {
                Button monTextBtn = new Button
                {
                    Width = Application.GetRealWidth(30),
                    Height = Application.GetRealWidth(30),
                    Radius = (uint)Application.GetRealWidth(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;
                }
                action(monList);
                frameLayout.RemoveFromParent();
            };
          checkView.btnCheckIcon.IsSelected = true;
        }
        /// <summary>
        /// 超出5个元素该用滑动控件
        /// </summary>
        /// <param name="frame">显示在哪个界面的父控件</param>
        /// <param name="list">显示数据源</param>
        /// <param name="titleText">标题</param>
        /// <param name="action">返回值索引值</param>
        public void FrameOrVv(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<int> action)
        checkView.btnText.Text = strName;
        checkView.btnClick.Tag = i;//标记
                                   //点击事件
        checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
        {
          checkBtn.IsSelected = false;
          checkView.btnCheckIcon.IsSelected = true;
          checkBtn = checkView.btnCheckIcon;
          checkBtn.Tag = checkView.btnClick.Tag.ToString();
        };
            int line = 0;
            if (list.Count == 0 || list.Count > 5)
            {
                //超出5个只能默认5个;
                line = 5;
            }
            else
            {
                line = list.Count;
            }
            FrameLayout frameLayout = new FrameLayout
            {
                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
            };
            frame.AddChidren(frameLayout);
            LogicView.DateView view = new LogicView.DateView();
            view.btnTitle.TextID = titleText;
            view.FLayoutView(frameLayout, line);
            view.btnCancel.MouseUpEventHandler += (sender, e) =>
            {
                //移除fLayout界面
                frameLayout.RemoveFromParent();
            };
            //小于5使用
            FrameLayout frameL = new FrameLayout
            {
                Y = Application.GetRealHeight(56),
                Height = Application.GetRealHeight(50 * line),
            };
            //大于5使用
            VerticalRefreshLayout verticalRefresh = new VerticalRefreshLayout
            {
                Y = Application.GetRealHeight(56),
                Height = Application.GetRealHeight(50 * 5),
            };
            verticalRefresh.BeginHeaderRefreshingAction += () =>
            {
                //关闭刷新View;
                verticalRefresh.EndHeaderRefreshing();
            };
            if (list.Count == 0)
            {
                Button btnTipNot = new Button
                {
                    X = Application.GetRealWidth(93),
                    Y = Application.GetRealHeight(80),
                    Width = Application.GetRealWidth(158),
                    Height = Application.GetRealWidth(158),
                    UnSelectedImagePath = "TipNot.png",
                };
                view.frameLayout.AddChidren(btnTipNot);
                Button btnTipNotText = new Button()
                {
                    Y = btnTipNot.Bottom + Application.GetRealHeight(16),
                    Height = Application.GetRealHeight(20),
                    TextID = StringId.secnenull,
                    TextColor = CSS.CSS_Color.textColor,
                    TextSize = LogicView.TextSize.text14,
                    TextAlignment = TextAlignment.Center,
                };
                view.frameLayout.AddChidren(btnTipNotText);
            }
            else if (list.Count > 0 && list.Count <= 5)
            {
                view.frameLayout.AddChidren(frameL);
            }
            else if (list.Count > 5)
            {
                view.frameLayout.AddChidren(verticalRefresh);
            }
            ///定义一个Btn记录选中状态
            Button checkBtn = new Button
            {
                Tag = "unknown",
            };
            for (int i = 0; i < list.Count; i++)
            {
                string strName = list[i];
                LogicView.CheckView checkView = new LogicView.CheckView();
                checkView.btnText.TextSize = LogicView.TextSize.text14;
                if (list.Count <= 5)
                {
                    checkView.frameLayout.Y = Application.GetRealWidth(i * 50);
                    frameL.AddChidren(checkView.FLayoutView());
                    if (line - 1 == i)
                    {
                        checkView.btnLine.BackgroundColor = CSS.CSS_Color.view;
                    }
                }
                else
                {
                    verticalRefresh.AddChidren(checkView.FLayoutView());
                }
                if (stateList.Contains(strName))
                {
                    checkView.btnCheckIcon.IsSelected = true;
                }
                checkView.btnText.Text = strName;
                checkView.btnClick.Tag = i;//标记
                //点击事件
                checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
                {
                    checkBtn.IsSelected = false;
                    checkView.btnCheckIcon.IsSelected = true;
                    checkBtn = checkView.btnCheckIcon;
                    checkBtn.Tag = checkView.btnClick.Tag.ToString();
                };
            }
            view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
            {
                if (checkBtn.Tag.ToString() == "unknown")
                {
                    return;
                }
                //列表索引值
                int indexValue = int.Parse(checkBtn.Tag.ToString());
                action(indexValue);
                //移除fLayout界面
                frameLayout.RemoveFromParent();
            };
        }
        /// <summary>
        /// 超出5个元素该用滑动控件
        /// </summary>
        /// <param name="frame">显示在哪个界面的父控件</param>
        /// <param name="list">显示数据源</param>
        /// <param name="stateList">之前状态数据源</param>
        /// <param name="titleText">标题</param>
        /// <param name="action">返回值列表</param>
        public void FrameOrVvList(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<List<string>> action)
      }
      view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
      {
        if (checkBtn.Tag.ToString() == "unknown")
        {
            int line = 0;
            if (list.Count == 0 || list.Count > 5)
            {
                //超出5个只能默认5个;
                line = 5;
            }
            else
            {
                line = list.Count;
            }
            FrameLayout frameLayout = new FrameLayout
            {
                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
            };
            frame.AddChidren(frameLayout);
            LogicView.DateView view = new LogicView.DateView();
            view.btnTitle.TextID = titleText;
            view.FLayoutView(frameLayout, line);
            view.btnCancel.MouseUpEventHandler += (sender, e) =>
            {
                //移除fLayout界面
                frameLayout.RemoveFromParent();
            };
            //小于5使用
            FrameLayout frameL = new FrameLayout
            {
                Y = Application.GetRealHeight(56),
                Height = Application.GetRealHeight(50 * line),
            };
            //大于5使用
            VerticalRefreshLayout verticalRefresh = new VerticalRefreshLayout
            {
                Y = Application.GetRealHeight(56),
                Height = Application.GetRealHeight(50 * 5),
            };
            verticalRefresh.BeginHeaderRefreshingAction += () =>
            {
                //关闭刷新View;
                verticalRefresh.EndHeaderRefreshing();
            };
            if (list.Count == 0)
            {
                //Button btnTipNot = new Button
                //{
                //    X = Application.GetRealWidth(93),
                //    Y = Application.GetRealHeight(80),
                //    Width = Application.GetRealWidth(158),
                //    Height = Application.GetRealWidth(158),
                //    UnSelectedImagePath = "TipNot.png",
                //};
                //view.frameLayout.AddChidren(btnTipNot);
                //Button btnTipNotText = new Button()
                //{
                //    Y = btnTipNot.Bottom + Application.GetRealHeight(16),
                //    Height = Application.GetRealHeight(20),
                //    TextID = StringId.secnenull,
                //    TextColor = CSS.CSS_Color.textColor,
                //    TextSize = LogicView.TextSize.text14,
                //    TextAlignment = TextAlignment.Center,
                //};
                //view.frameLayout.AddChidren(btnTipNotText);
            }
            else if (list.Count > 0 && list.Count <= 5)
            {
                view.frameLayout.AddChidren(frameL);
            }
            else if (list.Count > 5)
            {
                view.frameLayout.AddChidren(verticalRefresh);
            }
            List<string> selecetdList = new List<string>();
            for (int i = 0; i < list.Count; i++)
            {
                string strName = list[i];
                LogicView.CheckView checkView = new LogicView.CheckView();
                checkView.btnText.TextSize = LogicView.TextSize.text14;
                if (list.Count <= 5)
                {
                    checkView.frameLayout.Y = Application.GetRealWidth(i * 50);
                    frameL.AddChidren(checkView.FLayoutView());
                    if (line - 1 == i)
                    {
                        checkView.btnLine.BackgroundColor = CSS.CSS_Color.view;
                    }
                }
                else
                {
                    verticalRefresh.AddChidren(checkView.FLayoutView());
                }
                if (stateList.Contains(strName))
                {
                    checkView.btnClick.IsSelected = true;
                    checkView.btnCheckIcon.IsSelected = true;
                    selecetdList.Add(strName);
                }
                checkView.btnText.Text = strName;
                checkView.btnClick.Tag = strName;//标记
                //点击事件
                checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
                {
                    checkView.btnClick.IsSelected = !checkView.btnClick.IsSelected;
                    checkView.btnCheckIcon.IsSelected = checkView.btnClick.IsSelected;
                    if (checkView.btnClick.IsSelected)
                    {
                        if (!selecetdList.Contains(checkView.btnClick.Tag.ToString()))
                        {
                            selecetdList.Add(checkView.btnClick.Tag.ToString());
                        }
                    }
                    else
                    {
                        if (selecetdList.Contains(checkView.btnClick.Tag.ToString()))
                        {
                            selecetdList.Remove(checkView.btnClick.Tag.ToString());
                        }
                    }
                };
            }
            view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
            {
                if (selecetdList.Count == 0)
                {
                    return;
                }
                //列表索引值
                action(selecetdList);
                //移除fLayout界面
                frameLayout.RemoveFromParent();
            };
          return;
        }
              //列表索引值
              int indexValue = int.Parse(checkBtn.Tag.ToString());
        action(indexValue);
              //移除fLayout界面
              frameLayout.RemoveFromParent();
      };
        /// <summary>
        /// 温湿度组合界面
        /// </summary>
        /// <param name="frameLayout">父控件</param>
        /// <param name="text1">标题文本1</param>
        /// <param name="text2">标题文本2</param>
        /// <param name="action">回调函数</param>
        public void ViewZuHe(FrameLayout frameLayout, int text1, int text2, Action<int, FrameLayout> action)
    }
    /// <summary>
    /// 超出5个元素该用滑动控件
    /// </summary>
    /// <param name="frame">显示在哪个界面的父控件</param>
    /// <param name="list">显示数据源</param>
    /// <param name="stateList">之前状态数据源</param>
    /// <param name="titleText">标题</param>
    /// <param name="action">返回值列表</param>
    public void FrameOrVvList(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<List<string>> action)
    {
      int line = 0;
      if (list.Count == 0 || list.Count > 5)
      {
        //超出5个只能默认5个;
        line = 5;
      }
      else
      {
        line = list.Count;
      }
      FrameLayout frameLayout = new FrameLayout
      {
        BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
      };
      frame.AddChidren(frameLayout);
      LogicView.DateView view = new LogicView.DateView();
      view.btnTitle.TextID = titleText;
      view.FLayoutView(frameLayout, line);
      view.btnCancel.MouseUpEventHandler += (sender, e) =>
      {
              //移除fLayout界面
              frameLayout.RemoveFromParent();
      };
      //小于5使用
      FrameLayout frameL = new FrameLayout
      {
        Y = Application.GetRealHeight(56),
        Height = Application.GetRealHeight(50 * line),
      };
      //大于5使用
      VerticalRefreshLayout verticalRefresh = new VerticalRefreshLayout
      {
        Y = Application.GetRealHeight(56),
        Height = Application.GetRealHeight(50 * 5),
      };
      verticalRefresh.BeginHeaderRefreshingAction += () =>
      {
              //关闭刷新View;
              verticalRefresh.EndHeaderRefreshing();
      };
      if (list.Count == 0)
      {
        //Button btnTipNot = new Button
        //{
        //    X = Application.GetRealWidth(93),
        //    Y = Application.GetRealHeight(80),
        //    Width = Application.GetRealWidth(158),
        //    Height = Application.GetRealWidth(158),
        //    UnSelectedImagePath = "TipNot.png",
        //};
        //view.frameLayout.AddChidren(btnTipNot);
        //Button btnTipNotText = new Button()
        //{
        //    Y = btnTipNot.Bottom + Application.GetRealHeight(16),
        //    Height = Application.GetRealHeight(20),
        //    TextID = StringId.secnenull,
        //    TextColor = CSS.CSS_Color.textColor,
        //    TextSize = LogicView.TextSize.text14,
        //    TextAlignment = TextAlignment.Center,
        //};
        //view.frameLayout.AddChidren(btnTipNotText);
      }
      else if (list.Count > 0 && list.Count <= 5)
      {
        view.frameLayout.AddChidren(frameL);
      }
      else if (list.Count > 5)
      {
        view.frameLayout.AddChidren(verticalRefresh);
      }
      List<string> selecetdList = new List<string>();
      for (int i = 0; i < list.Count; i++)
      {
        string strName = list[i];
        LogicView.CheckView checkView = new LogicView.CheckView();
        checkView.btnText.TextSize = LogicView.TextSize.text14;
        if (list.Count <= 5)
        {
            FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewMiddle };
            frameLayout.AddChidren(frame);
            LogicView.TopView topView = new LogicView.TopView();
            topView.topNameBtn.TextID = StringId.wendu;
            frame.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
            {
                frame.RemoveFromParent();
            };
            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,
            };
            frame.AddChidren(viewLayout);
            //温,湿度高于
            LogicView.SelectTypeView temperaturehigherView = new LogicView.SelectTypeView();
            temperaturehigherView.btnIcon.Visible = false;
            temperaturehigherView.btnText.X = Application.GetRealWidth(16);
            temperaturehigherView.btnLine.X = Application.GetRealWidth(16);
            temperaturehigherView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
            temperaturehigherView.btnText.TextID = text1;
            viewLayout.AddChidren(temperaturehigherView.FLayoutView());
            //温,湿度低于
            LogicView.SelectTypeView temperatureunderView = new LogicView.SelectTypeView();
            temperatureunderView.frameLayout.Y = temperaturehigherView.frameLayout.Bottom;
            temperatureunderView.btnIcon.Visible = false;
            temperatureunderView.btnText.X = Application.GetRealWidth(16);
            temperatureunderView.btnLine.X = Application.GetRealWidth(16);
            temperatureunderView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
            temperatureunderView.btnText.TextID = text2;
            viewLayout.AddChidren(temperatureunderView.FLayoutView());
            //温,湿度高于
            temperaturehigherView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                action(text1, frame);
            };
            //温,湿度低于
            temperatureunderView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                action(text2, frame);
            };
          checkView.frameLayout.Y = Application.GetRealWidth(i * 50);
          frameL.AddChidren(checkView.FLayoutView());
          if (line - 1 == i)
          {
            checkView.btnLine.BackgroundColor = CSS.CSS_Color.view;
          }
        }
        /// <summary>
        /// 获取界面列表
        /// </summary>
        /// <param name="isStr">自己定义自己用</param>
        /// <returns></returns>
        public List<string> GetViewList(string isStr)
        else
        {
            List<string> list = null;
            switch (isStr)
          verticalRefresh.AddChidren(checkView.FLayoutView());
        }
        if (stateList.Contains(strName))
        {
          checkView.btnClick.IsSelected = true;
          checkView.btnCheckIcon.IsSelected = true;
          selecetdList.Add(strName);
        }
        checkView.btnText.Text = strName;
        checkView.btnClick.Tag = strName;//标记
                                         //点击事件
        checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
        {
          checkView.btnClick.IsSelected = !checkView.btnClick.IsSelected;
          checkView.btnCheckIcon.IsSelected = checkView.btnClick.IsSelected;
          if (checkView.btnClick.IsSelected)
          {
            if (!selecetdList.Contains(checkView.btnClick.Tag.ToString()))
            {
                case "mode":
                    {
                        list = new List<string> {
              selecetdList.Add(checkView.btnClick.Tag.ToString());
            }
          }
          else
          {
            if (selecetdList.Contains(checkView.btnClick.Tag.ToString()))
            {
              selecetdList.Remove(checkView.btnClick.Tag.ToString());
            }
          }
        };
      }
      view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
      {
        if (selecetdList.Count == 0)
        {
          return;
        }
              //列表索引值
              action(selecetdList);
              //移除fLayout界面
              frameLayout.RemoveFromParent();
      };
    }
    /// <summary>
    /// 温湿度组合界面
    /// </summary>
    /// <param name="frameLayout">父控件</param>
    /// <param name="text1">标题文本1</param>
    /// <param name="text2">标题文本2</param>
    /// <param name="action">回调函数</param>
    public void ViewZuHe(FrameLayout frameLayout, int text1, int text2, Action<int, FrameLayout> action)
    {
      FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewMiddle };
      frameLayout.AddChidren(frame);
      LogicView.TopView topView = new LogicView.TopView();
      topView.topNameBtn.TextID = StringId.wendu;
      frame.AddChidren(topView.FLayoutView());
      topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
      {
        frame.RemoveFromParent();
      };
      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,
      };
      frame.AddChidren(viewLayout);
      //温,湿度高于
      LogicView.SelectTypeView temperaturehigherView = new LogicView.SelectTypeView();
      temperaturehigherView.btnIcon.Visible = false;
      temperaturehigherView.btnText.X = Application.GetRealWidth(16);
      temperaturehigherView.btnLine.X = Application.GetRealWidth(16);
      temperaturehigherView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
      temperaturehigherView.btnText.TextID = text1;
      viewLayout.AddChidren(temperaturehigherView.FLayoutView());
      //温,湿度低于
      LogicView.SelectTypeView temperatureunderView = new LogicView.SelectTypeView();
      temperatureunderView.frameLayout.Y = temperaturehigherView.frameLayout.Bottom;
      temperatureunderView.btnIcon.Visible = false;
      temperatureunderView.btnText.X = Application.GetRealWidth(16);
      temperatureunderView.btnLine.X = Application.GetRealWidth(16);
      temperatureunderView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
      temperatureunderView.btnText.TextID = text2;
      viewLayout.AddChidren(temperatureunderView.FLayoutView());
      //温,湿度高于
      temperaturehigherView.btnClick.MouseUpEventHandler += (sen, e) =>
      {
        action(text1, frame);
      };
      //温,湿度低于
      temperatureunderView.btnClick.MouseUpEventHandler += (sen, e) =>
      {
        action(text2, frame);
      };
    }
    /// <summary>
    /// 获取界面列表
    /// </summary>
    /// <param name="isStr">自己定义自己用</param>
    /// <returns></returns>
    public List<string> GetViewList(string isStr)
    {
      List<string> list = null;
      switch (isStr)
      {
        case "mode":
          {
            list = new List<string> {
                                Language.StringByID(StringId.coolLogic),
                                 Language.StringByID(StringId.heatingLogic),
                                  Language.StringByID(StringId.autoLogic),
                                   Language.StringByID(StringId.dehumidifyLogic),
                            };
                    }
                    break;
                case "fan":
                    {
                        list = new List<string> {
          }
          break;
        case "fan":
          {
            list = new List<string> {
                                Language.StringByID(StringId.LowWindSpeed),
                                 Language.StringByID(StringId.MiddleWindSpeed),
                                  Language.StringByID(StringId.HighWindSpeed),
                                   Language.StringByID(StringId.Auto),
                            };
                    }
                    break;
                case "floorheatingmode":
                    {
                        list = new List<string> {
          }
          break;
        case "floorheatingmode":
          {
            list = new List<string> {
                                Language.StringByID(StringId.dayMode),
                                 Language.StringByID(StringId.nightMode),
                                  Language.StringByID(StringId.leaveMode),
                                   Language.StringByID(StringId.ordinaryMode),
                                Language.StringByID(StringId.timeMode),
                            };
                    }
                    break;
                case "airFresh":
                    {
                        list = new List<string> {
          }
          break;
        case "airFresh":
          {
            list = new List<string> {
                                Language.StringByID(StringId.zidong),
                                 Language.StringByID(StringId.shoudong),
                                  Language.StringByID(StringId.dingshi),
                                   Language.StringByID(StringId.zhineng),
                            };
                    }
                    break;
                case "week":
                    {
                        list = new List<string> {
          }
          break;
        case "week":
          {
            list = new List<string> {
             Language.StringByID(StringId.monday),
             Language.StringByID(StringId.tuesday),
             Language.StringByID(StringId.wednesday),
@@ -669,470 +669,481 @@
             Language.StringByID(StringId.saturday),
             Language.StringByID(StringId.sunday),
                      };
                    }
                    break;
                case "andor":
                    {
                        list = new List<string> {
          }
          break;
        case "andor":
          {
            list = new List<string> {
                     Language.StringByID(StringId.andCondition),
                     Language.StringByID(StringId.orCondition),
                      };
                    }
                    break;
                case "time":
                    {
                        list = new List<string> {
                   "30 s",
          }
          break;
        case "time":
          {
            list = new List<string> {
                  // "30 s",
                   "1 min",
                   "2 min",
                   "3 min",
                   "5 min",
                   "10 min",
                      };
                    }
                    break;
                case "pm25":
                    {
                        list = new List<string> {
          }
          break;
        case "pm25":
          {
            list = new List<string> {
             Language.StringByID(StringId.pmyou),
             Language.StringByID(StringId.pmliang),
             Language.StringByID(StringId.pmqingdu),
             Language.StringByID(StringId.pmzhongdu),
             Language.StringByID(StringId.pmzhongduwuran),
                      };
                    }
                    break;
                case "co2":
                    {
                        list = new List<string> {
          }
          break;
        case "co2":
          {
            list = new List<string> {
             Language.StringByID(StringId.zhengchang)+ ":0~1000PPM",
             Language.StringByID(StringId.piangao) + ":1001~2000PPM",
             Language.StringByID(StringId.chaobiao) + ":>2000PPM",
                      };
                    }
                    break;
                case "tvoc":
                    {
                        list = new List<string> {
          }
          break;
        case "tvoc":
          {
            list = new List<string> {
             Language.StringByID(StringId.zhengchang)+ ":0~399PPB",
             Language.StringByID(StringId.chaobiao)+ ":400~699PPB",
             Language.StringByID(StringId.yanzhong)+":>700PPB",
                      };
                    }
                    break;
                case "hcho":
                    {
                        list = new List<string> {
          }
          break;
        case "hcho":
          {
            list = new List<string> {
             Language.StringByID(StringId.youxiu)+ ":(0~0.08mg/m3)",
             Language.StringByID(StringId.lianghao)+":(0.09~0.1mg/m3)",
             Language.StringByID(StringId.chaobiao)+ ":>(0.1mg/m3)",
                      };
                    }
                    break;
                case "security":
                    {
                        list = new List<string> {
          }
          break;
        case "security":
          {
            list = new List<string> {
             Language.StringByID(StringId.bufang ),
             Language.StringByID(StringId.chefang),
                      };
                    }
                    break;
                case "地理围栏":
                    {
                        list = new List<string> {
          }
          break;
        case "地理围栏":
          {
            list = new List<string> {
             Language.StringByID(StringId.likai ),
             Language.StringByID(StringId.daoda),
                       };
                    }
                    break;
            }
            return list;
        }
        /// <summary>
        /// 模式/风速互相转换值的方法
        /// </summary>
        /// <param name="text">文本</param>
        /// <param name="type">自己定义自己用</param>
        /// <returns></returns>
        public string GetModeValueString(string text, string type)
        {
            string str = "";
            switch (type)
            {
                case "mode":
                    {
                        if (text == Language.StringByID(StringId.coolLogic))
                        {
                            str = "cool";
                        }
                        else if (text == Language.StringByID(StringId.heatingLogic))
                        {
                            str = "heat";
                        }
                        else if (text == Language.StringByID(StringId.autoLogic))
                        {
                            str = "auto";
                        }
                        else if (text == Language.StringByID(StringId.dehumidifyLogic))
                        {
                            str = "dry";
                        }
                    }
                    break;
                case "fan":
                    {
                        if (text == Language.StringByID(StringId.HighWindSpeed))
                        {
                            str = "high";
                        }
                        else if (text == Language.StringByID(StringId.MiddleWindSpeed))
                        {
                            str = "medium";
                        }
                        else if (text == Language.StringByID(StringId.LowWindSpeed))
                        {
                            str = "low";
                        }
                        else if (text == Language.StringByID(StringId.Auto))
                        {
                            str = "auto";
                        }
                    }
                    break;
                case "floorheatingmode":
                    {
                        if (text == Language.StringByID(StringId.dayMode))
                        {
                            str = "day";
                        }
                        else if (text == Language.StringByID(StringId.nightMode))
                        {
                            str = "night";
                        }
                        else if (text == Language.StringByID(StringId.leaveMode))
                        {
                            str = "away";
                        }
                        else if (text == Language.StringByID(StringId.ordinaryMode))
                        {
                            str = "normal";
                        }
                        else if (text == Language.StringByID(StringId.timeMode))
                        {
                            str = "timer";
                        }
                    }
                    break;
                case "airFresh":
                    {
                        if (text == Language.StringByID(StringId.autoLogic))
                        {
                            str = "auto";
                        }
                        else if (text == Language.StringByID(StringId.shoudong))
                        {
                            str = "manual";
                        }
                        else if (text == Language.StringByID(StringId.dingshi))
                        {
                            str = "timer";
                        }
                        else if (text == Language.StringByID(StringId.zhineng))
                        {
                            str = "smart";
                        }
                    }
                    break;
            }
            return str;
        }
        /// <summary>
        /// 星期int和string互相转换值的方法
        /// </summary>
        /// <param name="list"></param>
        /// <param name="str_or_int"></param>
        /// <returns></returns>
        public List<string> GetWeekString(List<string> list, string str_or_int)
        {
            string weekTextName = "";
            List<string> stateList = new List<string>();
            for (int i = 0; i < list.Count; i++)
            {
                var s = list[i];
                if (str_or_int == "int")
                {
                    switch (s)
                    {
                        case "1":
                            {
                                weekTextName = Language.StringByID(StringId.monday);
                            }
                            break;
                        case "2":
                            {
                                weekTextName = Language.StringByID(StringId.tuesday);
                            }
                            break;
                        case "3":
                            {
                                weekTextName = Language.StringByID(StringId.wednesday);
                            }
                            break;
                        case "4":
                            {
                                weekTextName = Language.StringByID(StringId.thursday);
                            }
                            break;
                        case "5":
                            {
                                weekTextName = Language.StringByID(StringId.friday);
                            }
                            break;
                        case "6":
                            {
                                weekTextName = Language.StringByID(StringId.saturday);
                            }
                            break;
                        case "0":
                            {
                                weekTextName = Language.StringByID(StringId.sunday);
                            }
                            break;
                    }
                }
                else
                {
                    if (Language.StringByID(StringId.monday) == s)
                    {
                        weekTextName = "1";
                    }
                    else if (Language.StringByID(StringId.tuesday) == s)
                    {
                        weekTextName = "2";
                    }
                    else if (Language.StringByID(StringId.wednesday) == s)
                    {
                        weekTextName = "3";
                    }
                    else if (Language.StringByID(StringId.thursday) == s)
                    {
                        weekTextName = "4";
                    }
                    else if (Language.StringByID(StringId.friday) == s)
                    {
                        weekTextName = "5";
                    }
                    else if (Language.StringByID(StringId.saturday) == s)
                    {
                        weekTextName = "6";
                    }
                    else if (Language.StringByID(StringId.sunday) == s)
                    {
                        weekTextName = "0";
                    }
                }
                stateList.Add(weekTextName);
            }
            return stateList;
        }
        /// <summary>
        /// 数值返回文本
        /// </summary>
        /// <param name="type">类型</param>
        /// <param name="strValue">值</param>
        /// <returns></returns>
        public string GetString(string type, string strValue)
        {
            string text = "";
            switch (type)
            {
                case "pm25":
                    {
                        switch (strValue) {
                            case "(0,35]": {
                                    text = Language.StringByID(StringId.pmyou);
                                }
                                break;
                            case "(35,75]": {
                                    text = Language.StringByID(StringId.pmliang);
                                } break;
                            case "(75,115]": {
                                    text = Language.StringByID(StringId.pmqingdu);
                                } break;
                            case "(115,150]": {
                                    text = Language.StringByID(StringId.pmzhongdu);
                                } break;
                            case "(151,100000]": {
                                    text = Language.StringByID(StringId.pmzhongduwuran);
                                } break;
                        }
                    }
                    break;
                case "co2":
                    {
                        switch (strValue)
                        {
                            case "(0,1000]":
                                {
                                    text = Language.StringByID(StringId.zhengchang) + ":0~1000PPM";
                                }
                                break;
                            case "(1000,2000]":
                                {
                                    text = Language.StringByID(StringId.piangao) + ":1001~2000PPM";
                                }
                                break;
                            case "(2000,200000]":
                                {
                                    text = Language.StringByID(StringId.chaobiao) + ":>2000PPM";
                                }
                                break;
                        }
                    }
                    break;
                case "tvoc":
                    {
                        switch (strValue)
                        {
                            case "(0,399]":
                                {
                                    text = Language.StringByID(StringId.zhengchang) + ":0~399PPB";
                                }
                                break;
                            case "(399,699]":
                                {
                                    text = Language.StringByID(StringId.chaobiao) + ":400~699PPB";
                                }
                                break;
                            case "(699,70000]":
                                {
                                    text = Language.StringByID(StringId.yanzhong) + ":>700PPB";
                                }
                                break;
                        }
                    }
                    break;
                case "hcho":
                    {
                        switch (strValue)
                        {
                            case "(0,0.08]":
                                {
                                    text = Language.StringByID(StringId.youxiu) + ":(0~0.08mg/m3)";
                                }
                                break;
                            case "(0.08,0.1]":
                                {
                                    text = Language.StringByID(StringId.lianghao) + ":(0.09~0.1mg/m3)";
                                }
                                break;
                            case "(0.1,10000]":
                                {
                                    text = Language.StringByID(StringId.chaobiao) + ":>(0.1mg/m3)";
                                }
                                break;
                        }
                    }
                    break;
            }
            return text;
        }
        /// <summary>
        /// 本文返回数值返回
        /// </summary>
        /// <param name="type">类型</param>
        /// <param name="text">文本</param>
        /// <returns></returns>
        public string GetValue(string type, string text)
        {
            string value = "";
            switch (type)
            {
                case "pm25":
                    {
                        if (text == Language.StringByID(StringId.pmyou))
                        {
                            value = "(0,35]";
                        }
                        else if (text == Language.StringByID(StringId.pmliang))
                        {
                            value = "(35,75]";
                        }
                        else if (text == Language.StringByID(StringId.pmqingdu))
                        {
                            value = "(75,115]";
                        }
                        else if (text == Language.StringByID(StringId.pmzhongdu))
                        {
                            value = "(115,150]";
                        }
                        else if (text == Language.StringByID(StringId.pmzhongduwuran))
                        {
                            value = "(150,100000]";
                        }
                    }
                    break;
                case "co2":
                    {
                        if (text == Language.StringByID(StringId.zhengchang) + ":0~1000PPM")
                        {
                            value = "(0,1000]";
                        }
                        else if (text == Language.StringByID(StringId.piangao) + ":1001~2000PPM")
                        {
                            value = "(1000,2000]";
                        }
                        else if (text == Language.StringByID(StringId.chaobiao) + ":>2000PPM")
                        {
                            value = "(2000,200000]";
                        }
                    }
                    break;
                case "tvoc":
                    {
                        if (text == Language.StringByID(StringId.zhengchang) + ":0~399PPB")
                        {
                            value = "(0,399]";
                        }
                        else if (text == Language.StringByID(StringId.chaobiao) + ":400~699PPB")
                        {
                            value = "(399,699]";
                        }
                        else if (text == Language.StringByID(StringId.yanzhong) + ":>700PPB")
                        {
                            value = "(699,70000]";
                        }
                    }
                    break;
                case "hcho":
                    {
                        if (text == Language.StringByID(StringId.youxiu) + ":(0~0.08mg/m3)")
                        {
                            value = "(0,0.08]";
                        }
                        else if (text == Language.StringByID(StringId.lianghao) + ":(0.09~0.1mg/m3)")
                        {
                            value = "(0.08,0.1]";
                        }
                        else if (text == Language.StringByID(StringId.chaobiao) + ":>(0.1mg/m3)")
                        {
                            value = "(0.1,10000]";
                        }
                    }
                    break;
            }
            return value;
        }
          }
          break;
      }
      return list;
    }
    /// <summary>
    /// 模式/风速互相转换值的方法
    /// </summary>
    /// <param name="text">文本</param>
    /// <param name="type">自己定义自己用</param>
    /// <returns></returns>
    public string GetModeValueString(string text, string type)
    {
      string str = "";
      switch (type)
      {
        case "mode":
          {
            if (text == Language.StringByID(StringId.coolLogic))
            {
              str = "cool";
            }
            else if (text == Language.StringByID(StringId.heatingLogic))
            {
              str = "heat";
            }
            else if (text == Language.StringByID(StringId.autoLogic))
            {
              str = "auto";
            }
            else if (text == Language.StringByID(StringId.dehumidifyLogic))
            {
              str = "dry";
            }
          }
          break;
        case "fan":
          {
            if (text == Language.StringByID(StringId.HighWindSpeed))
            {
              str = "high";
            }
            else if (text == Language.StringByID(StringId.MiddleWindSpeed))
            {
              str = "medium";
            }
            else if (text == Language.StringByID(StringId.LowWindSpeed))
            {
              str = "low";
            }
            else if (text == Language.StringByID(StringId.Auto))
            {
              str = "auto";
            }
          }
          break;
        case "floorheatingmode":
          {
            if (text == Language.StringByID(StringId.dayMode))
            {
              str = "day";
            }
            else if (text == Language.StringByID(StringId.nightMode))
            {
              str = "night";
            }
            else if (text == Language.StringByID(StringId.leaveMode))
            {
              str = "away";
            }
            else if (text == Language.StringByID(StringId.ordinaryMode))
            {
              str = "normal";
            }
            else if (text == Language.StringByID(StringId.timeMode))
            {
              str = "timer";
            }
          }
          break;
        case "airFresh":
          {
            if (text == Language.StringByID(StringId.autoLogic))
            {
              str = "auto";
            }
            else if (text == Language.StringByID(StringId.shoudong))
            {
              str = "manual";
            }
            else if (text == Language.StringByID(StringId.dingshi))
            {
              str = "timer";
            }
            else if (text == Language.StringByID(StringId.zhineng))
            {
              str = "smart";
            }
          }
          break;
      }
      return str;
    }
    /// <summary>
    /// 星期int和string互相转换值的方法
    /// </summary>
    /// <param name="list"></param>
    /// <param name="str_or_int"></param>
    /// <returns></returns>
    public List<string> GetWeekString(List<string> list, string str_or_int)
    {
      string weekTextName = "";
      List<string> stateList = new List<string>();
      for (int i = 0; i < list.Count; i++)
      {
        var s = list[i];
        if (str_or_int == "int")
        {
          switch (s)
          {
            case "1":
              {
                weekTextName = Language.StringByID(StringId.monday);
              }
              break;
            case "2":
              {
                weekTextName = Language.StringByID(StringId.tuesday);
              }
              break;
            case "3":
              {
                weekTextName = Language.StringByID(StringId.wednesday);
              }
              break;
            case "4":
              {
                weekTextName = Language.StringByID(StringId.thursday);
              }
              break;
            case "5":
              {
                weekTextName = Language.StringByID(StringId.friday);
              }
              break;
            case "6":
              {
                weekTextName = Language.StringByID(StringId.saturday);
              }
              break;
            case "0":
              {
                weekTextName = Language.StringByID(StringId.sunday);
              }
              break;
          }
        }
        else
        {
          if (Language.StringByID(StringId.monday) == s)
          {
            weekTextName = "1";
          }
          else if (Language.StringByID(StringId.tuesday) == s)
          {
            weekTextName = "2";
          }
          else if (Language.StringByID(StringId.wednesday) == s)
          {
            weekTextName = "3";
          }
          else if (Language.StringByID(StringId.thursday) == s)
          {
            weekTextName = "4";
          }
          else if (Language.StringByID(StringId.friday) == s)
          {
            weekTextName = "5";
          }
          else if (Language.StringByID(StringId.saturday) == s)
          {
            weekTextName = "6";
          }
          else if (Language.StringByID(StringId.sunday) == s)
          {
            weekTextName = "0";
          }
        }
        stateList.Add(weekTextName);
      }
      return stateList;
    }
    /// <summary>
    /// 数值返回文本
    /// </summary>
    /// <param name="type">类型</param>
    /// <param name="strValue">值</param>
    /// <returns></returns>
    public string GetString(string type, string strValue)
    {
      string text = "";
      switch (type)
      {
        case "pm25":
          {
            switch (strValue)
            {
              case "(0,35]":
                {
                  text = Language.StringByID(StringId.pmyou);
                }
                break;
              case "(35,75]":
                {
                  text = Language.StringByID(StringId.pmliang);
                }
                break;
              case "(75,115]":
                {
                  text = Language.StringByID(StringId.pmqingdu);
                }
                break;
              case "(115,150]":
                {
                  text = Language.StringByID(StringId.pmzhongdu);
                }
                break;
              case "(151,100000]":
                {
                  text = Language.StringByID(StringId.pmzhongduwuran);
                }
                break;
            }
          }
          break;
        case "co2":
          {
            switch (strValue)
            {
              case "(0,1000]":
                {
                  text = Language.StringByID(StringId.zhengchang) + ":0~1000PPM";
                }
                break;
              case "(1000,2000]":
                {
                  text = Language.StringByID(StringId.piangao) + ":1001~2000PPM";
                }
                break;
              case "(2000,200000]":
                {
                  text = Language.StringByID(StringId.chaobiao) + ":>2000PPM";
                }
                break;
            }
          }
          break;
        case "tvoc":
          {
            switch (strValue)
            {
              case "(0,399]":
                {
                  text = Language.StringByID(StringId.zhengchang) + ":0~399PPB";
                }
                break;
              case "(399,699]":
                {
                  text = Language.StringByID(StringId.chaobiao) + ":400~699PPB";
                }
                break;
              case "(699,70000]":
                {
                  text = Language.StringByID(StringId.yanzhong) + ":>700PPB";
                }
                break;
            }
          }
          break;
        case "hcho":
          {
            switch (strValue)
            {
              case "(0,0.08]":
                {
                  text = Language.StringByID(StringId.youxiu) + ":(0~0.08mg/m3)";
                }
                break;
              case "(0.08,0.1]":
                {
                  text = Language.StringByID(StringId.lianghao) + ":(0.09~0.1mg/m3)";
                }
                break;
              case "(0.1,10000]":
                {
                  text = Language.StringByID(StringId.chaobiao) + ":>(0.1mg/m3)";
                }
                break;
            }
          }
          break;
      }
      return text;
    }
    /// <summary>
    /// 本文返回数值返回
    /// </summary>
    /// <param name="type">类型</param>
    /// <param name="text">文本</param>
    /// <returns></returns>
    public string GetValue(string type, string text)
    {
      string value = "";
      switch (type)
      {
        case "pm25":
          {
            if (text == Language.StringByID(StringId.pmyou))
            {
              value = "(0,35]";
            }
            else if (text == Language.StringByID(StringId.pmliang))
            {
              value = "(35,75]";
            }
            else if (text == Language.StringByID(StringId.pmqingdu))
            {
              value = "(75,115]";
            }
            else if (text == Language.StringByID(StringId.pmzhongdu))
            {
              value = "(115,150]";
            }
            else if (text == Language.StringByID(StringId.pmzhongduwuran))
            {
              value = "(150,100000]";
            }
          }
          break;
        case "co2":
          {
            if (text == Language.StringByID(StringId.zhengchang) + ":0~1000PPM")
            {
              value = "(0,1000]";
            }
            else if (text == Language.StringByID(StringId.piangao) + ":1001~2000PPM")
            {
              value = "(1000,2000]";
            }
            else if (text == Language.StringByID(StringId.chaobiao) + ":>2000PPM")
            {
              value = "(2000,200000]";
            }
          }
          break;
        case "tvoc":
          {
            if (text == Language.StringByID(StringId.zhengchang) + ":0~399PPB")
            {
              value = "(0,399]";
            }
            else if (text == Language.StringByID(StringId.chaobiao) + ":400~699PPB")
            {
              value = "(399,699]";
            }
            else if (text == Language.StringByID(StringId.yanzhong) + ":>700PPB")
            {
              value = "(699,70000]";
            }
          }
          break;
        case "hcho":
          {
            if (text == Language.StringByID(StringId.youxiu) + ":(0~0.08mg/m3)")
            {
              value = "(0,0.08]";
            }
            else if (text == Language.StringByID(StringId.lianghao) + ":(0.09~0.1mg/m3)")
            {
              value = "(0.08,0.1]";
            }
            else if (text == Language.StringByID(StringId.chaobiao) + ":>(0.1mg/m3)")
            {
              value = "(0.1,10000]";
            }
          }
          break;
      }
      return value;
    }
  }
}