wxr
2021-01-14 d987694e57c3bce76bd5a208d74a3696db222a4a
Merge branch 'WJC' into NewFilePath
1个文件已添加
2个文件已删除
15个文件已修改
900 ■■■■ 已修改文件
.vs/HDL_APP_Project/xs/sqlite3/storage.ide 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Language.ini 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Resources/Resource.designer.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/HDL-ON_iOS.csproj 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Language.ini 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/R.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/.DS_Store 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs 174 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs 207 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs 88 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs 230 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs 107 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/sqlite3/storage.ide
Binary files differ
.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm
Binary files differ
.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal
Binary files differ
HDL-ON_Android/Assets/Language.ini
@@ -561,6 +561,15 @@
7098=晴天
7099=多云
7100=下雨
7101=*请在这个范围(1~100)设置值。
7102=还没有设置值。
7103=优:0~35ug/m³
7104=良:35~75ug/m³
7105=轻度污染:75~115ug/m³
7106=中度污染:115~150ug/m³
7107=重度污染:>150ug/m³
9000=请使用新的手机账号登录APP
HDL-ON_Android/Resources/Resource.designer.cs
@@ -2,6 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
@@ -14,7 +15,7 @@
{
    
    
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
    public partial class Resource
    {
        
HDL-ON_iOS/HDL-ON_iOS.csproj
@@ -52,7 +52,6 @@
        <MtouchExtraArgs>-gcc_flags="-dead_strip -ObjC";-w</MtouchExtraArgs>
        <MtouchI18n>cjk</MtouchI18n>
        <MtouchLink>SdkOnly</MtouchLink>
        <CodesignProvision>ComHdlOnProDevelopment20201224-3</CodesignProvision>
    </PropertyGroup>
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
        <DebugType>none</DebugType>
@@ -93,7 +92,6 @@
        </Reference>
    </ItemGroup>
    <ItemGroup>
      <PackageReference Include="Xamarin.Essentials" Version="1.6.0" />
      <PackageReference Include="Newtonsoft.Json">
        <Version>12.0.3</Version>
      </PackageReference>
@@ -101,10 +99,10 @@
        <Version>3.0.13</Version>
      </PackageReference>
      <PackageReference Include="Microsoft.AppCenter.Analytics">
        <Version>4.0.0</Version>
        <Version>4.1.0</Version>
      </PackageReference>
      <PackageReference Include="Microsoft.AppCenter.Crashes">
        <Version>4.0.0</Version>
        <Version>4.1.0</Version>
      </PackageReference>
      <PackageReference Include="ZXing.Net.Mobile">
        <Version>2.4.1</Version>
@@ -114,6 +112,9 @@
      </PackageReference>
      <PackageReference Include="Xamarin.iOS.Bugly">
        <Version>1.0.4</Version>
      </PackageReference>
      <PackageReference Include="Xamarin.Essentials">
        <Version>1.6.0</Version>
      </PackageReference>
    </ItemGroup>
    <ItemGroup>
@@ -666,4 +667,13 @@
    </ItemGroup>
    <Import Project="..\HDL_ON\HDL_ON.projitems" Label="Shared" Condition="Exists('..\HDL_ON\HDL_ON.projitems')" />
    <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
    <ProjectExtensions>
      <MonoDevelop>
        <Properties>
          <Policies>
            <DotNetNamingPolicy ResourceNamePolicy="FileFormatDefault" DirectoryNamespaceAssociation="Hierarchical" />
          </Policies>
        </Properties>
      </MonoDevelop>
    </ProjectExtensions>
</Project>
HDL-ON_iOS/Resources/Language.ini
@@ -561,6 +561,13 @@
7098=晴天
7099=多云
7100=下雨
7101=*请在这个范围(1~100)设置值。
7102=还没有设置值。
7103=优:0~35ug/m³
7104=良:35~75ug/m³
7105=轻度污染:75~115ug/m³
7106=中度污染:115~150ug/m³
7107=重度污染:>150ug/m³
9000=请使用新的手机账号登录APP
HDL_ON/Common/R.cs
@@ -555,6 +555,14 @@
        public const int clearday =7098;
        public const int cloudy= 7099;
        public const int rain = 7100;
        public const int setvalue = 7101;
        public const int nullvalue = 7102;
        public const int pmyou = 7103;
        public const int pmliang = 7104;
        public const int pmqingdu= 7105;
        public const int pmzhongdu = 7106;
        public const int pmzhongduwuran= 7107;
        #region LE新增
HDL_ON/UI/UI2/3-Intelligence/.DS_Store
Binary files differ
HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
@@ -46,7 +46,7 @@
            shiwaiView.frameLayout.Y = functionView.frameLayout.Bottom;
            shiwaiView.btnText.TextID = StringId.shiwaibainhua;
            shiwaiView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
            viewLayout.AddChidren(shiwaiView.FLayoutView());
            //viewLayout.AddChidren(shiwaiView.FLayoutView());
            #endregion
HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -183,21 +183,20 @@
            LogicMethod.dictionary(dic, "comparator", "=");
            LogicMethod.dictionary(dic, "data_type", "string");
            LogicMethod.dictionary(dic, "value", selectedValue);
            AddDictionaryList(KeyValue, dic, dicSateteList);
            AddDictionaryList(KeyValue, dic);
        }
        /// <summary>
        /// 更新数据列表
        /// </summary>
        /// <param name="keyValue">设备属性值,云雀上定义好的</param> 
        /// <param name="dictionary">选中数据</param>
        /// <param name="dicList">存储数据列表</param>
        /// <param name="dictionary">添加选中数据</param>
        /// <returns></returns>
        private void AddDictionaryList(string keyValue, Dictionary<string, string> dictionary, List<Dictionary<string, string>> dicList)
        private void AddDictionaryList(string keyValue, Dictionary<string, string> dictionary)
        {
            int indexValue = -1;
            for (int i = 0; i < dicList.Count; i++)
            for (int i = 0; i < dicSateteList.Count; i++)
            {
                var dic = dicList[i];
                var dic = dicSateteList[i];
                if (dic.ContainsValue(keyValue))
                {
                    //判断是否存在
@@ -209,14 +208,14 @@
            if (indexValue != -1)
            {
                //存在移除
                dicList.RemoveAt(indexValue);
                dicSateteList.RemoveAt(indexValue);
                //重新添加
                dicList.Insert(indexValue, dictionary);
                dicSateteList.Insert(indexValue, dictionary);
            }
            else
            {
                //新添加
                dicList.Add(dictionary);
                dicSateteList.Add(dictionary);
            }
        }
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -17,12 +17,6 @@
            for (int i = 0; i < Logic.currlogic.input.Count; i++)
            {
                Input inputCondition = Logic.currlogic.input[i];
                if (inputCondition == null)
                {
                    //防止有的空对象;
                    //正常情况下不会该现象;
                    continue;
                }
                ///各种条件的View
                LogicView.AddOutputInputView inputView = new LogicView.AddOutputInputView();
                inputView.FLayoutView(viewLayout);
@@ -170,6 +164,94 @@
                            }
                        }
                        break;
                    case "4":
                        {
                            inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
                            string strtext = "";
                            string strvalue = "";
                            foreach (var dic in dicList)
                            {
                                string key = dic["key"];
                                string comparator = dic["comparator"];
                                string value = dic["value"];
                                switch (key)
                                {
                                    case "outdoor_temp":
                                        {
                                            strvalue = value;
                                            if (comparator==">") {
                                                strtext = Language.StringByID(StringId.wendugaoyu);
                                            }
                                            else  if(comparator == "<"){
                                                strtext = Language.StringByID(StringId.wendudiyu);
                                            }
                                        }
                                        break;
                                    case "outdoor_humity":
                                        {
                                            strvalue = value;
                                            if (comparator == ">")
                                            {
                                                strtext = Language.StringByID(StringId.shidugaoyu);
                                            }
                                            else if (comparator == "<")
                                            {
                                                strtext = Language.StringByID(StringId.shidudiyu);
                                            }
                                        }
                                        break;
                                    case "pm2.5":
                                        {
                                            strtext = Language.StringByID(StringId.PM25);
                                            strvalue = new OutdoorEnvironment { }.GetString(value);
                                        }
                                        break;
                                }
                            }
                            inputView.btnText.Text = strtext;
                            inputView.btnState.Text = strvalue;
                        }
                        break;
                    case "6":
                        {
                            inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
                            foreach (var dic in dicList)
                            {
                                string strtext = "";
                                string value = dic["value"];
                                switch (value)
                                {
                                    case "sunny":
                                        {
                                            strtext = Language.StringByID(StringId.clearday);
                                        }
                                        break;
                                    case "cloudy":
                                        {
                                            strtext = Language.StringByID(StringId.cloudy);
                                        }
                                        break;
                                    case "rainy":
                                        {
                                            strtext = Language.StringByID(StringId.rain);
                                        }
                                        break;
                                }
                                inputView.btnText.TextID =StringId.tianqibianhua;
                                inputView.btnState.Text = strtext;
                            }
                        }
                        break;
                }
                //再次编辑条件状态点击事件
@@ -189,7 +271,6 @@
                            break;
                        }
                    }
                    //标记编辑状态
                    bool edit = true;
                    switch (button.Name)
@@ -257,6 +338,78 @@
                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                            }
                            break;
                        case "4":
                            {
                                ///当前的索引值数据对象
                                Input inputedit = Logic.currlogic.input[indexVulae];
                                ///状态值
                                string stateValue = "";
                                ///状态值文本
                                int intValue = -1;
                                foreach (var dic in inputedit.condition)
                                {
                                    string key = dic["key"];
                                    string comparator = dic["comparator"];
                                    stateValue = dic["value"];
                                    switch (key)
                                    {
                                        case "outdoor_temp":
                                            {
                                                if (comparator == ">")
                                                {
                                                    intValue=StringId.wendugaoyu;
                                                }
                                                else if (comparator == "<")
                                                {
                                                    intValue = StringId.wendudiyu;
                                                }
                                            }
                                            break;
                                        case "outdoor_humity":
                                            {
                                                if (comparator == ">")
                                                {
                                                    intValue = StringId.shidugaoyu;
                                                }
                                                else if (comparator == "<")
                                                {
                                                    intValue = StringId.shidudiyu;
                                                }
                                            }
                                            break;
                                        case "pm2.5":
                                            {
                                                intValue = StringId.PM25;
                                            }
                                            break;
                                    }
                                }
                                OutdoorEnvironment outdoorEnvironment = new OutdoorEnvironment();
                                if (intValue == StringId.PM25)
                                {
                                    outdoorEnvironment.PmAction(thisView, stateValue);
                                }
                                else
                                {
                                    outdoorEnvironment.InputBoxAction(intValue, stateValue);
                                }
                            }
                            break;
                        case "6":
                            {
                                WeatherCondition weatherCondition = new WeatherCondition();
                                MainPage.BasePageView.AddChidren(weatherCondition);
                                weatherCondition.Show();
                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                            }
                            break;
                    }
                };
                ///删除控件
@@ -279,12 +432,6 @@
            for (int i = 0; i < Logic.currlogic.output.Count; i++)
            {
                Output outputTarget = Logic.currlogic.output[i];
                if (outputTarget == null)
                {
                    //防止有的空对象;
                    //正常情况下不会该现象;
                    continue;
                }
                ///各种条件的View
                LogicView.AddOutputInputView targetView = new LogicView.AddOutputInputView();
                targetView.FLayoutView(viewLayout);
@@ -940,7 +1087,6 @@
            }
            return valueStr;
        }
        /// <summary>
        ///获取自动化名称
        /// </summary>
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
old mode 100755 new mode 100644
@@ -260,6 +260,7 @@
                TextAlignment = TextAlignment.CenterLeft,
            };
            editBjView.AddChidren(editText);
            Button clearIconBtn = new Button
            {
@@ -355,7 +356,213 @@
        }
        /// <summary>
        /// 输入框
        /// </summary>
        /// <param name="titleId">标题文本</param>
        /// <param name="tnputEditTxet">显示文本</param>
        /// <param name="confirmAction">回调函数</param>
        public void InputBox(int titleId, string tnputEditTxet, Action<string> confirmAction)
        {
            Dialog dialog = new Dialog()
            {
                BackgroundColor = CSS_Color.viewTrans60lucence,
            };
            FrameLayout whiteView = new FrameLayout()
            {
                //Gravity = Gravity.Center,
                X = Application.GetRealWidth(53),
                Y = Application.GetRealHeight(264),
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealHeight(172),
                BackgroundColor = CSS_Color.view,
                BorderColor = CSS_Color.viewTranslucence,
                BorderWidth = 0,
                Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
            };
            dialog.AddChidren(whiteView);
            Button btnTitle = new Button()
            {
                Y = Application.GetRealHeight(20),
                X = Application.GetRealWidth(35),
                Height = Application.GetRealHeight(22),
                Width = Application.GetRealWidth(200),
                TextColor = CSS_Color.textConfirmColor,
                TextSize = TextSize.text16,
                TextAlignment = TextAlignment.Center,
                TextID = titleId,
            };
            whiteView.AddChidren(btnTitle);
            FrameLayout editBjView = new FrameLayout()
            {
                // Gravity = Gravity.CenterHorizontal,
                Y = btnTitle.Bottom + Application.GetRealHeight(16),
                X = Application.GetRealWidth(53),
                Width = Application.GetRealWidth(157),
                Height = Application.GetRealHeight(40),
                BackgroundColor = CSS_Color.viewMiddle,
                BorderColor = CSS_Color.viewTranslucence,
                BorderWidth = 0,
                Radius = (uint)Application.GetRealHeight(radiusEditFrameLayout),
            };
            whiteView.AddChidren(editBjView);
            EditText editText = new EditText()
            {
               // X = Application.GetRealWidth(12),
                Y = Application.GetRealHeight(10),
                Width = Application.GetRealWidth(157),
                Height = Application.GetRealHeight(20),
                Text = tnputEditTxet,
                TextColor = CSS_Color.textColor,
                TextSize = TextSize.text14,
                TextAlignment = TextAlignment.Center,
                IsNumberKeyboardType=true,
            };
            editBjView.AddChidren(editText);
            Button btn_subtract = new Button
            {
                X = Application.GetRealWidth(17),
                Y = Application.GetRealHeight(66),
                Width = Application.GetRealWidth(24),
                Height = Application.GetRealWidth(24),
                UnSelectedImagePath = "LogicIcon/-.png",
            };
            whiteView.AddChidren(btn_subtract);
            Button btn_add = new Button
            {
                X = Application.GetRealWidth(222),
                Y = Application.GetRealHeight(66),
                Width = Application.GetRealWidth(24),
                Height = Application.GetRealWidth(24),
                UnSelectedImagePath = "LogicIcon/+.png",
            };
            whiteView.AddChidren(btn_add);
            btn_subtract.MouseUpEventHandler += (sender, e) =>
            {
                string editTextValue = editText.Text;
                if (!string.IsNullOrEmpty(editTextValue))
                {
                    int intValue = int.Parse(editTextValue);
                    if (intValue>1)
                    {
                        editText.Text = (intValue - 1).ToString();
                    }
                }
            };
            btn_add.MouseUpEventHandler += (sender, e) =>
            {
                string editTextValue = editText.Text;
                if (!string.IsNullOrEmpty(editTextValue))
                {
                    int intValue = int.Parse(editTextValue);
                    if (intValue <100)
                    {
                        editText.Text = (intValue + 1).ToString();
                    }
                }
            };
            Button btnLine = new Button()
            {
                Y = whiteView.Height - Application.GetRealHeight(44 + 1),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.viewLine,
            };
            whiteView.AddChidren(btnLine);
            Button btnCancel = new Button()
            {
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.textTipColor,
                TextSize = TextSize.text16,
                TextID = StringId.cancelMusic,
                Gravity = Gravity.BottomLeft,
            };
            whiteView.AddChidren(btnCancel);
            btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
            Button btnConfirm = new Button()
            {
                X = btnCancel.Right,
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.view,
                IsBold = true,
                TextSize = TextSize.text16,
                TextID = StringId.confirmMusic,
                BackgroundColor = CSS_Color.textConfirmColor,
                Gravity = Gravity.BottomRight,
            };
            whiteView.AddChidren(btnConfirm);
            btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
            dialog.Show();
            btnCancel.MouseUpEventHandler += (sender, e) =>
            {
                dialog.Close();
            };
            Button btnTip = new Button
            {
                Width = Application.GetRealWidth(0),
            };
            whiteView.AddChidren(btnTip);//一直错误,一直猛点,一直加控件
            btnConfirm.MouseUpEventHandler += (sender, e) =>
            {
                string errorId_IsNullOrEmpty = "";
                if (string.IsNullOrEmpty(editText.Text.Trim()))
                {
                    errorId_IsNullOrEmpty = Language.StringByID(StringId.nullvalue);
                }
                else
                {
                    var editTextValue = editText.Text.Trim();
                    int intValue = int.Parse(editTextValue);
                    if (intValue <= 0 || intValue > 100)
                    {
                        errorId_IsNullOrEmpty = Language.StringByID(StringId.setvalue);
                    }
                }
                if (errorId_IsNullOrEmpty!="")
                {
                    whiteView.Height = Application.GetRealHeight(183);
                    btnLine.Y = whiteView.Height - Application.GetRealHeight(44 + 1);
                    btnCancel.Y = btnLine.Bottom;
                    btnCancel.Gravity = Gravity.BottomLeft;
                    btnConfirm.Y = btnLine.Bottom;
                    btnConfirm.Gravity = Gravity.BottomRight;
                    btnTip.X = Application.GetRealWidth(53);
                    btnTip.Y = editBjView.Bottom + Application.GetRealHeight(12);
                    btnTip.Width = Application.GetRealWidth(200);
                    btnTip.Height = Application.GetRealHeight(17);
                    btnTip.Text = errorId_IsNullOrEmpty;
                    btnTip.TextColor = CSS_Color.textRedColor;
                    btnTip.TextSize = TextSize.text12;
                    btnTip.TextAlignment = TextAlignment.CenterLeft;
                    return;
                }
                confirmAction(editText.Text.Trim());
                dialog.Close();
            };
        }
        /// <summary>
        /// 确定提示框
        /// </summary>
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -34,7 +34,7 @@
            };
            //获取自动化列表
            GetLogicList();
             for (int i = Logic.LogicList.Count-1; i >= 0; i--)//降序排列
            for (int i = Logic.LogicList.Count - 1; i >= 0; i--)//降序排列
            //for (int i = 0; i < Logic.LogicList.Count; i++)
            {
                var currLogic = Logic.LogicList[i];
@@ -76,12 +76,12 @@
                        }
                        catch { }
                    })
                    { IsBackground = true }.Start();
                };
                GetSelectIcon(logicView.frameLayout, currLogic);
                if (i==0)//降序排列
                if (i == 0)//降序排列
                //if (Logic.LogicList.Count - 1 == i)
                {
                    ///最后一个距离最底部12,界面显示效果作用;
@@ -135,7 +135,7 @@
        ///返回循环描述文本
        /// </summary>
        /// <param name="logic"></param>
        public static string GetCyclicText(Logic logic)
        public static string GetCyclicText(Logic logic)
        {
            string weekName = "";
@@ -269,8 +269,38 @@
                        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]);
                            }
                            //添加逻辑
                            Logic.LogicList.Add(logic);
                            Logic.LogicList.Add(newlogic);
                        }
                    }
@@ -353,12 +383,6 @@
            //14-延时图标
            for (int i = 0; i < logic.output.Count; i++)
            {
                if (logic.output[i] == null)
                {
                    //防止有的空对象;
                    //正常情况下不会该现象;
                    continue;
                }
                var int1 = int.Parse(logic.output[i].target_type);
                int iconInt = 0;
                switch (int1)
@@ -389,10 +413,11 @@
                }
            }
            //图标控件的父控件
            FrameLayout frame = new FrameLayout {
                Height=Application.GetRealHeight(40),
                Width=Application.GetRealWidth(275),
                Y= Application.GetRealHeight(56),
            FrameLayout frame = new FrameLayout
            {
                Height = Application.GetRealHeight(40),
                Width = Application.GetRealWidth(275),
                Y = Application.GetRealHeight(56),
            };
            layouFrame.AddChidren(frame);
@@ -404,7 +429,7 @@
                {
                    Width = Application.GetRealWidth(28),
                    Height = Application.GetRealWidth(28),
                    Gravity=Gravity.CenterVertical,
                    Gravity = Gravity.CenterVertical,
                };
                frame.AddChidren(btnIcon);
@@ -414,12 +439,14 @@
                }
                else
                {
                    btnIcon.X = Application.GetRealWidth(12+(28+4)*i);
                    btnIcon.X = Application.GetRealWidth(12 + (28 + 4) * i);
                }
                string strIcon = "";
                switch (iconIntValue[i]) {
                    case 1: {
                switch (iconIntValue[i])
                {
                    case 1:
                        {
                            strIcon = "LogicIcon/selectTheTime.png";
                        }
                        break;
@@ -433,17 +460,21 @@
                        {
                            //分割条件和目标的图标
                            strIcon = "LogicIcon/link.png";
                        } break;
                        }
                        break;
                    case 12:
                        {
                            strIcon = "LogicIcon/selectTheFun.png";
                        }
                        break;
                    case 13: {
                    case 13:
                        {
                            strIcon = "LogicIcon/selectTheScene.png";
                        } break;
                    case 14: {
                        }
                        break;
                    case 14:
                        {
                            //strIcon = "LogicIcon/timeicon.png";
                        }
                        break;
@@ -459,12 +490,21 @@
        /// 云端唯一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 = "";
        //public CycleA cycle;
        //public string modifyTime = "";
HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
@@ -1,5 +1,6 @@
using System;
using Shared;
using System.Collections.Generic;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class OutdoorEnvironment : FrameLayout
@@ -48,7 +49,7 @@
            //湿度高于
            LogicView.SelectTypeView humidityhigherView = new LogicView.SelectTypeView();
            humidityhigherView.frameLayout.Y = temperatureunderView.frameLayout.Bottom+Application.GetRealHeight(8);
            humidityhigherView.frameLayout.Y = temperatureunderView.frameLayout.Bottom + Application.GetRealHeight(8);
            humidityhigherView.btnIcon.Visible = false;
            humidityhigherView.btnText.X = Application.GetRealWidth(16);
            humidityhigherView.btnLine.X = Application.GetRealWidth(16);
@@ -65,24 +66,16 @@
            humidityunderView.btnText.TextID = StringId.shidudiyu;
            viewLayout.AddChidren(humidityunderView.FLayoutView());
            //PM2.5高于
            //PM2.5
            LogicView.SelectTypeView pmhigherView = new LogicView.SelectTypeView();
            pmhigherView.frameLayout.Y = humidityunderView.frameLayout.Bottom + Application.GetRealHeight(8);
            pmhigherView.btnIcon.Visible = false;
            pmhigherView.btnText.X = Application.GetRealWidth(16);
            pmhigherView.btnLine.X = Application.GetRealWidth(16);
            pmhigherView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
            pmhigherView.btnText.TextID = StringId.pmgaoyu;
            pmhigherView.btnText.TextID = StringId.PM25;
            viewLayout.AddChidren(pmhigherView.FLayoutView());
            //PM2.5低于
            LogicView.SelectTypeView pmunderView = new LogicView.SelectTypeView();
            pmunderView.frameLayout.Y = pmhigherView.frameLayout.Bottom;
            pmunderView.btnIcon.Visible = false;
            pmunderView.btnText.X = Application.GetRealWidth(16);
            pmunderView.btnLine.X = Application.GetRealWidth(16);
            pmunderView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
            pmunderView.btnText.TextID = StringId.pmdiyu;
            viewLayout.AddChidren(pmunderView.FLayoutView());
            #endregion
@@ -90,40 +83,231 @@
            //温度高于
            temperaturehigherView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                InputBoxAction(StringId.wendugaoyu);
            };
            //温度低于
            temperatureunderView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                InputBoxAction(StringId.wendudiyu);
            };
            //湿度高于
            humidityhigherView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                InputBoxAction(StringId.shidugaoyu);
            };
            //湿度低于
            humidityunderView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                InputBoxAction(StringId.shidudiyu);
            };
            //PM2.5高于
            //PM2.5
            pmhigherView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                PmAction(this);
            };
            //PM2.5低于
            pmunderView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
            };
            #endregion
        }
        /// <summary>
        /// 温度,湿度弹框设置值
        /// </summary>
        /// <param name="textInt">文本</param>
        /// <param name="stateValue">编辑之前的状态值,默认为20</param>
        public void InputBoxAction(int textInt,string stateValue="20")
        {
            new LogicView.TipPopView { }.InputBox(textInt, stateValue, (value) =>
            {
                string keyValue = "";
                string comparator = "=";
                switch (textInt)
                {
                    case StringId.wendugaoyu:
                        {
                            keyValue = "outdoor_temp";
                            comparator = ">";
                        }
                        break;
                    case StringId.wendudiyu:
                        {
                            keyValue = "outdoor_temp";
                            comparator = "<";
                        }
                        break;
                    case StringId.shidugaoyu:
                        {
                            keyValue = "outdoor_humity";
                            comparator = ">";
                        }
                        break;
                    case StringId.shidudiyu:
                        {
                            keyValue = "outdoor_humity";
                            comparator = "<";
                        }
                        break;
                }
                AddDic(keyValue, comparator, value);
            });
        }
        /// <summary>
        /// 温度,湿度弹框设置值
        /// </summary>
        /// <param name="frame">当前界面</param>
        /// <param name="stateValue">编辑之前的状态值,默认为""</param>
        public void PmAction(FrameLayout frame, string stateValue = "")
        {
            PublicInterface pmView = new PublicInterface();
            var pmListStr = pmView.GetViewList("pm2.5");
            pmView.SingleSelectionShow(frame, pmListStr, Language.StringByID(StringId.PM25), GetString(stateValue)
               , (text) =>
               {
                   string value = "";
                   if (text == Language.StringByID(StringId.pmyou))
                   {
                       value = "10";
                   }
                   else if (text == Language.StringByID(StringId.pmliang))
                   {
                       value = "50";
                   }
                   else if (text == Language.StringByID(StringId.pmqingdu))
                   {
                       value = "90";
                   }
                   else if (text == Language.StringByID(StringId.pmzhongdu))
                   {
                       value = "130";
                   }
                   else if (text == Language.StringByID(StringId.pmzhongduwuran))
                   {
                       value = "170";
                   }
                   AddDic("pm2.5", "=", value);
               });
        }
        /// <summary>
        /// 封装数据
        /// </summary>
        /// <param name="keyValue">类型值(pm2.5;outdoor_temp;outdoor_humity)</param>
        /// <param name="comparator">比较关系</param>
        /// <param name="value">值</param>
        private void AddDic(string keyValue, string comparator, string value)
        {
            Input input = new Input();
            input.sid = LogicMethod.NewSid();
            input.condition_type = "4";
            Dictionary<string, string> dic = new Dictionary<string, string>();
            LogicMethod.dictionary(dic, "key", keyValue);
            LogicMethod.dictionary(dic, "comparator", comparator);
            LogicMethod.dictionary(dic, "data_type", "float");
            LogicMethod.dictionary(dic, "value", value);
            input.condition.Add(dic);
            AddCondition(input, keyValue, comparator);
        }
        /// <summary>
        /// 添加条件
        /// </summary>
        /// <param name="input"></param>
        /// <param name="keyValue"></param>
        /// <param name="comparator">比较关系</param>
        private void AddCondition(Input input, string keyValue,string comparator)
        {
            ///记录索引值
            int index = -1;
            for (var i = 0; i < Logic.currlogic.input.Count; i++)
            {
                var condition_type = Logic.currlogic.input[i].condition_type;
                if (condition_type == "4")
                {
                    var dicList = Logic.currlogic.input[i].condition;
                    if (ExistKey(dicList, keyValue, comparator))
                    {
                        ///找到标记索引,退出循环体
                        index = i;
                        break;
                    }
                }
            }
            if (index != -1)
            {
                //移除旧数据
                Logic.currlogic.input.RemoveAt(index);
                //新数据插入旧数据的位置
                Logic.currlogic.input.Insert(index, input);
            }
            else
            {
                Logic.currlogic.input.Add(input);
            }
            LogicMethod.RemoveAllView();
            AddLogic addLogic = new AddLogic();
            MainPage.BasePageView.AddChidren(addLogic);
            addLogic.Show();
            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
        }
        /// <summary>
        /// 判断是否存在Key
        /// </summary>
        /// <param name="dicList"></param>
        /// <param name="keyValue"></param>
        /// <param name="comparator">比较关系</param>
        /// <returns></returns>
        private bool ExistKey(List<Dictionary<string, string>> dicList, string keyValue, string comparator)
        {
            for (int i = 0; i < dicList.Count; i++)
            {
                var dic = dicList[i];
                string key = dic["key"];
                string comparatorValue = dic["comparator"];
                if (key == keyValue && comparatorValue == comparator)
                {
                    //判断是否存在
                    return true;
                }
            }
            return false;
        }
        public string GetString(string strValue)
        {
            string text = "";
            int intValue = 0;
            if (strValue != "")
            {
                intValue = int.Parse(strValue);
            }
            if (intValue > 0 && intValue < 35)
            {
                text = Language.StringByID(StringId.pmyou);
            }
            else if (intValue > 35 && intValue < 75)
            {
                text = Language.StringByID(StringId.pmliang);
            }
            else if (intValue > 75 && intValue < 115)
            {
                text = Language.StringByID(StringId.pmqingdu);
            }
            else if (intValue > 115 && intValue < 150)
            {
                text = Language.StringByID(StringId.pmzhongdu);
            }
            else if (intValue > 150)
            {
                text = Language.StringByID(StringId.pmzhongduwuran);
            }
            return text;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -462,6 +462,17 @@
                      };
                    }
                    break;
                case "pm2.5":
                    {
                        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;
            }
            return list;
@@ -636,5 +647,7 @@
            return stateList;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -538,21 +538,20 @@
            Dictionary<string, string> dic = new Dictionary<string, string>();
            LogicMethod.dictionary(dic, "key", KeyValue);
            LogicMethod.dictionary(dic, "value", selectedValue);
            AddDictionaryList(KeyValue, dic, dicSateteList);
            AddDictionaryList(KeyValue, dic);
        }
        /// <summary>
        /// 更新数据列表
        /// </summary>
        /// <param name="keyValue">设备属性值,云雀上定义好的</param> 
        /// <param name="dictionary">选中数据</param>
        /// <param name="dicList">存储数据列表</param>
        /// <param name="dictionary">添加选中数据</param>
        /// <returns></returns>
        private void AddDictionaryList(string keyValue, Dictionary<string, string> dictionary, List<Dictionary<string, string>> dicList)
        private void AddDictionaryList(string keyValue, Dictionary<string, string> dictionary)
        {
            int indexValue = -1;
            for (int i = 0; i < dicList.Count; i++)
            for (int i = 0; i < dicSateteList.Count; i++)
            {
                var dic = dicList[i];
                var dic = dicSateteList[i];
                if (dic.ContainsValue(keyValue))
                {
                    //判断是否存在
@@ -564,14 +563,14 @@
            if (indexValue != -1)
            {
                //存在移除
                dicList.RemoveAt(indexValue);
                dicSateteList.RemoveAt(indexValue);
                //重新添加
                dicList.Insert(indexValue, dictionary);
                dicSateteList.Insert(indexValue, dictionary);
            }
            else
            {
                //新添加
                dicList.Add(dictionary);
                dicSateteList.Add(dictionary);
            }
        }
HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
@@ -9,7 +9,7 @@
        {
            Tag = "Logic";
        }
        public void Show(bool edit = false, int index=-1)
        public void Show()
        {
            #region  界面布局
            LogicView.TopView topView = new LogicView.TopView();
@@ -17,14 +17,14 @@
            this.AddChidren(topView.FLayoutView());
            topView.topNameBtn.TextID = StringId.selectionCondition;
            //获取宽度
            int widthValue= topView.topNameBtn.GetTextWidth();
            int textWidth =(Application.GetRealWidth(255)- widthValue) / 2;
            int widthValue = topView.topNameBtn.GetTextWidth();
            int textWidth = (Application.GetRealWidth(255) - widthValue) / 2;
            Button locationBtn = new Button
            {
                Width = Application.GetRealWidth(18),
                Height = Application.GetRealWidth(18),
                X = Application.GetRealWidth(60+4)+ textWidth + widthValue,
                Y = Application.GetRealHeight(34+1),
                X = Application.GetRealWidth(60 + 4) + textWidth + widthValue,
                Y = Application.GetRealHeight(34 + 1),
                UnSelectedImagePath = "LogicIcon/location.png",
            };
@@ -46,9 +46,9 @@
            FrameLayout viewLayout = new FrameLayout
            {
                Y = Application.GetRealHeight(64+20),
                Y = Application.GetRealHeight(64 + 20),
                Width = Application.GetRealWidth(LogicView.TextSize.view375),
                Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64-20),
                Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64 - 20),
                BackgroundColor = CSS.CSS_Color.viewMiddle,
            };
            this.AddChidren(viewLayout);
@@ -61,26 +61,91 @@
            };
            for (int i = 0; i < list.Count; i++)
            {
                LogicView.SelectTypeView timeView = new LogicView.SelectTypeView();
                timeView.frameLayout.Y = Application.GetRealHeight(i * 50);
                timeView.btnIcon.Visible = false;
                timeView.btnText.X = Application.GetRealWidth(16);
                timeView.btnLine.X = Application.GetRealWidth(16);
                timeView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
                timeView.btnText.Text = list[i];
                timeView.btnClick.Tag = list[i];
                viewLayout.AddChidren(timeView.FLayoutView());
                LogicView.SelectTypeView view = new LogicView.SelectTypeView();
                view.frameLayout.Y = Application.GetRealHeight(i * 50);
                view.btnIcon.Visible = false;
                view.btnNextIcon.Visible = false;
                view.btnText.X = Application.GetRealWidth(16);
                view.btnLine.X = Application.GetRealWidth(16);
                view.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
                view.btnText.Text = list[i];
                view.btnClick.Tag = list[i];
                viewLayout.AddChidren(view.FLayoutView());
                timeView.btnClick.MouseUpEventHandler += (sen, e) =>
                view.btnClick.MouseUpEventHandler += (sen, e) =>
                {
                    //string
                    //if () { }
                    //else if () { }
                    //else if () { }
                    string value = "";
                    string text = view.btnClick.Tag.ToString();
                    if (text == Language.StringByID(StringId.clearday))
                    {
                        value = "sunny";
                    }
                    else if (text == Language.StringByID(StringId.cloudy))
                    {
                        value = "cloudy";
                    }
                    else if (text == Language.StringByID(StringId.rain))
                    {
                        value = "rainy";
                    }
                    AddDic(value);
                };
            }
        }
        /// <summary>
        /// 封装数据
        /// </summary>
        /// <param name="value"></param>
        private void AddDic(string value)
        {
            Input input = new Input();
            input.sid = LogicMethod.NewSid();
            input.condition_type = "6";
            Dictionary<string, string> dic = new Dictionary<string, string>();
            LogicMethod.dictionary(dic, "key", "weather");
            LogicMethod.dictionary(dic, "comparator", "=");
            LogicMethod.dictionary(dic, "data_type", "string");
            LogicMethod.dictionary(dic, "value", value);
            input.condition.Add(dic);
            AddCondition(input);
        }
        /// <summary>
        /// 添加条件
        /// </summary>
        /// <param name="input"></param>
        private void AddCondition(Input input)
        {
            ///记录索引值
            int index = -1;
            for (var i = 0; i < Logic.currlogic.input.Count; i++)
            {
                var condition_type = Logic.currlogic.input[i].condition_type;
                if (condition_type == "6")
                {
                    ///找到标记索引,退出循环体
                    index = i;
                    break;
                }
            }
            if (index != -1)
            {
                //移除旧数据
                Logic.currlogic.input.RemoveAt(index);
                //新数据插入旧数据的位置
                Logic.currlogic.input.Insert(index, input);
            }
            else
            {
                Logic.currlogic.input.Add(input);
            }
            LogicMethod.RemoveAllView();
            AddLogic addLogic = new AddLogic();
            MainPage.BasePageView.AddChidren(addLogic);
            addLogic.Show();
            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
        }
    }
}