| | |
| | | string text = view.btnClick.Tag.ToString(); |
| | | if (text == Language.StringByID(StringId.clearday)) |
| | | { |
| | | value = "sunny"; |
| | | value = "Sunny"; |
| | | } |
| | | else if (text == Language.StringByID(StringId.cloudy)) |
| | | { |
| | | value = "cloudy"; |
| | | value = "Cloudy"; |
| | | } |
| | | else if (text == Language.StringByID(StringId.rain)) |
| | | { |
| | | value = "rainy"; |
| | | value = "Rain"; |
| | | } |
| | | AddDic(value); |
| | | }; |
| | |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", value); |
| | | input.condition.Add(dic); |
| | | AddCondition(input); |
| | | AddCondition(input, "weather", "="); |
| | | } |
| | | /// <summary> |
| | | /// 添加条件 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | private void AddCondition(Input input) |
| | | private void AddCondition(Input input, string keyValue, string comparator) |
| | | { |
| | | ///记录索引值 |
| | | int index = -1; |
| | |
| | | var condition_type = Logic.currlogic.input[i].condition_type; |
| | | if (condition_type == "6") |
| | | { |
| | | var dicList = Logic.currlogic.input[i].condition; |
| | | if (ExistKey(dicList, keyValue, comparator)) |
| | | { |
| | | ///找到标记索引,退出循环体 |
| | | index = i; |
| | | break; |
| | | } |
| | | ///找到标记索引,退出循环体 |
| | | index = i; |
| | | break; |
| | |
| | | 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; |
| | | } |
| | | } |
| | | } |