| | |
| | | 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; |
| | | } |
| | | } |
| | | } |