| | |
| | | /// 公共域名就近解析 |
| | | /// |
| | | /// </summary> |
| | | public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm |
| | | //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm |
| | | /// <summary> |
| | | /// RegionMark |
| | | /// </summary> |
| | |
| | | } |
| | | } |
| | | break; |
| | | //水浸传感器 |
| | | case SPK.SensorWater: |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | |
| | | |
| | | } |
| | | break; |
| | | //烟雾传感器 |
| | | case SPK.SensorSmoke: |
| | | //燃气传感器 |
| | | case SPK.SensorGas: |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | |
| | | |
| | | } |
| | | break; |
| | | //干接点 |
| | | case SPK.SensorDryContact: |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | |
| | | |
| | | } |
| | | break; |
| | | //红外珊栏传感器 |
| | | case SPK.SensorShanLan: |
| | | //红外对射传感器 |
| | | case SPK.SensorDuiShe: |
| | | //红外移动传感器 |
| | | case SPK.SensorPir: |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | |
| | | } |
| | | } |
| | | break; |
| | | //门窗传感器 |
| | | case SPK.SensorDoorWindow: |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | |
| | | } |
| | | } |
| | | break; |
| | | //超声波传感器 |
| | | case SPK.SensoruUtrasonic: |
| | | { |
| | | |
| | |
| | | } |
| | | } |
| | | break; |
| | | //毫米波传感器 |
| | | case SPK.SenesorMegahealth: |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | |
| | | //显示文本 |
| | | button.TextID = intValue; |
| | | selectedState = device.spk + "_" + value; |
| | | AddDictionary(keyVlaue, value); |
| | | AddDictionary(keyVlaue, value, "string"); |
| | | |
| | | }); |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="KeyValue">设备属性值,云雀上定义好的</param> |
| | | /// <param name="selectedValue">状态值</param> |
| | | private void AddDictionary(string KeyValue, string selectedValue) |
| | | /// <param name="data_type">类型</param> |
| | | /// <param name="comparator">比较关系</param> |
| | | 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", "="); |
| | | LogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.dictionary(dic, "comparator", comparator); |
| | | LogicMethod.dictionary(dic, "data_type", data_type); |
| | | LogicMethod.dictionary(dic, "value", selectedValue); |
| | | AddDictionaryList(KeyValue, dic); |
| | | AddDictionaryList(KeyValue, comparator,dic); |
| | | } |
| | | /// <summary> |
| | | /// 更新数据列表 |
| | | /// </summary> |
| | | /// <param name="keyValue">设备属性值,云雀上定义好的</param> |
| | | /// <param name="keyValue">设备属性值,云雀上定义好的</param> |
| | | /// <param name="comparator">比较关系</param> |
| | | /// <param name="dictionary">添加选中数据</param> |
| | | /// <returns></returns> |
| | | private void AddDictionaryList(string keyValue, Dictionary<string, string> dictionary) |
| | | private void AddDictionaryList(string keyValue,string comparator, Dictionary<string, string> dictionary) |
| | | { |
| | | int indexValue = -1; |
| | | for (int i = 0; i < dicSateteList.Count; i++) |
| | | { |
| | | var dic = dicSateteList[i]; |
| | | if (dic.ContainsValue(keyValue)) |
| | | string key = dic["key"]; |
| | | string comparatorValue = dic["comparator"]; |
| | | if (key == keyValue && comparatorValue == comparator) |
| | | { |
| | | //判断是否存在 |
| | | indexValue = i; |
| | |
| | | targetView.btnClick.Tag = outputTarget.sid; |
| | | ///条件状态数组 |
| | | List<Dictionary<string, string>> dicList = outputTarget.status as List<Dictionary<string, string>>; |
| | | //显示状态值 |
| | | string stateStr = ""; |
| | | //显示输出条件各种类型状态 |
| | | switch (outputTarget.target_type) |
| | | { |
| | |
| | | targetView.btnText.Text = device.name; |
| | | //改变设备名称显示控件宽度 |
| | | targetView.btnText.Width = Application.GetRealWidth(80); |
| | | //第一个变量显示状态值 |
| | | string stateStr = ""; |
| | | |
| | | //区别不同设备,显示不同设备状态 |
| | | switch (device.spk) |
| | | { |
| | |
| | | stateStr = Language.StringByID(StringId.offLogic); |
| | | } |
| | | } |
| | | targetView.btnState.Text = stateStr; |
| | | } |
| | | break; |
| | | case SPK.LightRGB: |
| | |
| | | { |
| | | stateStr = brightness + "%"; |
| | | } |
| | | targetView.btnState.Text = stateStr; |
| | | |
| | | } |
| | | break; |
| | | case SPK.CurtainSwitch: |
| | |
| | | break; |
| | | } |
| | | } |
| | | targetView.btnState.Text = stateStr; |
| | | } |
| | | break; |
| | | case SPK.AcStandard: |
| | |
| | | } |
| | | if (on_off != "" && on_off == "off") |
| | | { |
| | | targetView.btnState.Text = Language.StringByID(StringId.offLogic); |
| | | stateStr = Language.StringByID(StringId.offLogic); |
| | | } |
| | | else |
| | | { |
| | | targetView.btnState.Text = stateStr.TrimEnd(','); |
| | | stateStr = stateStr.TrimEnd(','); |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | if (on_off != "" && on_off == "off") |
| | | { |
| | | targetView.btnState.Text = Language.StringByID(StringId.offLogic); |
| | | stateStr = Language.StringByID(StringId.offLogic); |
| | | } |
| | | else |
| | | { |
| | | targetView.btnState.Text = stateStr.TrimEnd(','); |
| | | stateStr = stateStr.TrimEnd(','); |
| | | |
| | | } |
| | | } |
| | |
| | | targetView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png"; |
| | | targetView.btnNextIcon.Visible = false; |
| | | //显示场景名称 |
| | | targetView.btnText.Text = scene.name; |
| | | stateStr = scene.name; |
| | | } |
| | | break; |
| | | case "3": |
| | |
| | | foreach (var dic in dicList) |
| | | { |
| | | string value = dic["value"]; |
| | | targetView.btnText.Text = value; |
| | | stateStr = value; |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | if (outputTarget.target_type == "1") |
| | | { |
| | | targetView.btnState.Text =new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr; |
| | | } |
| | | else |
| | | { |
| | | targetView.btnText.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay)+ stateStr; |
| | | } |
| | | //再次编辑条件状态点击事件 |
| | | targetView.btnClick.MouseUpEventHandler += (sen, e) => |
| | |
| | | } |
| | | break; |
| | | } |
| | | }; |
| | | //延时点击事件 |
| | | targetView.btnDelay.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | |
| | | InpOrOutLogicMethod inpOrOutLogicMethod = new InpOrOutLogicMethod(); |
| | | inpOrOutLogicMethod.Delayed(thisView, outputTarget, (value) => |
| | | { |
| | | outputTarget.delay = value.ToString(); |
| | | if (outputTarget.target_type == "1") |
| | | { |
| | | targetView.btnState.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr; |
| | | } |
| | | else |
| | | { |
| | | targetView.btnText.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr; |
| | | } |
| | | }); |
| | | |
| | | }; |
| | | ///删除控件 |
| | | targetView.btnDel.MouseUpEventHandler += (sender, e) => |
| | |
| | | catch { } |
| | | return name; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 延时时间方法 |
| | | /// </summary> |
| | | /// <param name="fLayout">在哪个界面显示</param> |
| | | /// <param name="edit">(true=编辑;false=新建)</param> |
| | | /// <param name="index">编辑条件的索引</param> |
| | | private void Delayed(FrameLayout thisFLayout, Output output,Action<int>action) |
| | | { |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | thisFLayout.AddChidren(fLayout); |
| | | LogicView.TimeView timePointView = new LogicView.TimeView(); |
| | | timePointView.FLayoutView(fLayout); |
| | | EventHandler<MouseEventArgs> RemovefLayout = (sender, e1) => |
| | | { |
| | | //移除fLayout界面 |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | //取消点击事件 |
| | | timePointView.btnCancel.MouseUpEventHandler += RemovefLayout; |
| | | |
| | | //加载数据界面的设置方法(列表互不联动) |
| | | timePointView.mUIPickerView.setNPicker(timePointView.GetmStringList(), timePointView.GetsStringList(), null); |
| | | //默认初始选中状态 |
| | | timePointView.mUIPickerView.setCurrentItems(0, 5, 0); |
| | | //定义一个局部变量记录选中时间 |
| | | int timepoint = 5; |
| | | |
| | | if (output.delay != "0") |
| | | { |
| | | int intValue = int.Parse(output.delay); |
| | | var m = intValue / 60; |
| | | var s = intValue % 60; |
| | | |
| | | string timeValue = m.ToString() + ":" + s.ToString(); |
| | | int mIndex = timePointView.GetValueIndex(timeValue, 0, 1, timePointView.GetmIntList()); |
| | | int sIndex = timePointView.GetValueIndex(timeValue, 1, 0, timePointView.GetmIntList()); |
| | | //更新初始状态 |
| | | timePointView.mUIPickerView.setCurrentItems(mIndex, sIndex, 0); |
| | | timepoint = intValue; |
| | | } |
| | | |
| | | |
| | | //选中时间回调方法,时间变化一次回调一次 |
| | | timePointView.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) => |
| | | { |
| | | string minuet = timePointView.GethStringList0()[index1].Split(' ')[0]; |
| | | string second = timePointView.GetmStringList()[index2].Split(' ')[0]; |
| | | int minuetIntValue = int.Parse(minuet); |
| | | int secondIntValue = int.Parse(second); |
| | | timepoint = minuetIntValue*60+secondIntValue; |
| | | }; |
| | | //确定点击事件 |
| | | timePointView.btnConfirm.MouseUpEventHandler += (sender, e3) => |
| | | { |
| | | if (timepoint==0) |
| | | { |
| | | //提示 |
| | | return; |
| | | } |
| | | fLayout.RemoveFromParent(); |
| | | action(timepoint); |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 获取时间文本描述 |
| | | /// </summary> |
| | | /// <param name="strTimeValue">时间值(单位s秒)</param> |
| | | /// <returns></returns> |
| | | private string GetTimeText(string strTimeValue) |
| | | { |
| | | var timeValue = int.Parse(strTimeValue); |
| | | string state = ""; |
| | | var minutes = timeValue / 60; |
| | | var seconds = timeValue % 60; |
| | | if (minutes != 0) |
| | | { |
| | | if (seconds == 0) |
| | | { |
| | | state = minutes.ToString() + Language.StringByID(StringId.minute); |
| | | } |
| | | else |
| | | { |
| | | state = minutes.ToString() + Language.StringByID(StringId.minute) + seconds.ToString() + Language.StringByID(StringId.s); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (seconds != 0) |
| | | { |
| | | state = seconds.ToString() + Language.StringByID(StringId.s); |
| | | } |
| | | } |
| | | return state; |
| | | } |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | public string sid = ""; |
| | | /// <summary> |
| | | /// 逻辑输出目标延时间(单位用秒) |
| | | /// </summary> |
| | | public string delay = "0"; |
| | | /// <summary> |
| | | /// 逻辑输出目标类型 |
| | | /// 设备=1; |
| | | /// 场景=2; |
| | |
| | | /// <summary> |
| | | /// 主控件View |
| | | /// </summary> |
| | | public FrameLayout frameLayout= new FrameLayout |
| | | public FrameLayout frameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(343), |
| | | BackgroundColor= CSS.CSS_Color.view, |
| | | BackgroundColor = CSS.CSS_Color.view, |
| | | X = Application.GetRealWidth(LogicView.TextSize.left16), |
| | | }; |
| | | |
| | |
| | | Height = Application.GetRealHeight(43), |
| | | Width = Application.GetRealWidth(343), |
| | | LineColor = CSS.CSS_Color.viewTranslucence, |
| | | SubViewWidth=Application.GetRealWidth(68), |
| | | SubViewWidth = Application.GetRealWidth(68), |
| | | }; |
| | | /// <summary> |
| | | /// (条件或者目标)图标 |
| | | /// </summary> |
| | | public Button btnIcon= new Button |
| | | public Button btnIcon = new Button |
| | | { |
| | | Width= Application.GetRealWidth(28), |
| | | Height =Application.GetRealWidth(28), |
| | | Width = Application.GetRealWidth(28), |
| | | Height = Application.GetRealWidth(28), |
| | | //Y = Application.GetRealHeight(8), |
| | | X = Application.GetRealWidth(TextSize.left12), |
| | | |
| | | |
| | | }; |
| | | /// <summary> |
| | | /// (条件或者目标)文本描述 |
| | | /// </summary> |
| | | public Button btnText= new Button |
| | | public Button btnText = new Button |
| | | { |
| | | TextSize = TextSize.text14, |
| | | Width = Application.GetRealWidth(250), |
| | | Height = Application.GetRealHeight(20), |
| | | TextColor= CSS.CSS_Color.textColor, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | //Y=Application.GetRealHeight(12), |
| | | X = Application.GetRealWidth(52), |
| | | }; |
| | |
| | | Width = Application.GetRealWidth(130), |
| | | Height = Application.GetRealHeight(17), |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | Y=Application.GetRealHeight(14), |
| | | Y = Application.GetRealHeight(14), |
| | | X = Application.GetRealWidth(165), |
| | | TextAlignment=TextAlignment.CenterRight, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | }; |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public Button btnLine = new Button |
| | | { |
| | | Width=Application.GetRealWidth(279), |
| | | Y = Application.GetRealHeight(44-1), |
| | | Width = Application.GetRealWidth(279), |
| | | Y = Application.GetRealHeight(44 - 1), |
| | | X = Application.GetRealWidth(52), |
| | | Height = 1, |
| | | BackgroundColor = CSS.CSS_Color.viewLine, |
| | | |
| | | }; |
| | | /// <summary> |
| | | /// 延时 |
| | | /// </summary> |
| | | public Button btnDelay = new Button |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.AuxiliaryColor1, |
| | | TextID = StringId.delayLogic, |
| | | TextSize = LogicView.TextSize.text16, |
| | | TextColor = CSS.CSS_Color.view, |
| | | }; |
| | | /// <summary> |
| | | /// 删除 |
| | | /// </summary> |
| | | public Button btnDel = new Button |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.textRedColor, |
| | |
| | | TextSize = LogicView.TextSize.text16, |
| | | TextColor = CSS.CSS_Color.view, |
| | | }; |
| | | |
| | | public Button btnClick = new Button |
| | | { |
| | | Height = Application.GetRealHeight(44), |
| | |
| | | rowLayout.AddChidren(btnText); |
| | | rowLayout.AddChidren(btnState); |
| | | rowLayout.AddChidren(btnNextIcon); |
| | | rowLayout.AddRightView(btnDelay); |
| | | rowLayout.AddRightView(btnDel); |
| | | rowLayout.AddChidren(btnClick); |
| | | btnLine.Y = frameLayout.Height - 1; |
| | | frameLayout.AddChidren(btnLine); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public void FLayoutView(FrameLayout fLayout) |
| | | //public void FLayoutView(FrameLayout fLayout, string currState, Action<string> action) |
| | | { |
| | | |
| | | fLayout.AddChidren(frameLayout); |
| | |
| | | frameLayout.AddChidren(btnCancel); |
| | | frameLayout.AddChidren(btnConfirm); |
| | | frameLayout.AddChidren(btnLine); |
| | | //TimePoint(fLayout, action,currState); |
| | | } |
| | | /// <summary> |
| | | /// 选中时间的方法 |
| | |
| | | |
| | | return mList; |
| | | } |
| | | /// <summary> |
| | | /// 获取60秒列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<string> GetsStringList() |
| | | { |
| | | //初始化列表 |
| | | var mList = new List<string>(); |
| | | for (int i = 0; i < 60; i++) |
| | | { |
| | | if (i < 10) |
| | | { |
| | | var a = "0" + i.ToString(); |
| | | //添加数据 |
| | | mList.Add(a + " " + Language.StringByID(StringId.s)); |
| | | } |
| | | else |
| | | { |
| | | //添加数据 |
| | | mList.Add(i.ToString() + " " + Language.StringByID(StringId.s)); |
| | | } |
| | | |
| | | } |
| | | |
| | | return mList; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取023小时列表 |
| | |
| | | pmhigherView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16); |
| | | pmhigherView.btnText.TextID = StringId.PM25; |
| | | viewLayout.AddChidren(pmhigherView.FLayoutView()); |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | PmAction(this); |
| | | |
| | | }; |
| | | |
| | | |
| | | |
| | | #endregion |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="textInt">文本</param> |
| | | /// <param name="stateValue">编辑之前的状态值,默认为20</param> |
| | | public void InputBoxAction(int textInt,string stateValue="20") |
| | | public void InputBoxAction(int textInt, string stateValue = "20") |
| | | { |
| | | new LogicView.TipPopView { }.InputBox(textInt, stateValue, (value) => |
| | | { |
| | |
| | | /// <param name="input"></param> |
| | | /// <param name="keyValue"></param> |
| | | /// <param name="comparator">比较关系</param> |
| | | private void AddCondition(Input input, string keyValue,string comparator) |
| | | private void AddCondition(Input input, string keyValue, string comparator) |
| | | { |
| | | ///记录索引值 |
| | | int index = -1; |
| | |
| | | /// <param name="keyValue"></param> |
| | | /// <param name="comparator">比较关系</param> |
| | | /// <returns></returns> |
| | | private bool ExistKey(List<Dictionary<string, string>> dicList, string keyValue, string comparator) |
| | | private bool ExistKey(List<Dictionary<string, string>> dicList, string keyValue, string comparator) |
| | | { |
| | | for (int i = 0; i < dicList.Count; i++) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 数值返回文本 |
| | | /// </summary> |
| | | /// <param name="strValue">值</param> |
| | | /// <returns></returns> |
| | | public string GetString(string strValue) |
| | | { |
| | | string text = ""; |
| | |
| | | { |
| | | var outputTypeJOb = new JObject { }; |
| | | outputTypeJOb.Add("sid", dictionary.sid); |
| | | outputTypeJOb.Add("delay", dictionary.delay); |
| | | outputTypeJOb.Add("target_type", dictionary.target_type); |
| | | var statusArray = new JArray { }; |
| | | foreach (var dic in dictionary.status) |
| | |
| | | { |
| | | var outputTypeJOb = new JObject { }; |
| | | outputTypeJOb.Add("sid", dictionary.sid); |
| | | outputTypeJOb.Add("delay", dictionary.delay); |
| | | outputTypeJOb.Add("target_type", dictionary.target_type); |
| | | var statusArray = new JArray { }; |
| | | foreach (var dic in dictionary.status) |
| | |
| | | { |
| | | if (libraryList.Count < 60) |
| | | { |
| | | //限制40个库; |
| | | //限制60个库; |
| | | libraryList.Add(library); |
| | | } |
| | | } |