From d987694e57c3bce76bd5a208d74a3696db222a4a Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 14 一月 2021 14:00:06 +0800
Subject: [PATCH] Merge branch 'WJC' into NewFilePath

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs        |   13 
 HDL-ON_Android/Assets/Language.ini                                |    9 
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs    |  174 ++++++++++
 HDL-ON_iOS/HDL-ON_iOS.csproj                                      |   18 
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs |   17 
 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs    |   17 
 HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs               |   88 ++++-
 HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs           |    2 
 /dev/null                                                         |    0 
 HDL-ON_iOS/Resources/Language.ini                                 |    7 
 HDL-ON_Android/Resources/Resource.designer.cs                     |    3 
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs   |  207 +++++++++++++
 HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs     |  230 +++++++++++++-
 HDL_ON/Common/R.cs                                                |    8 
 HDL_ON/UI/UI2/3-Intelligence/.DS_Store                            |    0 
 .vs/HDL_APP_Project/xs/sqlite3/storage.ide                        |    0 
 HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs       |  107 +++++-
 17 files changed, 794 insertions(+), 106 deletions(-)

diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide
index f17f451..03e4efc 100644
--- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide
+++ b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide
Binary files differ
diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm
deleted file mode 100644
index 9a6dc9d..0000000
--- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm
+++ /dev/null
Binary files differ
diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal
deleted file mode 100644
index cefbeed..0000000
--- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal
+++ /dev/null
Binary files differ
diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index 0e530c5..0de03e7 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/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=璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP
diff --git a/HDL-ON_Android/Resources/Resource.designer.cs b/HDL-ON_Android/Resources/Resource.designer.cs
index 52baaa6..506131b 100644
--- a/HDL-ON_Android/Resources/Resource.designer.cs
+++ b/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
 	{
 		
diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj
index dd63e96..9936497 100644
--- a/HDL-ON_iOS/HDL-ON_iOS.csproj
+++ b/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>
\ No newline at end of file
diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini
index 0e530c5..9a5866c 100644
--- a/HDL-ON_iOS/Resources/Language.ini
+++ b/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=璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index b08bfd4..99da5bb 100644
--- a/HDL_ON/Common/R.cs
+++ b/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鏂板
diff --git a/HDL_ON/UI/UI2/3-Intelligence/.DS_Store b/HDL_ON/UI/UI2/3-Intelligence/.DS_Store
new file mode 100644
index 0000000..a053fe9
--- /dev/null
+++ b/HDL_ON/UI/UI2/3-Intelligence/.DS_Store
Binary files differ
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
index a319a5c..b951446 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
+++ b/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
 
 
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index 140875b..e1e05bc 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/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);
             }
 
         }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 5bacc1d..522f09c 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/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)
-                {
-                    //闃叉鏈夌殑绌哄璞★紱
-                    //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛�
-                    continue;
-                }
                 ///鍚勭鏉′欢鐨刅iew
                 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)
-                {
-                    //闃叉鏈夌殑绌哄璞★紱
-                    //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛�
-                    continue;
-                }
                 ///鍚勭鏉′欢鐨刅iew
                 LogicView.AddOutputInputView targetView = new LogicView.AddOutputInputView();
                 targetView.FLayoutView(viewLayout);
@@ -940,7 +1087,6 @@
             }
             return valueStr;
         }
-
         /// <summary>
         ///鑾峰彇鑷姩鍖栧悕绉�
         /// </summary>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
old mode 100755
new mode 100644
index 53bec95..227b2e0
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
@@ -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>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
index c14acb6..c073d7f 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
+++ b/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))
+                                {
+                                    //闃叉璋冭瘯杞欢涔变紶涓滆タ涓婃潵;
+                                    //闃叉鏈夌┖瀵硅薄锛�
+                                    //姝e父鎯呭喌涓嬩笉浼氬嚭鐜扮殑鐜拌薄锛�
+                                    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))
+                                {
+                                    //闃叉璋冭瘯杞欢涔变紶涓滆タ涓婃潵;
+                                    //闃叉鏈夌┖瀵硅薄锛�
+                                    //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛�
+                                    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)
-                {
-                    //闃叉鏈夌殑绌哄璞★紱
-                    //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛�
-                    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 = "";
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
index e3b39c6..b5166a6 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
@@ -1,5 +1,6 @@
 锘縰sing 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锛沷utdoor_temp锛沷utdoor_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;
+        }
     }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
index efc5426..536cc06 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
+++ b/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;
         }
+
+
     }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index 9c04646..30c4eaf 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/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);
             }
 
         }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
index 19b6a60..c8a71b6 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
+++ b/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;
+
+        }
     }
 }

--
Gitblit v1.8.0