| | |
| | | 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); |
| | |
| | | } |
| | | } |
| | | 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; |
| | | |
| | | } |
| | | //再次编辑条件状态点击事件 |
| | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //标记编辑状态 |
| | | bool edit = true; |
| | | switch (button.Name) |
| | |
| | | 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; |
| | | } |
| | | }; |
| | | ///删除控件 |
| | |
| | | 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); |
| | |
| | | } |
| | | return valueStr; |
| | | } |
| | | |
| | | /// <summary> |
| | | ///获取自动化名称 |
| | | /// </summary> |