| | |
| | | <Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.FE1D0763-7181-4B0C-AB18-E30AA773A6FA" /> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs"> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs"> |
| | | <Files> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs" Line="83" Column="43" /> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Weather.cs" Line="62" Column="70" /> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs" Line="203" Column="24" /> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs" Line="1" Column="1" /> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs" Line="50" Column="15" /> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs" Line="1866" Column="42" /> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs" Line="516" Column="17" /> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs" Line="114" Column="22" /> |
| | | </Files> |
| | | <Pads> |
| | | <Pad Id="ProjectPad"> |
| | | <State name="__root__"> |
| | | <Node name="HDL_APP_Project" expanded="True"> |
| | | <Node name="HDL_ON" expanded="True"> |
| | | <Node name="Entity" expanded="True" /> |
| | | <Node name="DAL" expanded="True"> |
| | | <Node name="DriverLayer" expanded="True" /> |
| | | <Node name="Mqtt" expanded="True" /> |
| | | <Node name="Server" expanded="True" /> |
| | | </Node> |
| | | <Node name="Entity" expanded="True"> |
| | | <Node name="Function" expanded="True" /> |
| | | </Node> |
| | | <Node name="UI" expanded="True"> |
| | | <Node name="UI0-Stan" expanded="True"> |
| | | <Node name="Logic" expanded="True" /> |
| | | </Node> |
| | | <Node name="UI2" expanded="True"> |
| | | <Node name="2-Classification" expanded="True" /> |
| | | <Node name="3-Intelligence" expanded="True"> |
| | | <Node name="Automation" expanded="True"> |
| | | <Node name="AddTarget.cs" selected="True" /> |
| | | <Node name="TargetDeviceFunList.cs" selected="True" /> |
| | | </Node> |
| | | </Node> |
| | | <Node name="4-PersonalCenter" expanded="True" /> |
| | | <Node name="4-PersonalCenter" expanded="True"> |
| | | <Node name="PirDevice" expanded="True" /> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | <Node name="HDL-ON_Android" expanded="True"> |
| | | <Node name="Assets" expanded="True" /> |
| | | </Node> |
| | | </Node> |
| | | </State> |
| | |
| | | <Breakpoint file="/Users/jlchen/Desktop/wjc/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" line="34" column="1" /> |
| | | <Breakpoint file="/Users/jlchen/Desktop/wjc/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorMegahealth/AddSenesorMegahealthDirection1Page.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorMegahealth/AddSenesorMegahealthDirection1Page.cs" line="118" column="1" /> |
| | | <Breakpoint file="/Users/jlchen/Desktop/wjc/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs" line="546" column="1" /> |
| | | <Breakpoint file="/Users/jlchen/Desktop/wjc/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs" line="86" column="1" /> |
| | | <Breakpoint file="/Users/jlchen/Desktop/wjc/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs" line="524" column="1" /> |
| | | </BreakpointStore> |
| | | </MonoDevelop.Ide.DebuggingService.Breakpoints> |
| | | <MultiItemStartupConfigurations /> |
| | |
| | | 7133=已执行 |
| | | 7134=目标状态 |
| | | 7135=跌倒 |
| | | 7136=温度 |
| | | 7137=湿度 |
| | | 7138=PM2.5 |
| | | 7139=CO2 |
| | | 7140=TVOC |
| | | 7141=超标 |
| | | 7142=严重 |
| | | 7143=偏高 |
| | | 7144=优秀 |
| | | |
| | | |
| | | 9000=请使用新的手机账号登录APP |
| | | 9001=请使用新的邮箱账号登录APP |
| | |
| | | 7133=已执行 |
| | | 7134=目标状态 |
| | | 7135=跌倒 |
| | | 7136=温度 |
| | | 7137=湿度 |
| | | 7138=PM2.5 |
| | | 7139=CO2 |
| | | 7140=TVOC |
| | | 7141=超标 |
| | | 7142=严重 |
| | | 7143=偏高 |
| | | 7144=优秀 |
| | | |
| | | 9000=请使用新的手机账号登录APP |
| | | 9001=请使用新的邮箱账号登录APP |
| | |
| | | public const int yizhixing = 7133; |
| | | public const int mubiaozhuangtai = 7134; |
| | | public const int diedao = 7135; |
| | | public const int wendu = 7136; |
| | | public const int shidu = 7137; |
| | | public const int pm25 = 7138; |
| | | public const int co2 = 7139; |
| | | public const int tvoc = 7140; |
| | | public const int chaobiao = 7141; |
| | | public const int yanzhong = 7142; |
| | | public const int piangao = 7143; |
| | | public const int youxiu = 7144; |
| | | |
| | | |
| | | #region LE新增 |
| | | /// <summary> |
| | |
| | | } |
| | | |
| | | //一些特殊的主题处理(为了执行速度,尽可能的别加耗时的操作 true:执行了特殊处理 false:没有执行特殊处理) |
| | | if (Stan.HdlCloudReceiveLogic.Current.CloudOverallMsgReceiveEx(topic, e.ApplicationMessage.Payload, mqttEncryptKey, tuyaEncryptKey) == true) |
| | | { |
| | | return; |
| | | } |
| | | Stan.HdlCloudReceiveLogic.Current.CloudOverallMsgReceiveEx(topic, e.ApplicationMessage.Payload, mqttEncryptKey, tuyaEncryptKey); |
| | | |
| | | if (topic == $"/BusGateWayToClient/{UserInfo.Current.ID}" + PushNotifySqueeze) |
| | | { |
| | |
| | | /// 毫米波传感器 |
| | | /// </summary> |
| | | public const string SenesorMegahealth = "sensor.megahealth"; |
| | | |
| | | /// <summary> |
| | | /// 环境检测传感器 |
| | | /// </summary> |
| | | public const string SenesorEnvironment = "sensor.environment"; |
| | | /// <summary> |
| | | /// 安防传感器spk列表 |
| | | /// </summary> |
| | |
| | | ) => |
| | | { |
| | | Logic.currlogic.name = logicName; |
| | | Logic.currlogic.sid = LogicMethod.NewSid(); |
| | | Logic.currlogic.sid = LogicMethod.CurrLogicMethod.NewSid(); |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | } |
| | | |
| | | Logic.LogicList.Add(Logic.currlogic); |
| | | LogicMethod.RemoveAllView(); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | MainView.MainShow(); |
| | | } |
| | | else if (responsePackNew != null && responsePackNew.Code == "14005") |
| | |
| | | loading.Hide(); |
| | | if (responsePackNew != null && responsePackNew.Code == "0") |
| | | { |
| | | LogicMethod.RemoveAllView(); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | MainView.MainShow(); |
| | | } |
| | | else if (responsePackNew != null && responsePackNew.Code == "14005") |
| | |
| | | /// </summary> |
| | | public void SceneMethod() |
| | | { |
| | | var sceneList = LogicMethod.GetSceneList(); |
| | | var sceneList = LogicMethod.CurrLogicMethod.GetSceneList(); |
| | | List<string> nameList = new List<string>(); |
| | | for (int i = 0; i < sceneList.Count; i++) { |
| | | var scene = sceneList[i]; |
| | |
| | | //没啥作用,为了发送数据格式统一; |
| | | outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "scene" }, { "value", "0" } } }; |
| | | AddOutput(outputDevice); |
| | | LogicMethod.RemoveAllView(); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | |
| | | return; |
| | | } |
| | | Output outputTime= new Output(); |
| | | outputTime.sid = LogicMethod.NewSid(); |
| | | outputTime.sid = LogicMethod.CurrLogicMethod.NewSid(); |
| | | outputTime.target_type = "3"; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", "delay"); |
| | | LogicMethod.dictionary(dic, "value", timepoint); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", "delay"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", timepoint); |
| | | outputTime.status.Add(dic); |
| | | if (edit) |
| | | { |
| | |
| | | AddOutput(outputTime); |
| | | } |
| | | fLayout.RemoveFromParent(); |
| | | LogicMethod.RemoveAllView(); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | |
| | | private void AddDic(string value) |
| | | { |
| | | Input input = new Input(); |
| | | input.sid = LogicMethod.NewSid(); |
| | | input.sid = LogicMethod.CurrLogicMethod.NewSid(); |
| | | input.condition_type = "9"; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", "air_quality"); |
| | | LogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.dictionary(dic, "value", value); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", "air_quality"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", value); |
| | | input.condition.Add(dic); |
| | | AddCondition(input); |
| | | } |
| | |
| | | Logic.currlogic.input.Add(input); |
| | | } |
| | | |
| | | LogicMethod.RemoveAllView(); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | |
| | | using System.Collections.Generic; |
| | | using HDL_ON.Entity; |
| | | |
| | | |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation |
| | | { |
| | | public class ConditionDeviceFunList : FrameLayout |
| | |
| | | /// 定义一个变量,记录选中状态 |
| | | /// </summary> |
| | | private string selectedState = "unknown"; |
| | | |
| | | public void Show(Entity.Function device, int index, bool edit) |
| | | { |
| | | #region 界面布局 |
| | |
| | | case SPK.SenesorMegahealth: |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | | view.btnText.TextID = StringId.mubiaozhuangtai ;//目标状态 |
| | | view.btnText.TextID = StringId.mubiaozhuangtai;//目标状态 |
| | | fLayout.AddChidren(view.FLayoutView()); |
| | | view.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | } |
| | | } |
| | | break; |
| | | //环境检测传感器 |
| | | case SPK.SenesorEnvironment: |
| | | { |
| | | #region 界面 |
| | | ///温度 |
| | | LogicView.FunTypeView wenuView = new LogicView.FunTypeView(); |
| | | wenuView.btnText.TextID = StringId.wendu; |
| | | fLayout.AddChidren(wenuView.FLayoutView()); |
| | | ///湿度 |
| | | LogicView.FunTypeView shiduView = new LogicView.FunTypeView(); |
| | | shiduView.frameLayout.Y = wenuView.frameLayout.Bottom; |
| | | shiduView.btnText.TextID = StringId.shidu; |
| | | fLayout.AddChidren(shiduView.FLayoutView()); |
| | | ///pm2.5 |
| | | LogicView.FunTypeView pm25View = new LogicView.FunTypeView(); |
| | | pm25View.frameLayout.Y = shiduView.frameLayout.Bottom; |
| | | pm25View.btnText.TextID = StringId.pm25; |
| | | fLayout.AddChidren(pm25View.FLayoutView()); |
| | | ///co2 |
| | | LogicView.FunTypeView co2View = new LogicView.FunTypeView(); |
| | | co2View.frameLayout.Y = pm25View.frameLayout.Bottom; |
| | | co2View.btnText.TextID = StringId.co2; |
| | | fLayout.AddChidren(co2View.FLayoutView()); |
| | | ///tvoc |
| | | LogicView.FunTypeView tvocView = new LogicView.FunTypeView(); |
| | | tvocView.frameLayout.Y = co2View.frameLayout.Bottom; |
| | | tvocView.btnText.TextID = StringId.tvoc; |
| | | fLayout.AddChidren(tvocView.FLayoutView()); |
| | | #endregion |
| | | #region 点击事件 |
| | | ///温度点击事件 |
| | | wenuView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | new PublicInterface { }.ViewZuHe(this, StringId.wendugaoyu, StringId.wendudiyu, (intText, view) => |
| | | { |
| | | InputBoxAction(device,intText, index, edit); |
| | | }); |
| | | }; |
| | | ///湿度点击事件 |
| | | shiduView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | new PublicInterface { }.ViewZuHe(this, StringId.shidugaoyu, StringId.shidudiyu, (intText, view) => |
| | | { |
| | | InputBoxAction(device,intText, index, edit); |
| | | }); |
| | | |
| | | }; |
| | | ///pm2.5点击事件 |
| | | pm25View.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | PmCo2TvocAction(this,device, "pm25",StringId.pm25, index,edit); |
| | | }; |
| | | ///co2点击事件 |
| | | co2View.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | PmCo2TvocAction(this,device, "co2", StringId.co2, index, edit); |
| | | }; |
| | | ///tvoc点击事件 |
| | | tvocView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | PmCo2TvocAction(this,device, "tvoc", StringId.tvoc, index, edit); |
| | | |
| | | }; |
| | | #endregion |
| | | } |
| | | break; |
| | | } |
| | | #region 保存 |
| | | ///保存View |
| | |
| | | this.AddChidren(saveView.FLayoutView()); |
| | | saveView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | if (selectedState != "unknown") |
| | | { |
| | | Input inputDevice = new Input(); |
| | | inputDevice.condition_type = "3"; |
| | | inputDevice.sid = device.sid; |
| | | inputDevice.condition = dicSateteList; |
| | | if (edit) |
| | | { |
| | | //移除旧数据 |
| | | Logic.currlogic.input.RemoveAt(index); |
| | | //新数据插入旧数据的位置; |
| | | Logic.currlogic.input.Insert(index, inputDevice); |
| | | } |
| | | else |
| | | { |
| | | //添加一个条件 |
| | | AddCondition(inputDevice); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!edit) |
| | | { |
| | | //提示用户 |
| | | return; |
| | | } |
| | | this.RemoveFromParent(); |
| | | return; |
| | | } |
| | | LogicMethod.RemoveAllView(); |
| | | |
| | | if (MainView.IsGatewayType) |
| | | { //A网关 |
| | | var addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | else |
| | | { |
| | | //一端口网关 |
| | | var onePortAutomation = new OnePortAutomation(); |
| | | MainPage.BasePageView.AddChidren(onePortAutomation); |
| | | onePortAutomation.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | Save(device,index, edit); |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 保存输入条件 |
| | | /// </summary> |
| | | /// <param name="index">索引值</param> |
| | | /// <param name="edit"></param> |
| | | private void Save(Entity.Function device,int index, bool edit) |
| | | { |
| | | |
| | | if (selectedState != "unknown") |
| | | { |
| | | Input inputDevice = new Input(); |
| | | inputDevice.condition_type = "3"; |
| | | inputDevice.sid = device.sid; |
| | | inputDevice.condition = dicSateteList; |
| | | if (edit) |
| | | { |
| | | //移除旧数据 |
| | | Logic.currlogic.input.RemoveAt(index); |
| | | //新数据插入旧数据的位置; |
| | | Logic.currlogic.input.Insert(index, inputDevice); |
| | | } |
| | | else |
| | | { |
| | | //添加一个条件 |
| | | AddCondition(inputDevice); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!edit) |
| | | { |
| | | //提示用户 |
| | | return; |
| | | } |
| | | this.RemoveFromParent(); |
| | | return; |
| | | } |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | if (MainView.IsGatewayType) |
| | | { //A网关 |
| | | var addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | else |
| | | { |
| | | //一端口网关 |
| | | var onePortAutomation = new OnePortAutomation(); |
| | | MainPage.BasePageView.AddChidren(onePortAutomation); |
| | | onePortAutomation.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | |
| | | /// <param name="button">选中状态显示文本Btn控件</param> |
| | | /// <param name="btnText1">属性状态值文本1</param> |
| | | /// <param name="btnText2">属性状态值文本2</param> |
| | | private void DeviceView(Entity.Function device,Button button,int btnText1,int btnText2) { |
| | | private void DeviceView(Entity.Function device, Button button, int btnText1, int btnText2) |
| | | { |
| | | FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence }; |
| | | this.AddChidren(frame); |
| | | LogicView.SwitchView switchView = new LogicView.SwitchView(); |
| | |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 温度,湿度弹框设置值 |
| | | /// </summary> |
| | | /// <param name="textInt">文本</param> |
| | | /// <param name="stateValue">编辑之前的状态值,默认为20</param> |
| | | public void InputBoxAction(Entity.Function device, int textInt, int index, bool edit, string stateValue = "20") |
| | | { |
| | | if (edit) |
| | | { |
| | | Input inputs = Logic.currlogic.input[index]; |
| | | //清除之前旧数据 |
| | | dicSateteList.Clear(); |
| | | if (inputs.condition.Count != 0) |
| | | { |
| | | //有数据重新赋值 |
| | | dicSateteList = inputs.condition; |
| | | } |
| | | } |
| | | new LogicView.TipPopView { }.InputBox(textInt, stateValue, (value) => |
| | | { |
| | | string keyValue = "20"; |
| | | string data_type = "integer"; |
| | | string comparator = "="; |
| | | switch (textInt) |
| | | { |
| | | case StringId.wendugaoyu: |
| | | { |
| | | keyValue = "temperature"; |
| | | comparator = ">"; |
| | | data_type = "float"; |
| | | } |
| | | break; |
| | | case StringId.wendudiyu: |
| | | { |
| | | keyValue = "temperature"; |
| | | comparator = "<"; |
| | | data_type = "float"; |
| | | } |
| | | break; |
| | | case StringId.shidugaoyu: |
| | | { |
| | | keyValue = "humidity"; |
| | | comparator = ">"; |
| | | } |
| | | break; |
| | | case StringId.shidudiyu: |
| | | { |
| | | keyValue = "humidity"; |
| | | comparator = "<"; |
| | | } |
| | | break; |
| | | } |
| | | selectedState = device.spk + "_" + value; |
| | | AddDictionary(keyValue, value, data_type, comparator); |
| | | Save(device,index, edit); |
| | | }); |
| | | } |
| | | /// PM2.5,Co2,Tvoc设置值 |
| | | /// </summary> |
| | | /// <param name="frame">当前界面</param> |
| | | /// <param name="key">属性值,云雀上定义好的<</param> |
| | | /// <param name="title">标题文本</param> |
| | | /// <param name="index"></param> |
| | | /// <param name="edit"></param> |
| | | /// <param name="stateValue">编辑之前的状态值,默认为""</param> |
| | | public void PmCo2TvocAction(FrameLayout frame, Entity.Function device,string key,int title, int index, bool edit, string stateValue = "") |
| | | { |
| | | if (edit) |
| | | { |
| | | Input inputs = Logic.currlogic.input[index]; |
| | | //清除之前旧数据 |
| | | dicSateteList.Clear(); |
| | | if (inputs.condition.Count != 0) |
| | | { |
| | | //有数据重新赋值 |
| | | dicSateteList = inputs.condition; |
| | | } |
| | | } |
| | | PublicInterface view = new PublicInterface(); |
| | | var listStr = view.GetViewList(key); |
| | | view.SingleSelectionShow(frame, listStr, Language.StringByID(title), view.GetString(key, stateValue) |
| | | , (text) => |
| | | { |
| | | var value = view.GetValue(key, text); |
| | | selectedState = device.spk + "_"+ key; |
| | | AddDictionary(key, value, "integer"); |
| | | Save(device,index, edit); |
| | | }); |
| | | } |
| | | /// <summary> |
| | | /// 显示编辑之前的设备状态 |
| | | /// </summary> |
| | | /// <param name="device">编辑设备</param> |
| | |
| | | /// <param name="selectedValue">状态值</param> |
| | | /// <param name="data_type">类型</param> |
| | | /// <param name="comparator">比较关系</param> |
| | | private void AddDictionary(string KeyValue, string selectedValue,string data_type,string comparator="=") |
| | | private void AddDictionary(string KeyValue, string selectedValue, string data_type, string comparator = "=") |
| | | { |
| | | //数据封装 |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", KeyValue); |
| | | LogicMethod.dictionary(dic, "comparator", comparator); |
| | | LogicMethod.dictionary(dic, "data_type", data_type); |
| | | LogicMethod.dictionary(dic, "value", selectedValue); |
| | | AddDictionaryList(KeyValue, comparator,dic); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", KeyValue); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", comparator); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", data_type); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", selectedValue); |
| | | AddDictionaryList(dic); |
| | | } |
| | | /// <summary> |
| | | /// 更新数据列表 |
| | |
| | | /// <param name="comparator">比较关系</param> |
| | | /// <param name="dictionary">添加选中数据</param> |
| | | /// <returns></returns> |
| | | private void AddDictionaryList(string keyValue,string comparator, Dictionary<string, string> dictionary) |
| | | private void AddDictionaryList(Dictionary<string, string> dictionary) |
| | | { |
| | | int indexValue = -1; |
| | | for (int i = 0; i < dicSateteList.Count; i++) |
| | | { |
| | | var dic = dicSateteList[i]; |
| | | string key = dic["key"]; |
| | | string comparatorValue = dic["comparator"]; |
| | | if (key == keyValue && comparatorValue == comparator) |
| | | { |
| | | //判断是否存在 |
| | | indexValue = i; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | var indexValue = IsContainsAll(dictionary, dicSateteList); |
| | | if (indexValue != -1) |
| | | { |
| | | //存在移除 |
| | |
| | | { |
| | | if (Logic.currlogic.input[i].sid == input.sid) |
| | | { |
| | | indexValue = i; |
| | | break; |
| | | //有些设备比较特殊(例如:海林传感器还是要判断属性值,温湿度属性还要判断比较关系,才能确认是否已经存在该条件,其他设备条件直接用sid判断即可) |
| | | //加一级判断是为兼容特殊设备 |
| | | if (IsContainsAll(input.condition, Logic.currlogic.input[i].condition)) |
| | | { |
| | | indexValue = i; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 判断dictionaryB列表是否完整包含另一个dictionaryA |
| | | /// </summary> |
| | | /// <param name="dictionaryA">对象</param> |
| | | /// <param name="dictionaryB">列表</param> |
| | | /// <returns>返回列表的索引值</returns> |
| | | public int IsContainsAll(Dictionary<string, string> dictionaryA, List<Dictionary<string, string>> dictionaryB) |
| | | { |
| | | int valueInt = -1; |
| | | for (int i = 0; i < dictionaryB.Count; i++) |
| | | { |
| | | var dic = dictionaryB[i]; |
| | | string key = dic["key"]; |
| | | string comparatorValue = dic["comparator"]; |
| | | if (dictionaryA["key"] == key && dictionaryA["comparator"] == comparatorValue) |
| | | { |
| | | //判断是否存在 |
| | | valueInt = i; |
| | | break; |
| | | } |
| | | } |
| | | return valueInt; |
| | | } |
| | | /// <summary> |
| | | /// 判断dictionaryB是否完整包含另一个dictionaryA |
| | | /// </summary> |
| | | /// <param name="dictionaryA"></param> |
| | | /// <param name="dictionaryB"></param> |
| | | /// <returns></returns> |
| | | public bool IsContainsAll(List<Dictionary<string, string>> dictionaryA, List<Dictionary<string, string>> dictionaryB) |
| | | { |
| | | |
| | | for (int i = 0; i < dictionaryA.Count; i++) |
| | | { |
| | | var dic = dictionaryA[i]; |
| | | string key = dic["key"]; |
| | | string comparatorValue = dic["comparator"]; |
| | | var list = dictionaryB.FindAll((dictionary) => dictionary["key"] == key && dictionary["comparator"] == comparatorValue); |
| | | if (list.Count> 0) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44 * 5), |
| | | }; |
| | | var roomList = LogicMethod.GetGatewayRoomList(Language.StringByID(StringId.allAreas)); |
| | | var roomList = LogicMethod.CurrLogicMethod.GetGatewayRoomList(Language.StringByID(StringId.allAreas)); |
| | | |
| | | if (roomList.Count > 5) |
| | | { |
| | |
| | | funAllAreaView.btnText2.Text = Language.StringByID(StringId.allFun); |
| | | selectedRoom = (areaView.btnClick.Tag as Entity.Room); |
| | | ///获取显示设备列表 |
| | | var list = LogicMethod.GetFunctionDeviceList(areaView.btnClick.Tag as Entity.Room,if_type); |
| | | var list = LogicMethod.CurrLogicMethod.GetFunctionDeviceList(areaView.btnClick.Tag as Entity.Room,if_type); |
| | | |
| | | DeviceListView(vv, list); |
| | | }; |
| | |
| | | EventHandler<MouseEventArgs> funClick = (sender3, e3) =>{ |
| | | |
| | | //获取最终显示列表 |
| | | var functionList = LogicMethod.GetFunctionDeviceList(selectedRoom, if_type); |
| | | var functionList = LogicMethod.CurrLogicMethod.GetFunctionDeviceList(selectedRoom, if_type); |
| | | //获取设备列表的类型(例如:灯光类,窗帘类。。。) |
| | | var deviceTypeList = LogicMethod.GetDeviceTypeList(functionList); |
| | | var deviceTypeList = LogicMethod.CurrLogicMethod.GetDeviceTypeList(functionList); |
| | | if (deviceTypeList.Count==0) { |
| | | //没有类型直接返回去; |
| | | return; |
| | |
| | | fLayout.RemoveFromParent(); |
| | | funAllAreaView.btnText2.Text = areaView.btnClick.Tag.ToString(); |
| | | ///获取单个类型(例如:灯光类。。)设备FunctionType列表 |
| | | var typeFunctionList = LogicMethod.GetDeviceTypeFunctionList(areaView.btnClick.Tag.ToString()); |
| | | var typeFunctionList = LogicMethod.CurrLogicMethod.GetDeviceTypeFunctionList(areaView.btnClick.Tag.ToString()); |
| | | ///获取单个灯光类型(例如:灯光1,灯光2。。)显示设备列表 |
| | | var lists = LogicMethod.GetShowDeviceList(typeFunctionList, functionList); |
| | | var lists = LogicMethod.CurrLogicMethod.GetShowDeviceList(typeFunctionList, functionList); |
| | | DeviceListView(vv, lists); |
| | | }; |
| | | if (deviceTypeList.Count - 1 == i) |
| | |
| | | funAllAreaView.btnText2.MouseUpEventHandler += funClick; |
| | | funAllAreaView.btnIcon2.MouseUpEventHandler += funClick; |
| | | ///获取显示设备列表 |
| | | var deviceList = LogicMethod.GetFunctionDeviceList(selectedRoom, if_type); |
| | | var deviceList = LogicMethod.CurrLogicMethod.GetFunctionDeviceList(selectedRoom, if_type); |
| | | DeviceListView(vv, deviceList); |
| | | |
| | | } |
| | |
| | | funView.btnLine.X = Application.GetRealWidth(16); |
| | | funView.btnLine.Width = Application.GetRealWidth(343); |
| | | verticalScrolView.AddChidren(funView.FLayoutView()); |
| | | funView.btnIcon.UnSelectedImagePath = LogicMethod.GetIconPath(dev.spk); |
| | | funView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(dev.spk); |
| | | funView.btnDeviceName.Text = dev.name; |
| | | funView.btnRoomName.Text = dev.GetRoomListName(); |
| | | funView.btnClick.MouseUpEventHandler += (sen,e) => { |
| | |
| | | ///各种条件的View |
| | | LogicView.AddOutputInputView inputView = new LogicView.AddOutputInputView(); |
| | | inputView.FLayoutView(viewLayout); |
| | | //添加没有延时,隐藏延时按钮; |
| | | inputView.btnDelay.Visible = false; |
| | | ///记录条件类型 |
| | | inputView.btnClick.Name = inputCondition.condition_type; |
| | | ///记录条件索引 |
| | | inputView.btnClick.Tag = inputCondition.sid; |
| | | inputView.btnClick.Tag = inputCondition; |
| | | ///条件状态数组 |
| | | List<Dictionary<string, string>> dicList = inputCondition.condition as List<Dictionary<string, string>>; |
| | | List<Dictionary<string, string>> dicList = inputCondition.condition; |
| | | //显示条件各种类型状态 |
| | | switch (inputCondition.condition_type) |
| | | { |
| | |
| | | case "3": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.GetDevice(inputCondition.sid); |
| | | var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid); |
| | | //用设备的functionType类型找到对应图标; |
| | | inputView.btnIcon.UnSelectedImagePath = LogicMethod.GetIconPath(device.spk); |
| | | inputView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(device.spk); |
| | | //显示设备名称 |
| | | inputView.btnText.Text = device.name; |
| | | //改变设备名称显示控件宽度 |
| | |
| | | { |
| | | if (value == "true") |
| | | { |
| | | str+= Language.StringByID(StringId.youren)+";"; |
| | | str += Language.StringByID(StringId.youren) + ";"; |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | break; |
| | | case SPK.SenesorEnvironment: |
| | | { |
| | | string strtext = ""; |
| | | foreach (var dic in dicList) |
| | | { |
| | | string key = dic["key"]; |
| | | string value = dic["value"]; |
| | | string comparator = dic["comparator"]; |
| | | switch (key) |
| | | { |
| | | |
| | | case "temperature": |
| | | { |
| | | if (comparator == ">") |
| | | { |
| | | strtext = ">" + value + "℃"; |
| | | } |
| | | else if (comparator == "<") |
| | | { |
| | | strtext = "<" + value + "℃"; |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case "humidity": |
| | | { |
| | | if (comparator == ">") |
| | | { |
| | | strtext = ">" + value + "%"; |
| | | } |
| | | else if (comparator == "<") |
| | | { |
| | | strtext = "<" + value + "%"; |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case "co2": |
| | | { |
| | | strtext = Language.StringByID(StringId.co2) + new PublicInterface { }.GetString("co2", value); |
| | | } |
| | | break; |
| | | case "pm25": |
| | | { |
| | | strtext = Language.StringByID(StringId.pm25) + new PublicInterface { }.GetString("pm25", value); |
| | | } |
| | | break; |
| | | case "tvoc": |
| | | { |
| | | strtext = Language.StringByID(StringId.tvoc) + new PublicInterface { }.GetString("tvoc", value); |
| | | } |
| | | break; |
| | | } |
| | | inputView.btnState.Text = strtext; |
| | | } |
| | | |
| | | |
| | | } |
| | | break; |
| | | |
| | | } |
| | | } |
| | |
| | | { |
| | | case "outdoor_temp": |
| | | { |
| | | strvalue = value; |
| | | strvalue = value + "℃"; |
| | | if (comparator == ">") |
| | | { |
| | | strtext = Language.StringByID(StringId.wendugaoyu); |
| | |
| | | break; |
| | | case "outdoor_humity": |
| | | { |
| | | strvalue = value; |
| | | strvalue = value + "%"; |
| | | if (comparator == ">") |
| | | { |
| | | strtext = Language.StringByID(StringId.shidugaoyu); |
| | |
| | | case "pm2.5": |
| | | { |
| | | strtext = Language.StringByID(StringId.PM25); |
| | | strvalue = new OutdoorEnvironment { }.GetString(value); |
| | | strvalue = new PublicInterface { }.GetString("pm25", value); |
| | | } |
| | | break; |
| | | |
| | |
| | | inputView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | Button button = (Button)sen; |
| | | //当前编辑的条件 |
| | | Input ckcliInput = inputView.btnClick.Tag as Input; |
| | | //找到当前编辑的索引 |
| | | int indexVulae = 0; |
| | | for (int index = 0; index < Logic.currlogic.input.Count; index++) |
| | | { |
| | | Input input = Logic.currlogic.input[index]; |
| | | if (input.sid == inputView.btnClick.Tag.ToString()) |
| | | if (input.sid == ckcliInput.sid) |
| | | { |
| | | //用户可能删除数据,使列表索引发生改变; |
| | | //通过唯一sid重新查找到索引且更新索引值 |
| | | indexVulae = index; |
| | | break; |
| | | if (button.Name == "3") |
| | | { |
| | | //有些设备比较特殊(例如:海林传感器还是要判断属性值,温湿度属性还要判断比较关系,才能确认是否已经存在该条件,其他设备条件直接用sid判断即可) |
| | | //加一级判断是为兼容特殊设备 |
| | | if (new ConditionDeviceFunList { }.IsContainsAll(ckcliInput.condition, input.condition)) |
| | | { |
| | | //用户可能删除数据,使列表索引发生改变; |
| | | //通过唯一sid重新查找到索引且更新索引值 |
| | | indexVulae = index; |
| | | break; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //用户可能删除数据,使列表索引发生改变; |
| | | //通过唯一sid重新查找到索引且更新索引值 |
| | | indexVulae = index; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | //标记编辑状态 |
| | |
| | | Input _input = Logic.currlogic.input[indexVulae]; |
| | | if (_input.condition_type == "1") |
| | | { |
| | | var dicLists = _input.condition as List<Dictionary<string, string>>; |
| | | var dicLists = _input.condition; |
| | | foreach (var dic in dicLists) |
| | | { |
| | | string keyValue = dic["key"]; |
| | |
| | | case "3": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.GetDevice(inputCondition.sid); |
| | | ConditionDeviceFunList deviceFunList = new ConditionDeviceFunList(); |
| | | MainPage.BasePageView.AddChidren(deviceFunList); |
| | | deviceFunList.Show(device, indexVulae, edit); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid); |
| | | if (device.spk == SPK.SenesorEnvironment) |
| | | { |
| | | //这个设备比较特殊 |
| | | ConditionDeviceFunList conditionDeviceFunList = new ConditionDeviceFunList(); |
| | | ///当前的索引值数据对象 |
| | | Input inputedit = Logic.currlogic.input[indexVulae]; |
| | | ///状态值 |
| | | string stateValue = ""; |
| | | foreach (var dic in inputedit.condition) |
| | | { |
| | | string key = dic["key"]; |
| | | string comparator = dic["comparator"]; |
| | | stateValue = dic["value"]; |
| | | switch (key) |
| | | { |
| | | |
| | | case "temperature": |
| | | { |
| | | int titleInt = 0; |
| | | if (comparator == ">") |
| | | { |
| | | titleInt = StringId.wendugaoyu; |
| | | } |
| | | else if (comparator == "<") |
| | | { |
| | | titleInt = StringId.wendudiyu; |
| | | } |
| | | conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | case "humidity": |
| | | { |
| | | int titleInt = 0; |
| | | if (comparator == ">") |
| | | { |
| | | titleInt = StringId.shidugaoyu; |
| | | } |
| | | else if (comparator == "<") |
| | | { |
| | | titleInt = StringId.shidudiyu; |
| | | } |
| | | conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | case "co2": |
| | | { |
| | | conditionDeviceFunList.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | case "pm25": |
| | | { |
| | | conditionDeviceFunList.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue); |
| | | |
| | | } |
| | | break; |
| | | case "tvoc": |
| | | { |
| | | conditionDeviceFunList.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | ConditionDeviceFunList deviceFunList = new ConditionDeviceFunList(); |
| | | MainPage.BasePageView.AddChidren(deviceFunList); |
| | | deviceFunList.Show(device, indexVulae, edit); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | } |
| | | break; |
| | | case "4": |
| | |
| | | ///记录条件索引 |
| | | targetView.btnClick.Tag = outputTarget.sid; |
| | | ///条件状态数组 |
| | | List<Dictionary<string, string>> dicList = outputTarget.status as List<Dictionary<string, string>>; |
| | | List<Dictionary<string, string>> dicList = outputTarget.status; |
| | | //显示状态值 |
| | | string stateStr = ""; |
| | | //显示输出条件各种类型状态 |
| | |
| | | case "1": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.GetDevice(outputTarget.sid); |
| | | var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid); |
| | | //用设备的functionType类型找到对应图标; |
| | | targetView.btnIcon.UnSelectedImagePath = LogicMethod.GetIconPath(device.spk); |
| | | targetView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(device.spk); |
| | | //显示设备名称 |
| | | targetView.btnText.Text = device.name; |
| | | //改变设备名称显示控件宽度 |
| | | targetView.btnText.Width = Application.GetRealWidth(80); |
| | | |
| | | |
| | | //区别不同设备,显示不同设备状态 |
| | | switch (device.spk) |
| | | { |
| | |
| | | { |
| | | stateStr = brightness + "%"; |
| | | } |
| | | |
| | | |
| | | } |
| | | break; |
| | | case SPK.CurtainSwitch: |
| | |
| | | case "2": |
| | | { |
| | | //用sid找到场景; |
| | | var scene = LogicMethod.GetSecne(outputTarget.sid); |
| | | var scene = LogicMethod.CurrLogicMethod.GetSecne(outputTarget.sid); |
| | | targetView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png"; |
| | | targetView.btnNextIcon.Visible = false; |
| | | //显示场景名称 |
| | |
| | | } |
| | | else |
| | | { |
| | | targetView.btnText.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay)+ stateStr; |
| | | targetView.btnText.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr; |
| | | } |
| | | //再次编辑条件状态点击事件 |
| | | targetView.btnClick.MouseUpEventHandler += (sen, e) => |
| | |
| | | case "1": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.GetDevice(outputTarget.sid); |
| | | var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid); |
| | | TargetDeviceFunList deviceFunList = new TargetDeviceFunList(); |
| | | MainPage.BasePageView.AddChidren(deviceFunList); |
| | | deviceFunList.Show(device, indexVulae, edit); |
| | |
| | | targetView.btnText.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr; |
| | | } |
| | | }); |
| | | |
| | | |
| | | }; |
| | | ///删除控件 |
| | | targetView.btnDel.MouseUpEventHandler += (sender, e) => |
| | |
| | | break; |
| | | case "brightness": |
| | | { |
| | | |
| | | if (button2 == null) |
| | | { |
| | | //怕调试软件乱上东西导致抛异常 |
| | | break; |
| | | } |
| | | button2.Text = value + "%"; |
| | | } |
| | | break; |
| | |
| | | break; |
| | | case "set_temp": |
| | | { |
| | | if (button2 == null) |
| | | { |
| | | //怕调试软件乱上东西导致抛异常 |
| | | break; |
| | | } |
| | | button2.Text = value + "℃"; |
| | | } |
| | | break; |
| | | case "mode": |
| | | { |
| | | if (button3 == null) |
| | | { |
| | | //怕调试软件乱上东西导致抛异常 |
| | | break; |
| | | } |
| | | switch (value) |
| | | { |
| | | case "cool": |
| | |
| | | break; |
| | | case "fan": |
| | | { |
| | | if (button4 == null) |
| | | { |
| | | //怕调试软件乱上东西导致抛异常 |
| | | break; |
| | | } |
| | | switch (value) |
| | | { |
| | | case "high": |
| | |
| | | break; |
| | | case "set_temp": |
| | | { |
| | | if (button2 == null) |
| | | { |
| | | //怕调试软件乱上东西导致抛异常 |
| | | break; |
| | | } |
| | | button2.Text = value + "℃"; |
| | | } |
| | | break; |
| | | case "mode": |
| | | { |
| | | if (button3 == null) |
| | | { |
| | | //怕调试软件乱上东西导致抛异常 |
| | | break; |
| | | } |
| | | switch (value) |
| | | { |
| | | case "day": |
| | |
| | | case "3": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.GetDevice(inputCondition.sid); |
| | | var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid); |
| | | name = device.name + "-"; |
| | | } |
| | | break; |
| | |
| | | case "1": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.GetDevice(outputTarget.sid); |
| | | var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid); |
| | | //显示设备名称 |
| | | name += device.name; |
| | | string stateStr = ""; |
| | |
| | | case "2": |
| | | { |
| | | //用sid找到场景; |
| | | var scene = LogicMethod.GetSecne(outputTarget.sid); |
| | | var scene = LogicMethod.CurrLogicMethod.GetSecne(outputTarget.sid); |
| | | name += scene.name; |
| | | |
| | | } |
| | |
| | | /// <param name="fLayout">在哪个界面显示</param> |
| | | /// <param name="edit">(true=编辑;false=新建)</param> |
| | | /// <param name="index">编辑条件的索引</param> |
| | | private void Delayed(FrameLayout thisFLayout, Output output,Action<int>action) |
| | | private void Delayed(FrameLayout thisFLayout, Output output, Action<int> action) |
| | | { |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | |
| | | string second = timePointView.GetmStringList()[index2].Split(' ')[0]; |
| | | int minuetIntValue = int.Parse(minuet); |
| | | int secondIntValue = int.Parse(second); |
| | | timepoint = minuetIntValue*60+secondIntValue; |
| | | timepoint = minuetIntValue * 60 + secondIntValue; |
| | | }; |
| | | //确定点击事件 |
| | | timePointView.btnConfirm.MouseUpEventHandler += (sender, e3) => |
| | | { |
| | | if (timepoint==0) |
| | | if (timepoint == 0) |
| | | { |
| | | //提示 |
| | | return; |
| | |
| | | state = seconds.ToString() + Language.StringByID(StringId.s); |
| | | } |
| | | } |
| | | if (!string.IsNullOrEmpty(state)) { |
| | | state = Language.StringByID(StringId.delayLogic) + state; |
| | | } |
| | | return state; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | public class LogicMethod |
| | | { |
| | | |
| | | private static LogicMethod logicMethod = null; |
| | | |
| | | public static LogicMethod CurrLogicMethod |
| | | { |
| | | get |
| | | { |
| | | if (logicMethod == null) |
| | | { |
| | | return new LogicMethod(); |
| | | } |
| | | return logicMethod; |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 表示是条件 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 移除所有"Logic"界面 |
| | | /// </summary> |
| | | public static void RemoveAllView() |
| | | public void RemoveAllView() |
| | | { |
| | | MainPage.BasePageView.RemoveViewByTag("Logic"); |
| | | } |
| | | |
| | | |
| | | /// <summary> Converts an array of bytes into a formatted string of hex digits (ex: E4 CA B2)</summary> |
| | | /// <param name="data"> The array of bytes to be translated into a string of hex digits. </param> |
| | | /// <returns> Returns a well formatted string of hex digits with spacing. </returns> |
| | | static string byteArrayToHexString(byte[] data) |
| | | public string byteArrayToHexString(byte[] data) |
| | | { |
| | | System.Text.StringBuilder sb = new System.Text.StringBuilder(); |
| | | foreach (byte b in data) |
| | |
| | | * @param i 一个int数字 |
| | | * @return byte[] |
| | | */ |
| | | public static byte[] int2ByteArray(int i) |
| | | public byte[] int2ByteArray(int i) |
| | | { |
| | | byte[] result = new byte[4]; |
| | | result[0] = (byte)((i >> 24) & 0xFF); |
| | |
| | | /// 获取时间戳 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | static int getTimeStamp() |
| | | public int getTimeStamp() |
| | | { |
| | | TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); |
| | | return (int)ts.TotalSeconds; |
| | |
| | | /// <summary> |
| | | /// 生成逻辑sid方法 |
| | | /// </summary> |
| | | public static string NewSid() |
| | | public string NewSid() |
| | | { |
| | | string logicId = ""; |
| | | try |
| | |
| | | /// <param name="dic">Dictionary类</param> |
| | | /// <param name="key">健</param> |
| | | /// <param name="value">值</param> |
| | | public static void dictionary(Dictionary<string, string> dic, string key, string value) |
| | | public void dictionary(Dictionary<string, string> dic, string key, string value) |
| | | { |
| | | if (dic.ContainsKey(key)) //判断是否存在键值 |
| | | { |
| | |
| | | /// 获取网关房间列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<HDL_ON.Entity.Room> GetGatewayRoomList() |
| | | public List<HDL_ON.Entity.Room> GetGatewayRoomList() |
| | | { |
| | | return HDL_ON.Entity.SpatialInfo.CurrentSpatial.RoomList; |
| | | } |
| | |
| | | /// 获取网关房间列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<HDL_ON.Entity.Room> GetGatewayRoomList(string name) |
| | | public List<HDL_ON.Entity.Room> GetGatewayRoomList(string name) |
| | | { |
| | | List<Entity.Room> roomList = new List<Entity.Room>(); |
| | | Entity.Room room1 = new Entity.Room(); |
| | |
| | | /// 获取网关设备列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<HDL_ON.Entity.Function> GetGatewayDeviceList() |
| | | public List<HDL_ON.Entity.Function> GetGatewayDeviceList() |
| | | { |
| | | return Entity.FunctionList.List.GetDeviceFunctionList(); |
| | | } |
| | |
| | | /// 获取网关场景列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<HDL_ON.Entity.Scene> GetSceneList() |
| | | public List<HDL_ON.Entity.Scene> GetSceneList() |
| | | { |
| | | return HDL_ON.Entity.FunctionList.List.scenes; |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="room">当前房间</param> |
| | | /// <returns></returns> |
| | | public static List<HDL_ON.Entity.Function> GetRoomDevice(HDL_ON.Entity.Room room) |
| | | public List<HDL_ON.Entity.Function> GetRoomDevice(HDL_ON.Entity.Room room) |
| | | { |
| | | List<HDL_ON.Entity.Function> deviceLists = new List<Entity.Function>(); |
| | | List<HDL_ON.Entity.Function> lists = GetGatewayDeviceList(); |
| | |
| | | /// </summary> |
| | | /// <param name="sid">设备唯一标识</param> |
| | | /// <returns></returns> |
| | | public static HDL_ON.Entity.Function GetDevice(string sid) |
| | | public HDL_ON.Entity.Function GetDevice(string sid) |
| | | { |
| | | HDL_ON.Entity.Function device = new Entity.Function() { name = "Unknown" }; |
| | | List<HDL_ON.Entity.Function> deviceLists = GetGatewayDeviceList(); |
| | |
| | | /// </summary> |
| | | /// <param name="sid">场景唯一标识</param> |
| | | /// <returns></returns> |
| | | public static HDL_ON.Entity.Scene GetSecne(string sid) |
| | | public HDL_ON.Entity.Scene GetSecne(string sid) |
| | | { |
| | | HDL_ON.Entity.Scene scene = new Entity.Scene() { name = "Unknown" }; |
| | | List<HDL_ON.Entity.Scene> sceneLists = GetSceneList(); |
| | |
| | | /// </summary> |
| | | /// <param name="device">设备</param> |
| | | /// <returns></returns> |
| | | public static string GetGetRoomName(HDL_ON.Entity.Function device) |
| | | public string GetGetRoomName(HDL_ON.Entity.Function device) |
| | | { |
| | | string roomName = ""; |
| | | List<HDL_ON.Entity.Room> roomLists = GetGatewayRoomList(); |
| | |
| | | /// </summary> |
| | | /// <param name="functionType">设备类型</param> |
| | | /// <returns></returns> |
| | | public static string GetIconPath(string functionType) |
| | | public string GetIconPath(string functionType) |
| | | { |
| | | string strPath = ""; |
| | | switch (functionType) |
| | |
| | | case SPK.SensorDoorWindow: |
| | | case SPK.SensoruUtrasonic: |
| | | case SPK.SenesorMegahealth: |
| | | case SPK.SenesorEnvironment: |
| | | { |
| | | strPath = "LogicIcon/sensor.png"; |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="deviceList">设备列表</param> |
| | | /// <returns></returns> |
| | | public static List<string> GetDeviceTypeList(List<HDL_ON.Entity.Function> deviceList) |
| | | public List<string> GetDeviceTypeList(List<HDL_ON.Entity.Function> deviceList) |
| | | { |
| | | List<string> deviceStrTypeList = new List<string>(); |
| | | deviceStrTypeList.Clear(); |
| | |
| | | || device.spk == SPK.SensorDoorWindow |
| | | || device.spk == SPK.SensoruUtrasonic |
| | | || device.spk == SPK.SenesorMegahealth |
| | | || device.spk == SPK.SenesorEnvironment |
| | | ); |
| | | if (sensor != null) |
| | | { |
| | |
| | | /// </summary> |
| | | /// <param name="deviceType">设备类型(灯光类,窗帘类。)</param> |
| | | /// <returns></returns> |
| | | public static List<string> GetDeviceTypeFunctionList(string deviceType) |
| | | public List<string> GetDeviceTypeFunctionList(string deviceType) |
| | | { |
| | | List<string> functionTypeList = new List<string>(); |
| | | if (deviceType == Language.StringByID(StringId.Lights)) |
| | |
| | | functionTypeList.Add(SPK.SensorDoorWindow); |
| | | functionTypeList.Add(SPK.SensoruUtrasonic); |
| | | functionTypeList.Add(SPK.SenesorMegahealth); |
| | | functionTypeList.Add(SPK.SenesorEnvironment); |
| | | |
| | | |
| | | } |
| | | return functionTypeList; |
| | |
| | | /// 条件/目标支持设备 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<string> GetSupportEquipment(string if_type) |
| | | public List<string> GetSupportEquipment(string if_type) |
| | | { |
| | | List<string> deviceTypeList = new List<string>(); |
| | | switch (if_type) |
| | |
| | | deviceTypeList.Add(SPK.SensorDoorWindow); |
| | | deviceTypeList.Add(SPK.SensoruUtrasonic); |
| | | deviceTypeList.Add(SPK.SenesorMegahealth); |
| | | deviceTypeList.Add(SPK.SenesorEnvironment); |
| | | |
| | | } |
| | | break; |
| | | case target_if: |
| | |
| | | /// <param name="functionType">源数据列表1</param> |
| | | /// <param name="deviceList">源数据列表2</param> |
| | | /// <returns></returns> |
| | | public static List<Entity.Function> GetShowDeviceList(List<string> functionType, List<HDL_ON.Entity.Function> deviceList) |
| | | public List<Entity.Function> GetShowDeviceList(List<string> functionType, List<HDL_ON.Entity.Function> deviceList) |
| | | { |
| | | List<HDL_ON.Entity.Function> devList = new List<Entity.Function>(); |
| | | for (int i = 0; i < deviceList.Count; i++) |
| | |
| | | /// <param name="room">当前房间</param> |
| | | /// <param name="str">判断符(表示=输入设备和输出设备)</param> |
| | | /// <returns></returns> |
| | | public static List<Entity.Function> GetFunctionDeviceList(Entity.Room room, string str) |
| | | public List<Entity.Function> GetFunctionDeviceList(Entity.Room room, string str) |
| | | { |
| | | List<string> functionTypeList = GetSupportEquipment(str); |
| | | //返回房间设备列表 |
| | |
| | | /// <summary> |
| | | /// 网关ID(获取嘉乐网关ID) |
| | | /// </summary> |
| | | public static string GatewayId |
| | | public string GatewayId |
| | | { |
| | | get |
| | | { |
| | |
| | | /// <summary> |
| | | /// 住宅ID |
| | | /// </summary> |
| | | public static string HomeId |
| | | public string HomeId |
| | | { |
| | | get |
| | | { |
| | |
| | | /// <summary> |
| | | /// 是否为其他主用户分享过来的住宅 |
| | | /// </summary> |
| | | public static bool IsOthreShare |
| | | public bool IsOthreShare |
| | | { |
| | | get |
| | | { |
| | | return Entity.DB_ResidenceData.Instance.CurrentRegion.isOtherShare; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | frameLayout.AddChidren(btnClick); |
| | | return frameLayout; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | ) => |
| | | { |
| | | Logic.currlogic.name = logicName; |
| | | Logic.currlogic.sid = LogicMethod.NewSid(); |
| | | Logic.currlogic.sid = LogicMethod.CurrLogicMethod.NewSid(); |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | } |
| | | |
| | | Logic.LogicList.Add(Logic.currlogic); |
| | | LogicMethod.RemoveAllView(); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | MainView.MainShow(); |
| | | } |
| | | else if (responsePackNew != null && responsePackNew.Code == "14005") |
| | |
| | | loading.Hide(); |
| | | if (responsePackNew != null && responsePackNew.Code == "0") |
| | | { |
| | | LogicMethod.RemoveAllView(); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | MainView.MainShow(); |
| | | } |
| | | else if (responsePackNew != null && responsePackNew.Code == "14005") |
| | |
| | | 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) |
| | | var pmListStr = pmView.GetViewList("pm25"); |
| | | pmView.SingleSelectionShow(frame, pmListStr, Language.StringByID(StringId.PM25), pmView.GetString("pm25", 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"; |
| | | } |
| | | var value= pmView.GetValue("pm25", text); |
| | | AddDic("pm2.5", "=", value); |
| | | }); |
| | | } |
| | |
| | | private void AddDic(string keyValue, string comparator, string value) |
| | | { |
| | | Input input = new Input(); |
| | | input.sid = LogicMethod.NewSid(); |
| | | input.sid = LogicMethod.CurrLogicMethod.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); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", keyValue); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", comparator); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "float"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", value); |
| | | input.condition.Add(dic); |
| | | AddCondition(input, keyValue, comparator); |
| | | } |
| | |
| | | Logic.currlogic.input.Add(input); |
| | | } |
| | | |
| | | LogicMethod.RemoveAllView(); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 数值返回文本 |
| | | /// </summary> |
| | | /// <param name="strValue">值</param> |
| | | /// <returns></returns> |
| | | 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; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | /// <param name="textSize">显示文本字体大小</param> |
| | | public void SingleSelectionShow(FrameLayout frame, List<string> list, string titleText, string stateText, Action<string> action, int textSize = LogicView.TextSize.text14) |
| | | { |
| | | if (list == null) |
| | | { |
| | | return; |
| | | } |
| | | FrameLayout frameLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 多选择 |
| | | /// </summary> |
| | |
| | | /// <param name="list">显示数据源</param> |
| | | /// <param name="titleText">标题</param> |
| | | /// <param name="action">返回值索引值</param> |
| | | public void FrameOrVv(FrameLayout frame, List<string>list, int titleText,Action<int> action) { |
| | | public void FrameOrVv(FrameLayout frame, List<string> list, int titleText, Action<int> action) |
| | | { |
| | | |
| | | int line = 0; |
| | | if (list.Count == 0 || list.Count > 5) |
| | |
| | | /// <param name="stateList">之前状态数据源</param> |
| | | /// <param name="titleText">标题</param> |
| | | /// <param name="action">返回值索引值</param> |
| | | public void FrameOrVvList(FrameLayout frame, List<string> list,List<string>stateList, int titleText, Action<List<string>> action) |
| | | public void FrameOrVvList(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<List<string>> action) |
| | | { |
| | | |
| | | int line = 0; |
| | |
| | | { |
| | | verticalRefresh.AddChidren(checkView.FLayoutView()); |
| | | } |
| | | if (stateList.Contains(strName)) { |
| | | if (stateList.Contains(strName)) |
| | | { |
| | | checkView.btnClick.IsSelected = true; |
| | | checkView.btnCheckIcon.IsSelected = true; |
| | | selecetdList.Add(strName); |
| | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 温湿度组合界面 |
| | | /// </summary> |
| | | /// <param name="frameLayout">父控件</param> |
| | | /// <param name="text1">标题文本1</param> |
| | | /// <param name="text2">标题文本2</param> |
| | | /// <param name="action">回调函数</param> |
| | | public void ViewZuHe(FrameLayout frameLayout, int text1, int text2, Action<int, FrameLayout> action) |
| | | { |
| | | |
| | | FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewMiddle }; |
| | | frameLayout.AddChidren(frame); |
| | | LogicView.TopView topView = new LogicView.TopView(); |
| | | topView.topNameBtn.TextID = StringId.wendu; |
| | | frame.AddChidren(topView.FLayoutView()); |
| | | topView.clickBackBtn.MouseUpEventHandler += (e, sen) => |
| | | { |
| | | frame.RemoveFromParent(); |
| | | }; |
| | | FrameLayout viewLayout = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Width = Application.GetRealWidth(LogicView.TextSize.view375), |
| | | Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64), |
| | | BackgroundColor = CSS.CSS_Color.viewMiddle, |
| | | }; |
| | | frame.AddChidren(viewLayout); |
| | | |
| | | //温,湿度高于 |
| | | LogicView.SelectTypeView temperaturehigherView = new LogicView.SelectTypeView(); |
| | | temperaturehigherView.btnIcon.Visible = false; |
| | | temperaturehigherView.btnText.X = Application.GetRealWidth(16); |
| | | temperaturehigherView.btnLine.X = Application.GetRealWidth(16); |
| | | temperaturehigherView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16); |
| | | temperaturehigherView.btnText.TextID = text1; |
| | | viewLayout.AddChidren(temperaturehigherView.FLayoutView()); |
| | | //温,湿度低于 |
| | | LogicView.SelectTypeView temperatureunderView = new LogicView.SelectTypeView(); |
| | | temperatureunderView.frameLayout.Y = temperaturehigherView.frameLayout.Bottom; |
| | | temperatureunderView.btnIcon.Visible = false; |
| | | temperatureunderView.btnText.X = Application.GetRealWidth(16); |
| | | temperatureunderView.btnLine.X = Application.GetRealWidth(16); |
| | | temperatureunderView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16); |
| | | temperatureunderView.btnText.TextID = text2; |
| | | viewLayout.AddChidren(temperatureunderView.FLayoutView()); |
| | | |
| | | //温,湿度高于 |
| | | temperaturehigherView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | action(text1, frame); |
| | | }; |
| | | //温,湿度低于 |
| | | temperatureunderView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | action(text2, frame); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取界面列表 |
| | |
| | | }; |
| | | } |
| | | break; |
| | | case "pm2.5": |
| | | case "pm25": |
| | | { |
| | | list = new List<string> { |
| | | Language.StringByID(StringId.pmyou), |
| | |
| | | Language.StringByID(StringId.pmqingdu), |
| | | Language.StringByID(StringId.pmzhongdu), |
| | | Language.StringByID(StringId.pmzhongduwuran), |
| | | }; |
| | | } |
| | | break; |
| | | case "co2": |
| | | { |
| | | list = new List<string> { |
| | | Language.StringByID(StringId.zhengchang), |
| | | Language.StringByID(StringId.piangao), |
| | | Language.StringByID(StringId.chaobiao), |
| | | }; |
| | | } |
| | | break; |
| | | case "tvoc": |
| | | { |
| | | list = new List<string> { |
| | | Language.StringByID(StringId.zhengchang), |
| | | Language.StringByID(StringId.chaobiao), |
| | | Language.StringByID(StringId.yanzhong), |
| | | }; |
| | | } |
| | | break; |
| | |
| | | |
| | | return stateList; |
| | | } |
| | | /// <summary> |
| | | /// 数值返回文本 |
| | | /// </summary> |
| | | /// <param name="type">类型</param> |
| | | /// <param name="strValue">值</param> |
| | | /// <returns></returns> |
| | | public string GetString(string type, string strValue) |
| | | { |
| | | string text = ""; |
| | | int intValue = 0; |
| | | if (strValue != "") |
| | | { |
| | | intValue = int.Parse(strValue); |
| | | } |
| | | |
| | | switch (type) |
| | | { |
| | | case "pm25": |
| | | { |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | break; |
| | | case "co2": |
| | | { |
| | | |
| | | if (intValue > 0 && intValue < 800) |
| | | { |
| | | text = Language.StringByID(StringId.zhengchang); |
| | | } |
| | | else if (intValue > 800 && intValue < 1100) |
| | | { |
| | | text = Language.StringByID(StringId.piangao); |
| | | } |
| | | else if (intValue > 1100) |
| | | { |
| | | text = Language.StringByID(StringId.chaobiao); |
| | | } |
| | | } |
| | | break; |
| | | case "tvoc": |
| | | { |
| | | |
| | | if (intValue >=1 && intValue <= 3) |
| | | { |
| | | text = Language.StringByID(StringId.zhengchang); |
| | | } |
| | | else if (intValue >=4 && intValue<=6) |
| | | { |
| | | text = Language.StringByID(StringId.chaobiao); |
| | | } |
| | | else if (intValue >= 7 && intValue <= 9) |
| | | { |
| | | text = Language.StringByID(StringId.yanzhong); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | return text; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 本文返回数值返回 |
| | | /// </summary> |
| | | /// <param name="type">类型</param> |
| | | /// <param name="text">文本</param> |
| | | /// <returns></returns> |
| | | public string GetValue(string type, string text) |
| | | { |
| | | string value = ""; |
| | | switch (type) |
| | | { |
| | | case "pm25": |
| | | { |
| | | 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"; |
| | | } |
| | | } |
| | | break; |
| | | case "co2": |
| | | { |
| | | if (text == Language.StringByID(StringId.zhengchang)) |
| | | { |
| | | value = "400"; |
| | | } |
| | | else if (text == Language.StringByID(StringId.piangao)) |
| | | { |
| | | value = "850"; |
| | | } |
| | | else if (text == Language.StringByID(StringId.chaobiao)) |
| | | { |
| | | value = "1200"; |
| | | } |
| | | } |
| | | break; |
| | | case "tvoc": |
| | | { |
| | | if (text == Language.StringByID(StringId.zhengchang)) |
| | | { |
| | | value = "2"; |
| | | } |
| | | else if (text == Language.StringByID(StringId.chaobiao)) |
| | | { |
| | | value = "5"; |
| | | } |
| | | else if (text == Language.StringByID(StringId.yanzhong)) |
| | | { |
| | | value = "8"; |
| | | } |
| | | } |
| | | break; |
| | | |
| | | } |
| | | return value; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public static ResponsePackNew GetLogicIdList() |
| | | { |
| | | var jObject = new JObject { { "homeId", LogicMethod.HomeId } }; |
| | | var jObject = new JObject { { "homeId", LogicMethod.CurrLogicMethod.HomeId } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_List); |
| | | //如果是token过期则刷新token |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) |
| | |
| | | var logicjArray = new JArray { }; |
| | | var logicIfon = new JObject { }; |
| | | logicIfon.Add("sid", logic.sid); |
| | | logicIfon.Add("gatewayId", LogicMethod.GatewayId); |
| | | logicIfon.Add("gatewayId", LogicMethod.CurrLogicMethod.GatewayId); |
| | | logicIfon.Add("name", logic.name); |
| | | logicIfon.Add("relation", logic.relation); |
| | | logicIfon.Add("enable", logic.enable); |
| | |
| | | logicIfon.Add("noticeConfig", noticeConfigJObject); |
| | | logicIfon.Add("pushConfigs", pushConfigsArray); |
| | | logicjArray.Add(logicIfon); |
| | | var jObject = new JObject { { "homeId", LogicMethod.HomeId }, { "logics", logicjArray } }; |
| | | var jObject = new JObject { { "homeId", LogicMethod.CurrLogicMethod.HomeId }, { "logics", logicjArray } }; |
| | | responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Add,5); |
| | | //如果是token过期则刷新token |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) |
| | |
| | | var logicIfon = new JObject { }; |
| | | logicIfon.Add("userLogicId", logic.userLogicId); |
| | | logicIfon.Add("sid", logic.sid); |
| | | logicIfon.Add("gatewayId", LogicMethod.GatewayId); |
| | | logicIfon.Add("gatewayId", LogicMethod.CurrLogicMethod.GatewayId); |
| | | logicIfon.Add("name", logic.name); |
| | | logicIfon.Add("relation", logic.relation); |
| | | logicIfon.Add("enable", logic.enable); |
| | |
| | | logicIfon.Add("pushConfigs", pushConfigsArray); |
| | | |
| | | logicjArray.Add(logicIfon); |
| | | var jObject = new JObject { { "homeId", LogicMethod.HomeId }, { "logics", logicjArray } }; |
| | | var jObject = new JObject { { "homeId", LogicMethod.CurrLogicMethod.HomeId }, { "logics", logicjArray } }; |
| | | responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Update,5); |
| | | //如果是token过期则刷新token |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) |
| | |
| | | loading.Hide(); |
| | | if (responsePackNew != null && responsePackNew.Code == "0") |
| | | { |
| | | LogicMethod.RemoveAllView(); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | Logic.LogicList.Remove(Logic.currlogic); |
| | | MainView.MainShow(); |
| | | //发送删除逻辑命令; |
| | |
| | | |
| | | if (edit) |
| | | { |
| | | //更新延时时间 |
| | | outputDevice.delay = Logic.currlogic.output[index].delay; |
| | | //移除旧数据 |
| | | Logic.currlogic.output.RemoveAt(index); |
| | | //新数据插入旧数据的位置; |
| | |
| | | this.RemoveFromParent(); |
| | | return; |
| | | } |
| | | LogicMethod.RemoveAllView(); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | |
| | | private void GetEditState(Entity.Function device, int index, Button button1, Button button2, Button button3, Button button4) |
| | | { |
| | | Output outputs = Logic.currlogic.output[index]; |
| | | var dicList = outputs.status as List<Dictionary<string, string>>; |
| | | var dicList = outputs.status; |
| | | //清除之前旧数据 |
| | | dicSateteList.Clear(); |
| | | if (dicList.Count != 0) |
| | |
| | | { |
| | | //数据封装 |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", KeyValue); |
| | | LogicMethod.dictionary(dic, "value", selectedValue); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", KeyValue); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", selectedValue); |
| | | AddDictionaryList(KeyValue, dic); |
| | | } |
| | | /// <summary> |
| | |
| | | private void AddDic(string keyValue, string value, bool edit, int index) |
| | | { |
| | | Input inputTime = new Input(); |
| | | inputTime.sid = LogicMethod.NewSid(); |
| | | inputTime.sid = LogicMethod.CurrLogicMethod.NewSid(); |
| | | inputTime.condition_type = "1"; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", keyValue); |
| | | LogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.dictionary(dic, "value", value); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", keyValue); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", value); |
| | | inputTime.condition.Add(dic); |
| | | AddCondition(inputTime, edit, index); |
| | | } |
| | |
| | | //添加一个新的时间条件 |
| | | Logic.currlogic.input.Add(input); |
| | | } |
| | | LogicMethod.RemoveAllView(); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | |
| | | timePointView.FLayoutView(fLayout); |
| | | timePointView.TimePoint(fLayout, editTime, (timeValue)=>{ |
| | | Input inputTime = new Input(); |
| | | inputTime.sid = LogicMethod.NewSid(); |
| | | inputTime.sid = LogicMethod.CurrLogicMethod.NewSid(); |
| | | inputTime.condition_type = "1"; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", "timepoint"); |
| | | LogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.dictionary(dic, "value", timeValue); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", "timepoint"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", timeValue); |
| | | inputTime.condition.Add(dic); |
| | | AddCondition(inputTime, edit, index); |
| | | }); |
| | |
| | | } |
| | | |
| | | Input inputTime = new Input(); |
| | | inputTime.sid = LogicMethod.NewSid(); |
| | | inputTime.sid = LogicMethod.CurrLogicMethod.NewSid(); |
| | | inputTime.condition_type = "2"; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", "timesection"); |
| | | LogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.dictionary(dic, "value", btnStartTimeText.Text + "-" + btnEndTimeText.Text); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", "timesection"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", btnStartTimeText.Text + "-" + btnEndTimeText.Text); |
| | | inputTime.condition.Add(dic); |
| | | AddCondition(inputTime, edit, index); |
| | | |
| | |
| | | //添加一个新的时间条件 |
| | | Logic.currlogic.input.Add(input); |
| | | } |
| | | LogicMethod.RemoveAllView(); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | |
| | | private void AddDic(string value) |
| | | { |
| | | Input input = new Input(); |
| | | input.sid = LogicMethod.NewSid(); |
| | | input.sid = LogicMethod.CurrLogicMethod.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); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", "weather"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", value); |
| | | input.condition.Add(dic); |
| | | AddCondition(input); |
| | | } |
| | |
| | | Logic.currlogic.input.Add(input); |
| | | } |
| | | |
| | | LogicMethod.RemoveAllView(); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | |
| | | quyuPatchView.frameLayout.Y = namePatchView.frameLayout.Bottom; |
| | | this.AddChidren(quyuPatchView.FLayoutView()); |
| | | quyuPatchView.btnText1.TextID = StringId.suoshuquyu; |
| | | quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(GetFunction(control.deviceId)); |
| | | quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.CurrLogicMethod.GetGetRoomName(GetFunction(control.deviceId)); |
| | | |
| | | //继续添加 |
| | | Button addBtn = new Button |
| | |
| | | method.ManagementPosition(GetFunction(control.deviceId), () => |
| | | { |
| | | //更新区域 |
| | | quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(GetFunction(control.deviceId)); |
| | | quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.CurrLogicMethod.GetGetRoomName(GetFunction(control.deviceId)); |
| | | }); |
| | | }; |
| | | //继续添加点击事件 |
| | |
| | | //遥控器所属区域: |
| | | FrameLayout50 areaFLayout = new FrameLayout50(); |
| | | areaFLayout.btnText.Text = Language.StringByID(StringId.yaokongqiquyu); |
| | | areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control); |
| | | areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.CurrLogicMethod.GetGetRoomName(control); |
| | | areaFLayout.frameLayout.Y = editNameFLayout.frameLayout.Bottom; |
| | | viewLayout.AddChidren(areaFLayout.FLayoutView()); |
| | | #endregion |
| | |
| | | method.ManagementPosition(control, () => |
| | | { |
| | | //更新区域 |
| | | areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control); |
| | | areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.CurrLogicMethod.GetGetRoomName(control); |
| | | }); |
| | | }; |
| | | #endregion |
| | |
| | | //遥控器名称 |
| | | controlView.nameBtn.Text = control.name; |
| | | //遥控器存放区域 |
| | | controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control); |
| | | controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.CurrLogicMethod.GetGetRoomName(control); |
| | | //标记遥控器 |
| | | controlView.delBtn.Tag = control; |
| | | //删除点击事件 |
| | |
| | | { |
| | | //回调更新名字/区域 |
| | | controlView.nameBtn.Text = device.name; |
| | | controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(device); |
| | | controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.CurrLogicMethod.GetGetRoomName(device); |
| | | |
| | | }); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |