| | |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | //开关图标的点击事件 |
| | | logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = !logicView.btnSwitchIcon.IsSelected; |
| | |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = true; |
| | | currLogic.enable = "true"; |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = false; |
| | | currLogic.enable = "false"; |
| | | } |
| | | Send.switchLogic(currLogic); |
| | | //Send.switchLogic(currLogic); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | //逻辑使能的命令 |
| | | Send.switchLogic(currLogic); |
| | | |
| | | } |
| | | catch { } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | GetSelectIcon(logicView.frameLayout, currLogic); |
| | | //if (i==0)降序排列 |
| | | if (Logic.LogicList.Count - 1 == i) |
| | | { |
| | |
| | | { |
| | | Y = btnTipNot.Bottom, |
| | | Height = Application.GetRealWidth(100), |
| | | TextID = StringId.TipNotOpen, |
| | | TextID = StringId.ContentIsEmpty, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS.CSS_Color.TextualColor, |
| | | TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel, |
| | |
| | | public static string GetWeekString(List<string> weekList) |
| | | { |
| | | string weekTextName = ""; |
| | | |
| | | if (weekList.Contains("0")) |
| | | if (weekList.Contains("1")) |
| | | { |
| | | weekTextName += Language.StringByID(StringId.monday) + ","; |
| | | } |
| | | if (weekList.Contains("1")) |
| | | if (weekList.Contains("2")) |
| | | { |
| | | weekTextName += Language.StringByID(StringId.tuesday) + ","; |
| | | } |
| | | if (weekList.Contains("2")) |
| | | if (weekList.Contains("3")) |
| | | { |
| | | weekTextName += Language.StringByID(StringId.wednesday) + ","; |
| | | } |
| | | if (weekList.Contains("3")) |
| | | if (weekList.Contains("4")) |
| | | { |
| | | weekTextName += Language.StringByID(StringId.thursday) + ","; |
| | | } |
| | | if (weekList.Contains("4")) |
| | | if (weekList.Contains("5")) |
| | | { |
| | | weekTextName += Language.StringByID(StringId.friday) + ","; |
| | | } |
| | | if (weekList.Contains("5")) |
| | | if (weekList.Contains("6")) |
| | | { |
| | | weekTextName += Language.StringByID(StringId.saturday) + ","; |
| | | } |
| | | if (weekList.Contains("6")) |
| | | if (weekList.Contains("0")) |
| | | { |
| | | weekTextName += Language.StringByID(StringId.sunday) + ","; |
| | | } |
| | |
| | | } |
| | | return weekTextName.TrimEnd(','); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取每月的字符串 |
| | | /// </summary> |
| | |
| | | List<string> logicIdList = new List<string>(); |
| | | //获取逻辑ID列表 |
| | | var idStr = Send.getLogicIdList(); |
| | | if (idStr.Code == "0" && idStr.Data != null) |
| | | if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "") |
| | | { |
| | | var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); |
| | | var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Date>>(date); |
| | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示条件或者目标类型图标 |
| | | /// </summary> |
| | | /// <param name="layouFrame">父控件</param> |
| | | /// <param name="logic">当前逻辑</param> |
| | | private static void GetSelectIcon(FrameLayout layouFrame, Logic logic) |
| | | { |
| | | |
| | | //重新排列图标序号 |
| | | List<int> iconIntValue = new List<int>(); |
| | | iconIntValue.Clear(); |
| | | |
| | | //1-10(表示条件图标)自己局部定义为了显示选中条件类型图标 |
| | | //1-时间图标 |
| | | //2-功能图标 |
| | | for (int i = 0; i < logic.input.Count; i++) |
| | | { |
| | | |
| | | var int1 = int.Parse(logic.input[i].condition_type); |
| | | int iconInt = 0; |
| | | switch (int1) |
| | | { |
| | | case 1: |
| | | case 2: |
| | | { |
| | | iconInt = 1; |
| | | |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | iconInt = 2; |
| | | |
| | | } |
| | | break; |
| | | } |
| | | |
| | | if (!iconIntValue.Contains(iconInt)) |
| | | { |
| | | iconIntValue.Add(iconInt); |
| | | } |
| | | |
| | | } |
| | | |
| | | //分割条件和目标的图标 |
| | | iconIntValue.Add(11); |
| | | |
| | | //12-20(表示目标图标)自己局部定义为了显示选中目标类型图标 |
| | | //12-功能图标 |
| | | //13-场景图标 |
| | | //14-延时图标 |
| | | for (int i = 0; i < logic.output.Count; i++) |
| | | { |
| | | var int1 = int.Parse(logic.output[i].target_type); |
| | | int iconInt = 0; |
| | | switch (int1) |
| | | { |
| | | case 1: |
| | | { |
| | | iconInt = 12; |
| | | |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | iconInt = 13; |
| | | |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | iconInt = 14; |
| | | |
| | | } |
| | | break; |
| | | } |
| | | |
| | | if (!iconIntValue.Contains(iconInt)) |
| | | { |
| | | iconIntValue.Add(iconInt); |
| | | } |
| | | } |
| | | //图标控件的父控件 |
| | | FrameLayout frame = new FrameLayout { |
| | | Height=Application.GetRealHeight(40), |
| | | Width=Application.GetRealWidth(275), |
| | | Y= Application.GetRealHeight(56), |
| | | }; |
| | | layouFrame.AddChidren(frame); |
| | | |
| | | |
| | | for (int i = 0; i < iconIntValue.Count; i++) |
| | | { |
| | | //图标控件 |
| | | Button btnIcon = new Button |
| | | { |
| | | Width = Application.GetRealWidth(28), |
| | | Height = Application.GetRealWidth(28), |
| | | Gravity=Gravity.CenterVertical, |
| | | }; |
| | | frame.AddChidren(btnIcon); |
| | | |
| | | if (i == 0) |
| | | { |
| | | btnIcon.X = Application.GetRealWidth(12); |
| | | } |
| | | else |
| | | { |
| | | btnIcon.X = Application.GetRealWidth(12+(28+4)*i); |
| | | } |
| | | string strIcon = ""; |
| | | switch (iconIntValue[i]) { |
| | | |
| | | case 1: { |
| | | strIcon = "LogicIcon/selectTheTime.png"; |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | |
| | | strIcon = "LogicIcon/selectTheFun.png"; |
| | | } |
| | | break; |
| | | case 11: |
| | | { |
| | | //分割条件和目标的图标 |
| | | strIcon = "LogicIcon/link.png"; |
| | | } break; |
| | | case 12: |
| | | { |
| | | |
| | | strIcon = "LogicIcon/selectTheFun.png"; |
| | | } |
| | | break; |
| | | case 13: { |
| | | strIcon = "LogicIcon/selectTheScene.png"; |
| | | } break; |
| | | case 14: { |
| | | //strIcon = "LogicIcon/timeicon.png"; |
| | | } |
| | | break; |
| | | |
| | | } |
| | | btnIcon.UnSelectedImagePath = strIcon; |
| | | } |
| | | } |
| | | } |
| | | class Date |
| | | { |