| | |
| | | 696=Monthly data of the past year |
| | | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. |
| | | 698=Break |
| | | 699=Choose automation |
| | | 700=Add execution action |
| | | |
| | | |
| | | |
| | |
| | | 7174=Exceed |
| | | 7175=Under |
| | | 7176=HV |
| | | 7177=Execution mode |
| | | 7178=Change execution |
| | | 7179=Execute on receipt |
| | | |
| | | 8501=Video door lock |
| | | 8502=Electric quantity |
| | |
| | | 696=过去一年的每月数据 |
| | | 697=提示:起始颜色选择越靠近色环边缘,炫彩效果越明显。越靠近白色中心,炫彩效果越不明显。 |
| | | 698=断开 |
| | | 699=选择自动化 |
| | | 700=添加执行目标 |
| | | |
| | | |
| | | |
| | |
| | | 7174=照明度高于 |
| | | 7175=照明度低于 |
| | | 7176=光照 |
| | | 7177=执行模式 |
| | | 7178=改变才执行 |
| | | 7179=收到就执行 |
| | | |
| | | |
| | | |
| | | |
| | |
| | | 696=Monthly data of the past year |
| | | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. |
| | | 698=Break |
| | | 699=Choose automation |
| | | 700=Add execution action |
| | | |
| | | |
| | | |
| | |
| | | 7174=Exceed |
| | | 7175=Under |
| | | 7176=HV |
| | | 7177=Execution mode |
| | | 7178=Change execution |
| | | 7179=Execute on receipt |
| | | |
| | | 8501=Video door lock |
| | | 8502=Electric quantity |
| | |
| | | 696=Monthly data of the past year |
| | | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. |
| | | 698=Break |
| | | 699=Choose automation |
| | | 700=Add execution action |
| | | |
| | | |
| | | |
| | |
| | | 7174=Exceed |
| | | 7175=Under |
| | | 7176=HV |
| | | 7177=Execution mode |
| | | 7178=Change execution |
| | | 7179=Execute on receipt |
| | | |
| | | 8501=Video door lock |
| | | 8502=Electric quantity |
| | |
| | | 696=Monthly data of the past year |
| | | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. |
| | | 698=Break |
| | | 699=Choose automation |
| | | 700=Add execution action |
| | | |
| | | |
| | | |
| | |
| | | 7174=Exceed |
| | | 7175=Under |
| | | 7176=HV |
| | | 7177=Execution mode |
| | | 7178=Change execution |
| | | 7179=Execute on receipt |
| | | |
| | | 8501=Video door lock |
| | | 8502=Electric quantity |
| | |
| | | 7174=Exceed |
| | | 7175=Under |
| | | 7176=HV |
| | | 7177=Execution mode |
| | | 7178=Change execution |
| | | 7179=Execute on receipt |
| | | |
| | | 8501=Відеозамок дверей |
| | | 8502=Кількість електроенергії |
| | |
| | | 696=Monthly data of the past year |
| | | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. |
| | | 698=Break |
| | | 699=Choose automation |
| | | 700=Add execution action |
| | | |
| | | |
| | | |
| | |
| | | 7174=Exceed |
| | | 7175=Under |
| | | 7176=HV |
| | | 7177=Execution mode |
| | | 7178=Change execution |
| | | 7179=Execute on receipt |
| | | |
| | | 8501=Video door lock |
| | | 8502=Electric quantity |
| | |
| | | 696=过去一年的每月数据 |
| | | 697=提示:起始颜色选择越靠近色环边缘,炫彩效果越明显。越靠近白色中心,炫彩效果越不明显。 |
| | | 698=断开 |
| | | 699=选择自动化 |
| | | 700=添加执行目标 |
| | | |
| | | |
| | | |
| | |
| | | 7174=照明度高于 |
| | | 7175=照明度低于 |
| | | 7176=光照 |
| | | 7177=执行模式 |
| | | 7178=改变才执行 |
| | | 7179=收到就执行 |
| | | |
| | | |
| | | |
| | | |
| | |
| | | 696=Monthly data of the past year |
| | | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. |
| | | 698=Break |
| | | 699=Choose automation |
| | | 700=Add execution action |
| | | |
| | | |
| | | |
| | |
| | | 7174=Exceed |
| | | 7175=Under |
| | | 7176=HV |
| | | 7177=Execution mode |
| | | 7178=Change execution |
| | | 7179=Execute on receipt |
| | | |
| | | 8501=Video door lock |
| | | 8502=Electric quantity |
| | |
| | | 696=Monthly data of the past year |
| | | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. |
| | | 698=Break |
| | | 699=Choose automation |
| | | 700=Add execution action |
| | | |
| | | |
| | | |
| | |
| | | 7174=Exceed |
| | | 7175=Under |
| | | 7176=HV |
| | | 7177=Execution mode |
| | | 7178=Change execution |
| | | 7179=Execute on receipt |
| | | |
| | | 8501=Video door lock |
| | | 8502=Electric quantity |
| | |
| | | 696=Monthly data of the past year |
| | | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. |
| | | 698=Break |
| | | 699=Choose automation |
| | | 700=Add execution action |
| | | |
| | | |
| | | |
| | |
| | | 7174=Exceed |
| | | 7175=Under |
| | | 7176=HV |
| | | 7177=Execution mode |
| | | 7178=Change execution |
| | | 7179=Execute on receipt |
| | | |
| | | 8501=Video door lock |
| | | 8502=Electric quantity |
| | |
| | | 7174=Exceed |
| | | 7175=Under |
| | | 7176=HV |
| | | 7177=Execution mode |
| | | 7178=Change execution |
| | | 7179=Execute on receipt |
| | | |
| | | 8501=Відеозамок дверей |
| | | 8502=Кількість електроенергії |
| | |
| | | public static class StringId |
| | | { |
| | | /// <summary> |
| | | /// 添加执行动作 |
| | | /// </summary> |
| | | public const int AddExecutionAction = 700; |
| | | /// <summary> |
| | | /// 选择自动化 |
| | | /// </summary> |
| | | public const int SelectAutomation = 699; |
| | | /// <summary> |
| | | /// 断开(干接点) |
| | | /// </summary> |
| | | public const int DryBreak = 698; |
| | |
| | | /// <summary> |
| | | /// 经纬度 |
| | | /// </summary> |
| | | public const int LatAndLon= 623; |
| | | public const int LatAndLon = 623; |
| | | /// <summary> |
| | | /// 验收 |
| | | /// </summary> |
| | |
| | | /// 光照 |
| | | /// </summary> |
| | | public const int guangzhao = 7176; |
| | | |
| | | /// <summary> |
| | | /// 执行模式 |
| | | /// </summary> |
| | | public const int zhixingmoshi = 7177; |
| | | /// <summary> |
| | | /// 改变才执行 |
| | | /// </summary> |
| | | public const int gaibiancaizhixing = 7178; |
| | | /// <summary> |
| | | /// 收到就执行 |
| | | /// </summary> |
| | | public const int shoudaojiuzhixing = 7179; |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 上一部 |
| | | /// </summary> |
| | | public const int shangyibu= 8710; |
| | | |
| | | public const int shangyibu = 8710; |
| | | |
| | | /// <summary> |
| | | /// 进出仓 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 已收藏 |
| | | /// </summary> |
| | | public const int yishoucang= 8713; |
| | | public const int yishoucang = 8713; |
| | | /// <summary> |
| | | /// 未收藏 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 音量 |
| | | /// </summary> |
| | | public const int yinliang = 8803; |
| | | public const int yinliang = 8803; |
| | | /// <summary> |
| | | /// 设置 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | public bool isSupportGroupControl = false; |
| | | |
| | | |
| | | public string linkDriverVersion = "3.0.0"; |
| | | /// <summary> |
| | | /// 是否支持场景控制自动化使能 |
| | | /// </summary> |
| | | public bool isSupportSceneEnableAutomation |
| | | { |
| | | get |
| | | { |
| | | #if DEBUG |
| | | linkDriverVersion = "V03.08.00"; |
| | | #endif |
| | | return string.Compare(linkDriverVersion, "V03.07.99", false) == 1 ? true : false; |
| | | |
| | | } |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// |
| | | ///// </summary> |
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\AirSwitchP3EnergyPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\AirSwitchP3SubloopEnergyPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\Constant.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\SceneAutomationListChoosePage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\SceneTargetTypeChoosePage.cs" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" />
|
| | |
| | | using System.Collections.Generic; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock; |
| | | using Newtonsoft.Json; |
| | | |
| | | |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation |
| | |
| | | /// 人体传感器持续时间专用 |
| | | /// </summary> |
| | | private string hold_time=string.Empty; |
| | | /// <summary> |
| | | /// 检测类型 配合condition_type=3时使用,没有该字段、该值或0: 状态检测(每次收到状态就成立),1:动作检测(需要切换状态才成立) |
| | | /// </summary> |
| | | private string detect_type = "0"; |
| | | |
| | | |
| | | |
| | | |
| | | private static ConditionDeviceFunList m_Current = null; |
| | | |
| | |
| | | //人体存在传感器 |
| | | case SPK.SensorPirHold: |
| | | { |
| | | |
| | | |
| | | |
| | | LogicView.FunTypeView view1 = new LogicView.FunTypeView(); |
| | | view1.btnText.TextID = StringId.rentijiance; |
| | |
| | | |
| | | }; |
| | | |
| | | LogicView.FunTypeView view3 = new LogicView.FunTypeView(); |
| | | view3.frameLayout.Y = view2.frameLayout.Bottom; |
| | | view3.btnText.TextID = StringId.zhixingmoshi; |
| | | view3.btnState.TextID = StringId.shoudaojiuzhixing; |
| | | fLayout.AddChidren(view3.FLayoutView()); |
| | | view3.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence }; |
| | | this.AddChidren(frame); |
| | | LogicView.SwitchView switchView = new LogicView.SwitchView(); |
| | | switchView.FLayoutView(frame, StringId.gaibiancaizhixing, StringId.shoudaojiuzhixing, view3.btnState.Text, 2, (intValue) => |
| | | { |
| | | if (StringId.gaibiancaizhixing == intValue) |
| | | { |
| | | this.detect_type = "1"; |
| | | } |
| | | else |
| | | { |
| | | this.detect_type = "0"; |
| | | } |
| | | view3.btnState.TextID = intValue; |
| | | selectedState = device.spk + "_" + this.detect_type; |
| | | }); |
| | | }; |
| | | |
| | | |
| | | if (edit) |
| | | { |
| | |
| | | int h = time / (60 * 60); |
| | | int m = time % (60 * 60) / 60; |
| | | int s = (time % (60 * 60) % 60); |
| | | view2.btnState.Text = LogicMethod.Current.getTimeStr(inputs.hold_time); |
| | | view2.btnState.Text = LogicMethod.Current.getTimeStr(inputs.hold_time); |
| | | view2.btnState.Name = h + ":" + m + ":" + s; |
| | | this.hold_time = inputs.hold_time; |
| | | } |
| | | if (!string.IsNullOrEmpty(inputs.detect_type)) |
| | | { |
| | | this.detect_type = inputs.detect_type; |
| | | if (inputs.detect_type == "1") |
| | | { |
| | | view3.btnState.TextID = StringId.gaibiancaizhixing; |
| | | } |
| | | else |
| | | { |
| | | view3.btnState.TextID = StringId.shoudaojiuzhixing; |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | { |
| | | //人体存在传感器 |
| | | inputDevice.hold_time = this.hold_time; |
| | | inputDevice.detect_type = this.detect_type; |
| | | } |
| | | |
| | | |
| | |
| | | string value = this.GetKeyValue("people_status", dicList); |
| | | if (string.IsNullOrEmpty(value)) |
| | | { |
| | | inputView.btnState.Text = LogicMethod.Current.getTimeStr(inputCondition.hold_time).Replace("0s",""); |
| | | inputView.btnState.Text = LogicMethod.Current.getTimeStr(inputCondition.hold_time).Replace("0s", ""); |
| | | break; |
| | | |
| | | } |
| | |
| | | int time = int.Parse(inputCondition.hold_time); |
| | | inputView.btnState.Text += "持续" + LogicMethod.Current.getTimeStr(inputCondition.hold_time).Replace("0s", ""); |
| | | } |
| | | if (!string.IsNullOrEmpty(inputCondition.detect_type)) |
| | | { |
| | | if (inputCondition.detect_type == "1") |
| | | { |
| | | inputView.btnState.Text += "," + Language.StringByID(StringId.gaibiancaizhixing); |
| | | } |
| | | else |
| | | { |
| | | inputView.btnState.Text += "," + Language.StringByID(StringId.shoudaojiuzhixing); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | /// </summary> |
| | | public string identifier = ""; |
| | | /// <summary> |
| | | /// 检测类型 配合condition_type=3时使用,没有该字段、该值或0: 状态检测(每次收到状态就成立),1:动作检测(需要切换状态才成立); |
| | | /// </summary> |
| | | public string detect_type = "0"; |
| | | /// <summary> |
| | | /// 人体移动传感器(带持续时间) |
| | | /// </summary> |
| | | public string hold_time = ""; |
| | |
| | | //不是主账号直接返回 |
| | | return; |
| | | } |
| | | List<LogicData> logicDataList = new List<LogicData>(); |
| | | List<LogicIdData> logicDataList = new List<LogicIdData>(); |
| | | logicDataList.Clear(); |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | | try |
| | | { |
| | | //获取逻辑ID列表,目前针对所有<备注:如果只针对当前手机的话,可以直接拿缓存数据自动化列表遍历> |
| | | var idStr = Send.Current.GetLogicIdList(); |
| | | if (idStr != null) |
| | | var idStrList = Send.Current.GetLogicIdList(); |
| | | if (idStrList != null) |
| | | { |
| | | var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); |
| | | logicDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date); |
| | | logicDataList.AddRange(idStrList); |
| | | } |
| | | ///有自动列表才处理 |
| | | if (logicDataList.Count > 0) |
| | |
| | | }; |
| | | |
| | | ///显示之前状态 |
| | | if (stateVuale != "") |
| | | if (!string.IsNullOrEmpty(stateVuale)) |
| | | { |
| | | if (stateVuale == btnOn.Text) |
| | | { |
| | |
| | | /// </summary> |
| | | public static void MainShow() |
| | | { |
| | | automationPage.RemoveAll(); |
| | | VerticalRefreshLayout vv = new VerticalRefreshLayout(); |
| | | vv.Height = Application.GetRealHeight(667 - 64 - 49);//模拟高度 |
| | | automationPage.AddChidren(vv); |
| | | vv.BeginHeaderRefreshingAction += () => |
| | | |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | | //清除之前自动化列表; |
| | | Logic.LogicList.Clear(); |
| | | //获取自动列表 |
| | | GetLogicList(); |
| | | //刷新自动化界面 |
| | | MainShow(); |
| | | //关闭刷新View; |
| | | vv.EndHeaderRefreshing(); |
| | | }; |
| | | //获取自动化列表 |
| | | GetLogicList(); |
| | | for (int i = Logic.LogicList.Count - 1; i >= 0; i--)//降序排列 |
| | | //for (int i = 0; i < Logic.LogicList.Count; i++) |
| | | { |
| | | var currLogic = Logic.LogicList[i]; |
| | | ///上下间隔12像素 |
| | | vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); |
| | | LogicView.SingleLogicView logicView = new LogicView.SingleLogicView(); |
| | | vv.AddChidren(logicView.FLayoutView()); |
| | | logicView.btnLogicName.Text = currLogic.name; |
| | | logicView.btnWeekText.Text = GetCyclicText(currLogic); |
| | | logicView.btnclick.MouseUpEventHandler += (sen, e) => |
| | | try |
| | | { |
| | | //Logic.currlogic = currLogic; |
| | | //var addLogic = new AddLogic(); |
| | | //MainPage.BasePageView.AddChidren(addLogic); |
| | | //addLogic.Show(); |
| | | //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | new MainView { }.SkipAddLogicPage(currLogic); |
| | | }; |
| | | //开关图标的点击事件 |
| | | logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) => |
| | | //获取自动化列表 |
| | | GetLogicList(); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = !logicView.btnSwitchIcon.IsSelected; |
| | | if (logicView.btnSwitchIcon.IsSelected) |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = true; |
| | | currLogic.enable = "true"; |
| | | } |
| | | else |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = false; |
| | | currLogic.enable = "false"; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | |
| | | automationPage.RemoveAll(); |
| | | VerticalRefreshLayout vv = new VerticalRefreshLayout(); |
| | | vv.Height = Application.GetRealHeight(667 - 64 - 49);//模拟高度 |
| | | automationPage.AddChidren(vv); |
| | | vv.BeginHeaderRefreshingAction += () => |
| | | { |
| | | //逻辑使能的命令 |
| | | Send.Current.EnableLogic(currLogic); |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | | try |
| | | { |
| | | //强制更新自动化列表; |
| | | Logic.LogicList.Clear(); |
| | | //获取自动化列表 |
| | | GetLogicList(); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | //刷新自动化界面 |
| | | MainShow(); |
| | | //关闭刷新View; |
| | | vv.EndHeaderRefreshing(); |
| | | |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | |
| | | |
| | | }; |
| | | |
| | | for (int i = Logic.LogicList.Count - 1; i >= 0; i--)//降序排列 |
| | | { |
| | | var currLogic = Logic.LogicList[i]; |
| | | ///上下间隔12像素 |
| | | vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); |
| | | LogicView.SingleLogicView logicView = new LogicView.SingleLogicView(); |
| | | vv.AddChidren(logicView.FLayoutView()); |
| | | logicView.btnLogicName.Text = currLogic.name; |
| | | logicView.btnWeekText.Text = GetCyclicText(currLogic); |
| | | logicView.btnclick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | //Logic.currlogic = currLogic; |
| | | //var addLogic = new AddLogic(); |
| | | //MainPage.BasePageView.AddChidren(addLogic); |
| | | //addLogic.Show(); |
| | | //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | new MainView { }.SkipAddLogicPage(currLogic); |
| | | }; |
| | | //开关图标的点击事件 |
| | | logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = !logicView.btnSwitchIcon.IsSelected; |
| | | if (logicView.btnSwitchIcon.IsSelected) |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = true; |
| | | currLogic.enable = "true"; |
| | | } |
| | | else |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = false; |
| | | currLogic.enable = "false"; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | //逻辑使能的命令 |
| | | Send.Current.EnableLogic(currLogic); |
| | | |
| | | } |
| | | catch { } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | |
| | | GetSelectIcon(logicView.frameLayout, currLogic); |
| | | if (i == 0)//降序排列 |
| | | { |
| | | ///最后一个距离最底部12,界面显示效果作用; |
| | | vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(20) }); |
| | | } |
| | | if (currLogic.enable == "true") |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = false; |
| | | } |
| | | ///显示特殊自动化标志 |
| | | if (currLogic.tag == true) |
| | | { |
| | | logicView.btnIsDelTag.Visible = true; |
| | | } |
| | | else |
| | | { |
| | | logicView.btnIsDelTag.Visible = false; |
| | | } |
| | | } |
| | | catch { } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | if (Logic.LogicList.Count == 0) |
| | | { |
| | | Button btnTipNot = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(120), |
| | | Width = Application.GetRealWidth(180), |
| | | Height = Application.GetRealWidth(180), |
| | | UnSelectedImagePath = "TipNot.png", |
| | | }; |
| | | automationPage.AddChidren(btnTipNot); |
| | | Button btnTipNotText = new Button() |
| | | { |
| | | Y = btnTipNot.Bottom + Application.GetRealHeight(16), |
| | | Height = Application.GetRealHeight(20), |
| | | TextID = StringId.logicnull, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = LogicView.TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textConfirmColor, |
| | | }; |
| | | automationPage.AddChidren(btnTipNotText); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | |
| | | GetSelectIcon(logicView.frameLayout, currLogic); |
| | | if (i == 0)//降序排列 |
| | | //if (Logic.LogicList.Count - 1 == i) |
| | | { |
| | | ///最后一个距离最底部12,界面显示效果作用; |
| | | vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); |
| | | } |
| | | if (currLogic.enable == "true") |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = false; |
| | | } |
| | | ///显示特殊自动化标志 |
| | | if (currLogic.tag == true) |
| | | { |
| | | logicView.btnIsDelTag.Visible = true; |
| | | } |
| | | else |
| | | { |
| | | logicView.btnIsDelTag.Visible = false; |
| | | } |
| | | } |
| | | |
| | | if (Logic.LogicList.Count == 0) |
| | | { |
| | | Button btnTipNot = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(120), |
| | | Width = Application.GetRealWidth(180), |
| | | Height = Application.GetRealWidth(180), |
| | | UnSelectedImagePath = "TipNot.png", |
| | | }; |
| | | automationPage.AddChidren(btnTipNot); |
| | | Button btnTipNotText = new Button() |
| | | { |
| | | Y = btnTipNot.Bottom + Application.GetRealHeight(16), |
| | | Height = Application.GetRealHeight(20), |
| | | TextID = StringId.logicnull, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = LogicView.TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textConfirmColor, |
| | | }; |
| | | automationPage.AddChidren(btnTipNotText); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 按+跳转到逻辑界面的方法 |
| | |
| | | //自动化列表为0才去获取自动化列表; |
| | | return; |
| | | } |
| | | List<string> logicIdList = new List<string>(); |
| | | var logicIdList = new List<string>(); |
| | | //获取逻辑ID列表 |
| | | var idStr = Send.Current.GetLogicIdList(); |
| | | if (idStr != null) |
| | | var dateList = Send.Current.GetLogicIdList(); |
| | | if (dateList != null) |
| | | { |
| | | var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); |
| | | var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date); |
| | | for (int i = 0; i < dateList.Count; i++) |
| | | { |
| | | //添加逻辑ID |
| | |
| | | } |
| | | } |
| | | //获取自动化列表 |
| | | var logicListStr = Send.Current.GetLogic(logicIdList); |
| | | if (logicListStr != null) |
| | | var logicList = Send.Current.GetLogic(logicIdList); |
| | | if (logicList != null) |
| | | { |
| | | var logicList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(logicListStr.Data.ToString()); |
| | | for (int j = 0; j < logicList.Count; j++) |
| | | { |
| | | var logic = logicList[j]; |
| | | if (logic != null) |
| | | { |
| | | //查找是否已经存在该逻辑 |
| | | //去重 |
| | | var if_logic = Logic.LogicList.Find((c) => c.userLogicId == logic.userLogicId); |
| | | if (if_logic == null) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | class LogicData |
| | | } |
| | | public class LogicIdData |
| | | { |
| | | /// <summary> |
| | | /// 云端唯一id |
| | |
| | | /// 获取逻辑ID列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetLogicIdList(bool isTip = false) |
| | | public List<LogicIdData> GetLogicIdList(bool isTip = false) |
| | | { |
| | | var jObject = new JObject { { "homeId", LogicMethod.Current.HomeId } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_List, "获取逻辑ID列表"); |
| | |
| | | { |
| | | return null; |
| | | } |
| | | return responsePackNew; |
| | | var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicIdData>>(responsePackNew.Data.ToString()); |
| | | return dateList; |
| | | } |
| | | /// <summary> |
| | | /// 获取自动化详情 |
| | | /// </summary> |
| | | /// <param name="listIdList">自动化ID列表</param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetLogic(List<string> listIdList, bool isTip = false) |
| | | public ResponsePackNew GetLogic1(List<string> listIdList, bool isTip = false) |
| | | { |
| | | var jArray = new JArray { }; |
| | | for (int i = 0; i < listIdList.Count; i++) |
| | |
| | | } |
| | | return responsePackNew; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取自动化详情 |
| | | /// </summary> |
| | | /// <param name="listIdList">自动化ID列表</param> |
| | | /// <returns></returns> |
| | | public List<Logic> GetLogic(List<string> listIdList, bool isTip = false) |
| | | { |
| | | var jArray = new JArray { }; |
| | | for (int i = 0; i < listIdList.Count; i++) |
| | | { |
| | | jArray.Add(listIdList[i]); |
| | | } |
| | | var jObject = new JObject { { "userLogicIds", jArray } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Info, "获取自动化详情"); |
| | | //如果是token过期则刷新token |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) |
| | | { |
| | | RefreshToken(); |
| | | GetLogic(listIdList, isTip); |
| | | } |
| | | if (Check(responsePackNew, isTip) == false) |
| | | { |
| | | return null; |
| | | } |
| | | var logicList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(responsePackNew.Data.ToString()); |
| | | return logicList; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加自动化命令 |
| | | /// </summary> |
| | |
| | | if (!string.IsNullOrEmpty(dictionary.hold_time)) |
| | | { |
| | | inputTypeJOb.Add("hold_time", dictionary.hold_time); |
| | | } |
| | | if (!string.IsNullOrEmpty(dictionary.detect_type)) |
| | | { |
| | | inputTypeJOb.Add("detect_type", dictionary.detect_type); |
| | | } |
| | | inputTypeJOb.Add("condition_type", dictionary.condition_type); |
| | | if (dictionary.condition_type=="9") { |
| | |
| | | if (!string.IsNullOrEmpty(dictionary.hold_time)) |
| | | { |
| | | inputTypeJOb.Add("hold_time", dictionary.hold_time); |
| | | } |
| | | if (!string.IsNullOrEmpty(dictionary.detect_type)) |
| | | { |
| | | inputTypeJOb.Add("detect_type", dictionary.detect_type); |
| | | } |
| | | inputTypeJOb.Add("condition_type", dictionary.condition_type); |
| | | if (dictionary.condition_type == "9") |
| | |
| | | /// <returns></returns> |
| | | public bool Check(ResponsePackNew r, bool isTip) |
| | | { |
| | | if (r == null) |
| | | { |
| | | r = new ResponsePackNew { message = "没回复,请确认网络是否正常.", Code = "-1", }; |
| | | } |
| | | if (r.Code == "0" && r.Data != null && r.Data.ToString() != "") |
| | | { |
| | | return true; |
| | | } |
| | | if (r.Code != "0") |
| | | //失败时是否要提示 |
| | | if (isTip) |
| | | { |
| | | //失败时是否要提示 |
| | | if (isTip) |
| | | { |
| | | if (r == null) |
| | | { |
| | | r = new ResponsePackNew { message = "没回复,请确认网络是否正常.", Code = "-1", }; |
| | | } |
| | | new LogicView.TipPopView().FlashingBox(r.message + $"({r.Code})"); |
| | | } |
| | | new LogicView.TipPopView().FlashingBox(r.message + $"({r.Code})"); |
| | | } |
| | | return false; |
| | | } |
| | |
| | | public void LoadPage() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene)).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene)); |
| | | topView.LoadTopView(); |
| | | |
| | | #region 添加场景 |
| | | FrameLayout addSceneView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(67), |
| | | Y = Application.GetRealHeight(67 + 10), |
| | | Width = Application.GetRealWidth(361), |
| | | Height = Application.GetRealWidth(202), |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | |
| | | |
| | | public void LoadPage() |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene)).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene)); |
| | | topView.LoadTopView(); |
| | | |
| | | bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(603 - 50), |
| | | Y = Application.GetRealHeight(64+10), |
| | | Height = Application.GetRealHeight(603 - 50 -10), |
| | | //BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | |
| | | }; |
| | | row.AddChidren(btnFunctionInfo); |
| | | |
| | | var btnFunctionDelayInfo = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(327), |
| | | Y = Application.GetRealWidth(35), |
| | | Height = Application.GetRealWidth(32), |
| | | TextAlignment = TextAlignment.TopRight, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | row.AddChidren(btnFunctionDelayInfo); |
| | | |
| | | if (Convert.ToInt32(scenefunction.delay) > 0) |
| | | { |
| | | btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); |
| | | } |
| | | else |
| | | { |
| | | btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay); |
| | | } |
| | | |
| | | var btnFunctionName = new Button() |
| | | { |
| | |
| | | }; |
| | | row.AddChidren(btnFunctionName); |
| | | |
| | | var btnFunctionFloorAndRoom = new Button() |
| | | if (scenefunction.type == "7") |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(41), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = scenefunction.localFunction.GetRoomListName(), |
| | | }; |
| | | row.AddChidren(btnFunctionFloorAndRoom); |
| | | btnFunctionName.Gravity = Gravity.CenterVertical; |
| | | btnFunctionInfo.TextAlignment = TextAlignment.CenterRight; |
| | | btnFunctionInfo.Gravity = Gravity.CenterVertical; |
| | | |
| | | EventHandler<MouseEventArgs> skipEvent= (sender, e) => |
| | | btnFunctionName.MouseUpEventHandler = (sender, e) =>{ |
| | | try |
| | | { |
| | | LoadAutomationSettingDialog(scenefunction, btnFunctionInfo); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"load automation error : {ex.Message}"); |
| | | } |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | try |
| | | var btnFunctionDelayInfo = new Button() |
| | | { |
| | | var ssf = new SceneFunctionInfoEditPage(scene, scenefunction.localFunction.ConvertSceneFunction(), refreshFunctionRowAction); |
| | | MainPage.BasePageView.AddChidren(ssf); |
| | | ssf.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }catch(Exception ex) |
| | | Width = Application.GetRealWidth(327), |
| | | Y = Application.GetRealWidth(35), |
| | | Height = Application.GetRealWidth(32), |
| | | TextAlignment = TextAlignment.TopRight, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | row.AddChidren(btnFunctionDelayInfo); |
| | | |
| | | if (Convert.ToInt32(scenefunction.delay) > 0) |
| | | { |
| | | MainPage.Log($"load SceneFunctionInfoEditPage error : {ex.Message}"); |
| | | btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); |
| | | } |
| | | }; |
| | | else |
| | | { |
| | | btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay); |
| | | } |
| | | |
| | | btnFunctionName.MouseUpEventHandler = skipEvent; |
| | | btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent; |
| | | var btnFunctionFloorAndRoom = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(41), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = scenefunction.localFunction.GetRoomListName(), |
| | | }; |
| | | row.AddChidren(btnFunctionFloorAndRoom); |
| | | EventHandler<MouseEventArgs> skipEvent = (sender, e) => |
| | | { |
| | | try |
| | | { |
| | | var ssf = new SceneFunctionInfoEditPage(scene, scenefunction.localFunction.ConvertSceneFunction(), refreshFunctionRowAction); |
| | | MainPage.BasePageView.AddChidren(ssf); |
| | | ssf.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"load SceneFunctionInfoEditPage error : {ex.Message}"); |
| | | } |
| | | }; |
| | | |
| | | btnFunctionName.MouseUpEventHandler = skipEvent; |
| | | btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent; |
| | | } |
| | | |
| | | Button btnDelSceneFunction = new Button() |
| | | { |
| | |
| | | string GetFunctionScnenInfo(SceneFunction sceneFunction) |
| | | { |
| | | var sceneFunctionInfo = ""; |
| | | foreach (var sfs in sceneFunction.status) |
| | | if (sceneFunction.type == "7") |
| | | { |
| | | if (sfs.key == FunctionAttributeKey.OnOff) |
| | | foreach (var sfs in sceneFunction.status) |
| | | { |
| | | if (sfs.value == "off") |
| | | return Language.StringByID(StringId.Close); |
| | | } |
| | | } |
| | | |
| | | sceneFunctionInfo += Language.StringByID(StringId.Open); |
| | | |
| | | var modeState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Mode); |
| | | var tempState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp); |
| | | var fanState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed); |
| | | if (modeState != null) |
| | | { |
| | | sceneFunctionInfo += modeState.GetValueText(); |
| | | } |
| | | if (tempState != null) |
| | | { |
| | | sceneFunctionInfo += tempState.GetValueText(); |
| | | sceneFunctionInfo += tempState.GetUintString(); |
| | | } |
| | | if (fanState != null) |
| | | { |
| | | sceneFunctionInfo += fanState.GetValueText(); |
| | | } |
| | | var briState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); |
| | | if (briState != null) |
| | | { |
| | | sceneFunctionInfo += " " + briState.value + "%"; |
| | | } |
| | | var perState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent); |
| | | if (perState != null) |
| | | { |
| | | sceneFunctionInfo += " " + perState.value + "%"; |
| | | } |
| | | var perAngle = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Angle); |
| | | if (perAngle != null) |
| | | { |
| | | sceneFunctionInfo += " "+ perAngle.value + "°"; |
| | | } |
| | | |
| | | var perColorful = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful); |
| | | if(perColorful != null) |
| | | { |
| | | if (perColorful.value == "on") |
| | | { |
| | | sceneFunctionInfo += " " + Language.StringByID(StringId.HorseRaceLamp); |
| | | } |
| | | else |
| | | { |
| | | if (sceneFunction.localFunction.spk == SPK.GroupControl) |
| | | if (sfs.key == "enable") |
| | | { |
| | | sceneFunctionInfo += " " + Language.StringByID(StringId.Close) + " " + Language.StringByID(StringId.HorseRaceLamp); |
| | | if (sfs.value == "true") |
| | | return Language.StringByID(StringId.OpenArm); |
| | | else |
| | | { |
| | | return Language.StringByID(StringId.Close); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | foreach (var sfs in sceneFunction.status) |
| | | { |
| | | if (sfs.key == FunctionAttributeKey.OnOff) |
| | | { |
| | | if (sfs.value == "off") |
| | | return Language.StringByID(StringId.Close); |
| | | } |
| | | } |
| | | |
| | | sceneFunctionInfo += Language.StringByID(StringId.Open); |
| | | |
| | | var modeState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Mode); |
| | | var tempState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp); |
| | | var fanState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed); |
| | | if (modeState != null) |
| | | { |
| | | sceneFunctionInfo += modeState.GetValueText(); |
| | | } |
| | | if (tempState != null) |
| | | { |
| | | sceneFunctionInfo += tempState.GetValueText(); |
| | | sceneFunctionInfo += tempState.GetUintString(); |
| | | } |
| | | if (fanState != null) |
| | | { |
| | | sceneFunctionInfo += fanState.GetValueText(); |
| | | } |
| | | var briState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); |
| | | if (briState != null) |
| | | { |
| | | sceneFunctionInfo += " " + briState.value + "%"; |
| | | } |
| | | var perState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent); |
| | | if (perState != null) |
| | | { |
| | | sceneFunctionInfo += " " + perState.value + "%"; |
| | | } |
| | | var perAngle = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Angle); |
| | | if (perAngle != null) |
| | | { |
| | | sceneFunctionInfo += " " + perAngle.value + "°"; |
| | | } |
| | | |
| | | var perColorful = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful); |
| | | if (perColorful != null) |
| | | { |
| | | if (perColorful.value == "on") |
| | | { |
| | | sceneFunctionInfo += " " + Language.StringByID(StringId.HorseRaceLamp); |
| | | } |
| | | else |
| | | { |
| | | sceneFunctionInfo = Language.StringByID(StringId.Close) + " " + Language.StringByID(StringId.HorseRaceLamp); |
| | | if (sceneFunction.localFunction.spk == SPK.GroupControl) |
| | | { |
| | | sceneFunctionInfo += " " + Language.StringByID(StringId.Close) + " " + Language.StringByID(StringId.HorseRaceLamp); |
| | | } |
| | | else |
| | | { |
| | | sceneFunctionInfo = Language.StringByID(StringId.Close) + " " + Language.StringByID(StringId.HorseRaceLamp); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | var perSetVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume); |
| | | if (perSetVolume != null) |
| | | { |
| | | sceneFunctionInfo += " " + perSetVolume.value ; |
| | | } |
| | | var perSetVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume); |
| | | if (perSetVolume != null) |
| | | { |
| | | sceneFunctionInfo += " " + perSetVolume.value; |
| | | } |
| | | |
| | | var perSignal = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Signal); |
| | | if (perSignal != null) |
| | | { |
| | | var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface(); |
| | | string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value); |
| | | sceneFunctionInfo += " " + key; |
| | | } |
| | | var perSignal = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Signal); |
| | | if (perSignal != null) |
| | | { |
| | | var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface(); |
| | | string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value); |
| | | sceneFunctionInfo += " " + key; |
| | | } |
| | | |
| | | var perVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Volume); |
| | | if (perVolume != null) |
| | | { |
| | | sceneFunctionInfo += " " + perVolume.value; |
| | | } |
| | | var perVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Volume); |
| | | if (perVolume != null) |
| | | { |
| | | sceneFunctionInfo += " " + perVolume.value; |
| | | } |
| | | |
| | | var perSongName = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SongName); |
| | | if (perSongName != null) |
| | | { |
| | | sceneFunctionInfo += " " + perSongName.value; |
| | | var perSongName = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SongName); |
| | | if (perSongName != null) |
| | | { |
| | | sceneFunctionInfo += " " + perSongName.value; |
| | | } |
| | | } |
| | | return sceneFunctionInfo; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载自动化配置弹窗 |
| | | /// </summary> |
| | | void LoadAutomationSettingDialog(SceneFunction temp,Button btnTipText) |
| | | { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | var pView = new FrameLayout() |
| | | { |
| | | BackgroundColor = CSS_Color.DialogTransparentColor1, |
| | | }; |
| | | dialog.AddChidren(pView); |
| | | |
| | | var optionBaseView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(500), |
| | | Height = Application.GetRealHeight(160), |
| | | AnimateSpeed = 0.3f, |
| | | Animate = Animate.DownToUp, |
| | | }; |
| | | pView.AddChidren(optionBaseView); |
| | | |
| | | var optionView = new VerticalScrolViewLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(100), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | ScrollEnabled = false, |
| | | }; |
| | | optionBaseView.AddChidren(optionView); |
| | | |
| | | var btnOn = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.TextualColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.OpenArm, |
| | | }; |
| | | optionView.AddChidren(btnOn); |
| | | |
| | | optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | var btnOff = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.TextualColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.Close, |
| | | }; |
| | | optionView.AddChidren(btnOff); |
| | | |
| | | var btnCancel = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(8) + optionView.Bottom, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | TextID = StringId.Cancel, |
| | | TextColor = CSS_Color.WarningColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | }; |
| | | optionBaseView.AddChidren(btnCancel); |
| | | |
| | | dialog.Show(); |
| | | |
| | | pView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | btnCancel.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | btnOn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | temp = new SceneFunction(); |
| | | temp.type = "7"; |
| | | temp.status.Add(new SceneFunctionStatus() |
| | | { |
| | | key = "enable", |
| | | value = "true" |
| | | }); |
| | | btnTipText.TextID = StringId.OpenArm; |
| | | }; |
| | | btnOff.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | temp = new SceneFunction(); |
| | | temp.type = "7"; |
| | | temp.status.Add(new SceneFunctionStatus() |
| | | { |
| | | key = "enable", |
| | | value = "false" |
| | | }); |
| | | btnTipText.TextID = StringId.Close; |
| | | }; |
| | | |
| | | } |
| | | |
| | | } |
| | | //-------------------------------------- |
| | | public partial class SceneAddPage |
| | |
| | | void LoadEvent_ChangeFunctionList() |
| | | { |
| | | btnAddFunctionTitle.MouseUpEventHandler = (sender, e) => { |
| | | var sefp = new SceneFunctionListChoosePage(scene, refreshFunctionRowAction); |
| | | MainPage.BasePageView.AddChidren(sefp); |
| | | sefp.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | if (DB_ResidenceData.Instance.HomeGateway.isSupportSceneEnableAutomation) |
| | | { |
| | | //var sefp =new SceneFunctionListChoosePage(scene,refreshFunctionRowAction); |
| | | var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction); |
| | | MainPage.BasePageView.AddChidren(sefp); |
| | | sefp.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | else |
| | | { |
| | | var sefp = new SceneFunctionListChoosePage(scene, refreshFunctionRowAction); |
| | | //var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction); |
| | | MainPage.BasePageView.AddChidren(sefp); |
| | | sefp.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | }; |
| | | } |
| | | |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.UI.UI2.Intelligence.Automation; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class SceneAutomationListChoosePage : FrameLayout |
| | | { |
| | | FrameLayout bodyView; |
| | | Scene scene; |
| | | Action refreshAction; |
| | | List<Logic> addedList = new List<Logic>(); |
| | | |
| | | public SceneAutomationListChoosePage(Scene function, Action action) |
| | | { |
| | | scene = function; |
| | | bodyView = this; |
| | | refreshAction = action; |
| | | refreshAction += () => { |
| | | this.RemoveFromParent(); |
| | | }; |
| | | } |
| | | |
| | | public void LoadPage() |
| | | { |
| | | this.bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | var topView = new TopViewDiv(bodyView,Language.StringByID( StringId.SelectAutomation)); |
| | | topView.LoadTopView(); |
| | | |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(667-70), |
| | | ScrollEnabled = false, |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | |
| | | foreach (var logic in Logic.LogicList) |
| | | { |
| | | |
| | | |
| | | var funtionView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | }; |
| | | contentView.AddChidren(funtionView); |
| | | |
| | | Button btnRight = new Button() |
| | | { |
| | | X = Application.GetRealWidth(339), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/Right.png", |
| | | }; |
| | | funtionView.AddChidren(btnRight); |
| | | |
| | | |
| | | if (scene.functions.Find((obj) => obj.sid == logic.sid) != null) |
| | | { |
| | | addedList.Add(logic); var btnTipAdded = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(327), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextID = StringId.Added |
| | | }; |
| | | funtionView.AddChidren(btnTipAdded); |
| | | addedList.Add(logic); |
| | | } |
| | | |
| | | var btnFunctionTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(220), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | Text = logic.name |
| | | }; |
| | | funtionView.AddChidren(btnFunctionTitle); |
| | | |
| | | var btnClick = new Button() |
| | | { |
| | | X = Application.GetRealWidth(300), |
| | | Width = Application.GetRealWidth(70), |
| | | }; |
| | | funtionView.AddChidren(btnClick); |
| | | btnClick.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | LoadEditDialog_OnOff(logic.sid); |
| | | }; |
| | | |
| | | contentView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载自动化配置弹窗 |
| | | /// </summary> |
| | | void LoadEditDialog_OnOff(string logicSid) |
| | | { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | var pView = new FrameLayout() |
| | | { |
| | | BackgroundColor = CSS_Color.DialogTransparentColor1, |
| | | }; |
| | | dialog.AddChidren(pView); |
| | | |
| | | var optionBaseView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(500), |
| | | Height = Application.GetRealHeight(160), |
| | | AnimateSpeed = 0.3f, |
| | | Animate = Animate.DownToUp, |
| | | }; |
| | | pView.AddChidren(optionBaseView); |
| | | |
| | | var optionView = new VerticalScrolViewLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(100), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | ScrollEnabled = false, |
| | | }; |
| | | optionBaseView.AddChidren(optionView); |
| | | |
| | | var btnOn = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.TextualColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.OpenArm, |
| | | }; |
| | | optionView.AddChidren(btnOn); |
| | | |
| | | optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | var btnOff = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.TextualColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.Close, |
| | | }; |
| | | optionView.AddChidren(btnOff); |
| | | |
| | | var btnCancel = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(8) + optionView.Bottom, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | TextID = StringId.Cancel, |
| | | TextColor = CSS_Color.WarningColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | }; |
| | | optionBaseView.AddChidren(btnCancel); |
| | | |
| | | dialog.Show(); |
| | | |
| | | pView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | btnCancel.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | btnOn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | var temp = scene.functions.Find((obj) => obj.sid == logicSid); |
| | | if (temp != null) |
| | | { |
| | | var kv = temp.status.Find((obj) => obj.key == "enable"); |
| | | if (kv != null) |
| | | { |
| | | kv.value = "true"; |
| | | } |
| | | else |
| | | { |
| | | temp.status.Add(new SceneFunctionStatus() |
| | | { |
| | | key = "enable", |
| | | value = "true", |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | temp = new SceneFunction(); |
| | | temp.type = "7"; |
| | | temp.sid = logicSid; |
| | | temp.status.Add(new SceneFunctionStatus() |
| | | { |
| | | key = "enable", |
| | | value = "true" |
| | | }); |
| | | scene.functions.Add(temp); |
| | | } |
| | | if (scene.userSceneId != null) |
| | | { |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(""); |
| | | new System.Threading.Thread(() => { |
| | | try |
| | | { |
| | | var code = scene.EditScene(); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (code == "0") |
| | | { |
| | | refreshAction(); |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(code); |
| | | } |
| | | }); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | else |
| | | { |
| | | refreshAction(); |
| | | } |
| | | }; |
| | | btnOff.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | var temp = scene.functions.Find((obj) => obj.sid == logicSid); |
| | | if (temp != null) |
| | | { |
| | | var kv = temp.status.Find((obj) => obj.key == "enable"); |
| | | if (kv != null) |
| | | { |
| | | kv.value = "false"; |
| | | } |
| | | else |
| | | { |
| | | temp.status.Add(new SceneFunctionStatus() |
| | | { |
| | | key = "enable", |
| | | value = "false", |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | temp = new SceneFunction(); |
| | | temp.type = "7"; |
| | | temp.sid = logicSid; |
| | | temp.status.Add(new SceneFunctionStatus() |
| | | { |
| | | key = "enable", |
| | | value = "false" |
| | | }); |
| | | scene.functions.Add(temp); |
| | | } |
| | | |
| | | if (scene.userSceneId != null) |
| | | { |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(""); |
| | | new System.Threading.Thread(() => { |
| | | try |
| | | { |
| | | var code = scene.EditScene(); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (code == "0") |
| | | { |
| | | refreshAction(); |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(code); |
| | | } |
| | | }); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | else |
| | | { |
| | | refreshAction(); |
| | | } |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public void LoadPage(Action backRefresh) |
| | | { |
| | | //DB_ResidenceData.Instance.sceneChooseRoomId |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.EditScene)).LoadTopView(backRefresh); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.EditScene)); |
| | | topView.LoadTopView(backRefresh); |
| | | |
| | | initPage(); |
| | | } |
| | | |
| | |
| | | |
| | | VerticalScrolViewLayout contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(603-50), |
| | | Y = Application.GetRealHeight(64 + 10), |
| | | Height = Application.GetRealHeight(603-50-10), |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | contentView.AddChidren(new Button() { Height = Application.GetRealWidth(12) }); |
| | |
| | | Y = Application.GetRealHeight(667 - 50), |
| | | Height = Application.GetRealHeight(50), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.WarningColor, |
| | | TextColor = CSS_Color.WarningColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.Del, |
| | | TextID = StringId.Del, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | //IsBold = true |
| | | }; |
| | |
| | | void LoadFunctionRow() |
| | | { |
| | | functionListView.RemoveAll(); |
| | | functionListView.Height = Application.GetRealWidth(65 * scene.functions.Count); |
| | | for(int i =0;i<scene.functions.Count;) |
| | | { |
| | | var scenefunction = scene.functions[i]; |
| | |
| | | scene.functions.Remove(scenefunction); |
| | | continue; |
| | | } |
| | | functionListView.Height = Application.GetRealWidth(65 * scene.functions.Count); |
| | | try |
| | | { |
| | | //将spk实体里面的min max值放入场景功能实体里,要不然数据会丢失 2022-06-21 16:06:45 |
| | |
| | | }; |
| | | row.AddChidren(btnFunctionInfo); |
| | | |
| | | var btnFunctionDelayInfo = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(327), |
| | | Y = Application.GetRealWidth(35), |
| | | Height = Application.GetRealWidth(32), |
| | | TextAlignment = TextAlignment.TopRight, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | row.AddChidren(btnFunctionDelayInfo); |
| | | |
| | | if (!string.IsNullOrEmpty(scenefunction.delay) && Convert.ToInt32( scenefunction.delay) > 0) |
| | | { |
| | | btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); |
| | | } |
| | | else |
| | | { |
| | | btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay); |
| | | } |
| | | |
| | | var btnFunctionName = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | |
| | | }; |
| | | row.AddChidren(btnFunctionName); |
| | | |
| | | var btnFunctionFloorAndRoom = new Button() |
| | | if (scenefunction.type == "7") |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(41), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = scenefunction.localFunction.GetRoomListName(), |
| | | }; |
| | | row.AddChidren(btnFunctionFloorAndRoom); |
| | | btnFunctionName.Gravity = Gravity.CenterVertical; |
| | | btnFunctionInfo.TextAlignment = TextAlignment.CenterRight; |
| | | btnFunctionInfo.Gravity = Gravity.CenterVertical; |
| | | |
| | | EventHandler<MouseEventArgs> skipEvent = (sender, e) => |
| | | btnFunctionName.MouseUpEventHandler = (sender, e) => { |
| | | try |
| | | { |
| | | LoadAutomationSettingDialog(scenefunction, btnFunctionInfo); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"load automation error : {ex.Message}"); |
| | | } |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | var ssf = new SceneFunctionInfoEditPage(scene, scenefunction, refreshFunctionRowAction); |
| | | MainPage.BasePageView.AddChidren(ssf); |
| | | ssf.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | btnFunctionName.MouseUpEventHandler = skipEvent; |
| | | btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent; |
| | | btnFunctionDelayInfo.MouseUpEventHandler = skipEvent; |
| | | btnFunctionInfo.MouseUpEventHandler = skipEvent; |
| | | btnRight.MouseUpEventHandler = skipEvent; |
| | | row.MouseUpEventHandler = skipEvent; |
| | | var btnFunctionDelayInfo = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(327), |
| | | Y = Application.GetRealWidth(35), |
| | | Height = Application.GetRealWidth(32), |
| | | TextAlignment = TextAlignment.TopRight, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | row.AddChidren(btnFunctionDelayInfo); |
| | | |
| | | if (!string.IsNullOrEmpty(scenefunction.delay) && Convert.ToInt32(scenefunction.delay) > 0) |
| | | { |
| | | btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); |
| | | } |
| | | else |
| | | { |
| | | btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay); |
| | | } |
| | | |
| | | |
| | | var btnFunctionFloorAndRoom = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(41), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = scenefunction.localFunction.GetRoomListName(), |
| | | }; |
| | | row.AddChidren(btnFunctionFloorAndRoom); |
| | | |
| | | EventHandler<MouseEventArgs> skipEvent = (sender, e) => |
| | | { |
| | | var ssf = new SceneFunctionInfoEditPage(scene, scenefunction, refreshFunctionRowAction); |
| | | MainPage.BasePageView.AddChidren(ssf); |
| | | ssf.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | btnFunctionName.MouseUpEventHandler = skipEvent; |
| | | btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent; |
| | | btnFunctionDelayInfo.MouseUpEventHandler = skipEvent; |
| | | btnFunctionInfo.MouseUpEventHandler = skipEvent; |
| | | btnRight.MouseUpEventHandler = skipEvent; |
| | | row.MouseUpEventHandler = skipEvent; |
| | | } |
| | | |
| | | Button btnDelSceneFunction = new Button() { |
| | | BackgroundColor = CSS_Color.WarningColor, |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载自动化配置弹窗 |
| | | /// </summary> |
| | | void LoadAutomationSettingDialog(SceneFunction temp, Button btnTipText) |
| | | { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | var pView = new FrameLayout() |
| | | { |
| | | BackgroundColor = CSS_Color.DialogTransparentColor1, |
| | | }; |
| | | dialog.AddChidren(pView); |
| | | |
| | | var optionBaseView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(500), |
| | | Height = Application.GetRealHeight(160), |
| | | AnimateSpeed = 0.3f, |
| | | Animate = Animate.DownToUp, |
| | | }; |
| | | pView.AddChidren(optionBaseView); |
| | | |
| | | var optionView = new VerticalScrolViewLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(100), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | ScrollEnabled = false, |
| | | }; |
| | | optionBaseView.AddChidren(optionView); |
| | | |
| | | var btnOn = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.TextualColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.OpenArm, |
| | | }; |
| | | optionView.AddChidren(btnOn); |
| | | |
| | | optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | var btnOff = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.TextualColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.Close, |
| | | }; |
| | | optionView.AddChidren(btnOff); |
| | | |
| | | var btnCancel = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(8) + optionView.Bottom, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | TextID = StringId.Cancel, |
| | | TextColor = CSS_Color.WarningColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | }; |
| | | optionBaseView.AddChidren(btnCancel); |
| | | |
| | | dialog.Show(); |
| | | |
| | | pView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | btnCancel.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | btnOn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | temp.type = "7"; |
| | | var kv = temp.status.Find((obj) => obj.key == "enable"); |
| | | if (kv != null) |
| | | { |
| | | kv.value = "true"; |
| | | } |
| | | else |
| | | { |
| | | temp.status.Add(new SceneFunctionStatus() |
| | | { |
| | | key = "enable", |
| | | value = "true", |
| | | }); |
| | | } |
| | | |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(""); |
| | | new System.Threading.Thread(() => { |
| | | try |
| | | { |
| | | var code = scene.EditScene(); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (code == "0") |
| | | { |
| | | btnTipText.TextID = StringId.OpenArm; |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(code); |
| | | } |
| | | }); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | if(waitPage!= null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | btnOff.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | temp.type = "7"; |
| | | |
| | | var kv = temp.status.Find((obj) => obj.key == "enable"); |
| | | if (kv != null) |
| | | { |
| | | kv.value = "false"; |
| | | } |
| | | else |
| | | { |
| | | temp.status.Add(new SceneFunctionStatus() |
| | | { |
| | | key = "enable", |
| | | value = "false", |
| | | }); |
| | | } |
| | | |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(""); |
| | | new System.Threading.Thread(() => { |
| | | try |
| | | { |
| | | var code = scene.EditScene(); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (code == "0") |
| | | { |
| | | btnTipText.TextID = StringId.Close; |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(code); |
| | | } |
| | | }); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | //-------------------------------------- |
| | | public partial class SceneEditPage |
| | |
| | | void LoadEvent_ChangeFunctionList() |
| | | { |
| | | btnAddFunctionTitle.MouseUpEventHandler = (sender, e) => { |
| | | var sefp =new SceneFunctionListChoosePage(scene,refreshFunctionRowAction); |
| | | MainPage.BasePageView.AddChidren(sefp); |
| | | sefp.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | if (DB_ResidenceData.Instance.HomeGateway.isSupportSceneEnableAutomation) |
| | | { |
| | | //var sefp =new SceneFunctionListChoosePage(scene,refreshFunctionRowAction); |
| | | var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction); |
| | | MainPage.BasePageView.AddChidren(sefp); |
| | | sefp.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | else |
| | | { |
| | | var sefp = new SceneFunctionListChoosePage(scene,refreshFunctionRowAction); |
| | | //var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction); |
| | | MainPage.BasePageView.AddChidren(sefp); |
| | | sefp.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | }; |
| | | } |
| | | |
| | |
| | | public void LoadPage() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.AddFunction)).LoadTopView(); |
| | | //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.AddFunction)); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.AddFunction)); |
| | | topView.LoadTopView(); |
| | | |
| | | #region 显示的功能类型切换区域 |
| | | showdFunctionTypeRow = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(62), |
| | | Y = Application.GetRealHeight(64+10), |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | bodyView.AddChidren(showdFunctionTypeRow); |
| | |
| | | }; |
| | | showdFunctionTypeRow.AddChidren(btnFloor); |
| | | |
| | | |
| | | //btnScreenIcon = new Button() |
| | | //{ |
| | | // Width = Application.GetMinRealAverage(16), |
| | | // Height = Application.GetMinRealAverage(16), |
| | | // X = Application.GetRealWidth(122), |
| | | // Y = Application.GetRealHeight(18), |
| | | // UnSelectedImagePath = "Public/DownIcon.png", |
| | | //}; |
| | | //showdFunctionTypeRow.AddChidren(btnScreenIcon); |
| | | |
| | | //btnScreenText = new Button() |
| | | //{ |
| | | // X = btnScreenIcon.Right, |
| | | // Y = Application.GetRealHeight(18), |
| | | // Width = Application.GetRealWidth(200), |
| | | // Height = Application.GetMinRealAverage(16), |
| | | // TextColor = CSS_Color.FirstLevelTitleColor, |
| | | // TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | // TextAlignment = TextAlignment.CenterLeft, |
| | | // TextID = StringId.Screen |
| | | //}; |
| | | //showdFunctionTypeRow.AddChidren(btnScreenText); |
| | | |
| | | showdFunctionTypeRow.AddChidren(new Button() |
| | | { |
| | | Y = Application.GetRealHeight(49), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealWidth(1), |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }); |
| | | |
| | | #endregion |
| | | |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | | /// 场景模板类型选择界面 |
| | | /// 功能 |
| | | /// 自动化 |
| | | /// </summary> |
| | | public class SceneTargetTypeChoosePage : FrameLayout |
| | | { |
| | | FrameLayout bodyView; |
| | | Scene scene; |
| | | /// <summary> |
| | | /// 更新功能row |
| | | /// </summary> |
| | | Action refreshFunctionRowAction; |
| | | |
| | | public SceneTargetTypeChoosePage(Scene function, Action action) |
| | | { |
| | | bodyView = this; |
| | | scene = function; |
| | | refreshFunctionRowAction = () => |
| | | { |
| | | this.RemoveFromParent(); |
| | | action(); |
| | | }; |
| | | } |
| | | |
| | | public void LoadPage() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | bodyView.AddChidren(new Button() |
| | | { |
| | | Height = Application.GetRealHeight(20), |
| | | BackgroundColor = CSS_Color.BackgroundColor |
| | | }); |
| | | var topView = new TopViewDiv(bodyView,Language.StringByID(StringId.AddExecutionAction)); |
| | | topView.LoadTopView(); |
| | | |
| | | |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(74), |
| | | Height = Application.GetRealHeight(530), |
| | | ScrollEnabled = false, |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | var funtionView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | }; |
| | | contentView.AddChidren(funtionView); |
| | | |
| | | |
| | | var btnFunctionIcon = new Button() |
| | | { |
| | | Gravity = Gravity.CenterVertical, |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetMinRealAverage(22), |
| | | Height = Application.GetMinRealAverage(22), |
| | | UnSelectedImagePath = "Navigation/ClassificationIcon.png", |
| | | }; |
| | | funtionView.AddChidren(btnFunctionIcon); |
| | | |
| | | var btnFunctionRight = new Button() |
| | | { |
| | | X = Application.GetRealWidth(339), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/Right.png", |
| | | }; |
| | | funtionView.AddChidren(btnFunctionRight); |
| | | |
| | | var btnFunctionTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(50), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.Functions, |
| | | }; |
| | | funtionView.AddChidren(btnFunctionTitle); |
| | | |
| | | btnFunctionTitle.MouseUpEventHandler = (sender, e) => { |
| | | |
| | | refreshFunctionRowAction += () => { |
| | | this.RemoveFromParent(); |
| | | }; |
| | | var sefp = new SceneFunctionListChoosePage(scene, refreshFunctionRowAction); |
| | | MainPage.BasePageView.AddChidren(sefp); |
| | | sefp.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | contentView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | var automationView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | }; |
| | | contentView.AddChidren(automationView); |
| | | |
| | | |
| | | var btnAutomationRight = new Button() |
| | | { |
| | | X = Application.GetRealWidth(339), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/Right.png", |
| | | }; |
| | | automationView.AddChidren(btnAutomationRight); |
| | | var btnAutomationIcon = new Button() |
| | | { |
| | | Gravity = Gravity.CenterVertical, |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetMinRealAverage(22), |
| | | Height = Application.GetMinRealAverage(22), |
| | | UnSelectedImagePath = "Navigation/IntellectualizationIcon.png", |
| | | }; |
| | | automationView.AddChidren(btnAutomationIcon); |
| | | |
| | | var btnAutomationTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(50), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.Automation, |
| | | }; |
| | | automationView.AddChidren(btnAutomationTitle); |
| | | |
| | | btnAutomationTitle.MouseUpEventHandler = (sender, e) => { |
| | | |
| | | refreshFunctionRowAction += () => { |
| | | this.RemoveFromParent(); |
| | | }; |
| | | |
| | | var sefp = new SceneAutomationListChoosePage(scene, refreshFunctionRowAction); |
| | | MainPage.BasePageView.AddChidren(sefp); |
| | | sefp.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | |
| | | contentView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | |
| | | new TopViewDiv(bodyView, sceneFunction.localFunction.name).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, sceneFunction.localFunction.name); |
| | | topView.LoadTopView(); |
| | | |
| | | contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(520), |
| | | Y = Application.GetRealHeight(64 + 10), |
| | | Height = Application.GetRealHeight(510), |
| | | ScrollEnabled = false, |
| | | }; |
| | | bodyView.AddChidren(contentView); |