2022年11月10日13:18:58
自动化输出目标设备色温灯;增加色温属性
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Curtain\VenetianBlindsPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Curtain\VenetianBlindsPageBLL.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\ChooseIocate.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\ColorTemperature.cs" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" />
|
| | |
| | | { |
| | | stateStr = brightness + "%"; |
| | | } |
| | | if (device.spk == SPK.LightCCT) |
| | | { |
| | | //色温这个属性才有效 |
| | | if (stateStr != Language.StringByID(StringId.offLogic) && GetKeyValue("cct", dicList) != "") |
| | | { |
| | | stateStr += "," +GetKeyValue("cct", dicList) + "k"; |
| | | } |
| | | } |
| | | |
| | | } |
| | | break; |
| | |
| | | button2.Text = value + "%"; |
| | | } |
| | | break; |
| | | case "cct": |
| | | { |
| | | if (button3 == null) |
| | | { |
| | | //怕调试软件乱上东西导致抛异常 |
| | | break; |
| | | } |
| | | button3.Text = value + "k"; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | |
| | | //new Entity.Function { sid = "1234567890", name = "超声波传感器", spk = Entity.SPK.SensorUtrasonic }, |
| | | // new Entity.Function { sid = "1234567891", name = "温度传感器", spk = Entity.SPK.SensorTemperature }, |
| | | // new Entity.Function { sid = "1234567892", name = "湿度传感器", spk = Entity.SPK.SensorHumidity }, |
| | | // new Entity.Function { sid = "1234567893", name = "红外对射传感器", spk = Entity.SPK.SensorDuiShe }, |
| | | // new Entity.Function { sid = "1234567895", name = "超声波传感器", spk = Entity.SPK.SensorUtrasonic }, |
| | | new Entity.Function { sid = "1234567896", name = "毫米波传感器", spk = Entity.SPK.SenesorMegahealth }, |
| | | new Entity.Function { sid = "1234567897", name = "毫米波传感器1", spk = Entity.SPK.SenesorMegahealth2 }, |
| | | new Entity.Function { sid = "1234567899", name = "门磁传感器", spk = Entity.SPK.SensorDoorWindow }, |
| | | new Entity.Function { sid = "12345678991234", name = "HDL机械手", spk = Entity.SPK.MechanicalArm }, |
| | | new Entity.Function { sid = "123456789912345", name = "海曼机械手", spk = Entity.SPK.MechanicalArm }, |
| | | new Entity.Function { sid = "12345678991234566", name = "海曼机械手", spk = Entity.SPK.MechanicalArm }, |
| | | new Entity.Function { sid = "12345678933456", name = "调光灯", spk = Entity.SPK.LightDimming }, |
| | | new Entity.Function { sid = "1234567895444", name = "cct", spk = Entity.SPK.LightCCT }, |
| | | //new Entity.Function { sid = "1234567896", name = "毫米波传感器", spk = Entity.SPK.SenesorMegahealth }, |
| | | // new Entity.Function { sid = "1234567897", name = "毫米波传感器1", spk = Entity.SPK.SenesorMegahealth2 }, |
| | | // new Entity.Function { sid = "1234567899", name = "门磁传感器", spk = Entity.SPK.SensorDoorWindow }, |
| | | // new Entity.Function { sid = "12345678991234", name = "HDL机械手", spk = Entity.SPK.MechanicalArm }, |
| | | // new Entity.Function { sid = "123456789912345", name = "海曼机械手", spk = Entity.SPK.MechanicalArm }, |
| | | // new Entity.Function { sid = "12345678991234566", name = "海曼机械手", spk = Entity.SPK.MechanicalArm }, |
| | | }; |
| | | foreach (var function in functions) |
| | | { |
New file |
| | |
| | | using System; |
| | | using Shared; |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView |
| | | { |
| | | |
| | | public class ColorTemperature |
| | | { |
| | | /// <summary> |
| | | /// 主控件 |
| | | /// </summary> |
| | | public FrameLayout frameLayout = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(467), |
| | | Height = Application.GetRealHeight(56 + 124), |
| | | Width = Application.GetRealWidth(343), |
| | | X = Application.GetRealWidth(16), |
| | | BackgroundColor = CSS.CSS_Color.view, |
| | | Radius = (uint)Application.GetRealHeight(12), |
| | | }; |
| | | /// <summary> |
| | | /// 标题Btn |
| | | /// </summary> |
| | | public Button btnTitle = new Button |
| | | { |
| | | TextID = StringId.timeHorizon, |
| | | TextSize = TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | IsBold = true, |
| | | Width = Application.GetRealWidth(343 - (52 + 4 + 10) * 2), |
| | | Height = Application.GetRealHeight(22), |
| | | Y = Application.GetRealHeight(17), |
| | | X = Application.GetRealWidth(52 + 4 + 10) |
| | | }; |
| | | /// <summary> |
| | | /// 取消Btn |
| | | /// </summary> |
| | | public Button btnCancel = new Button |
| | | { |
| | | TextID = StringId.cancelSelected, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | Width = Application.GetRealWidth(52), |
| | | Height = Application.GetRealHeight(32), |
| | | Y = Application.GetRealHeight(10), |
| | | X = Application.GetRealWidth(4) |
| | | }; |
| | | /// <summary> |
| | | /// 确定Btn |
| | | /// </summary> |
| | | public Button btnConfirm = new Button |
| | | { |
| | | TextID = StringId.confirmSelected, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textConfirmColor, |
| | | Width = Application.GetRealWidth(52), |
| | | Height = Application.GetRealHeight(32), |
| | | X = Application.GetRealWidth(343 - 4 - 52), |
| | | Y = Application.GetRealHeight(10), |
| | | }; |
| | | /// <summary> |
| | | /// 左边文本 |
| | | /// </summary> |
| | | public Button btn_left = new Button |
| | | { |
| | | Width = Application.GetRealWidth(35), |
| | | Height = Application.GetRealWidth(24), |
| | | X = Application.GetRealWidth(15), |
| | | Y = Application.GetRealHeight(118), |
| | | Text= "2700k", |
| | | TextColor= CSS.CSS_Color.textCancelColor, |
| | | TextSize = TextSize.text12, |
| | | TextAlignment=TextAlignment.CenterLeft, |
| | | }; |
| | | |
| | | public DiyImageSeekBar seekBarVol = new DiyImageSeekBar |
| | | { |
| | | Y = Application.GetRealHeight(103),//进度条父控件Y坐标 |
| | | X = Application.GetRealWidth(62 - 10),//进度条X坐标 |
| | | SeekBarPadding = Application.GetRealHeight(10),//进度条实际长度=244-10*2(内边距); |
| | | Width = Application.GetRealWidth(240),//进度条的长度 |
| | | Height = Application.GetRealHeight(54),//进度条父控件高度 |
| | | IsProgressTextShow = true,//显示百分比 |
| | | ProgressBarUnitSring="k", |
| | | IsClickable = true,//进度条是否滑动 |
| | | ProgressBarColor = CSS.CSS_Color.textConfirmColor,//选中进度条颜色 |
| | | ThumbImagePath = "LogicIcon/point.png",//进度条按钮图标 |
| | | ThumbImageHeight = Application.GetRealHeight(54),//进度条按钮图标的高度(默认正方形:宽和高一样) |
| | | ProgressTextColor = CSS.CSS_Color.textColor, |
| | | ProgressTextSize = 10,//显示百分比字体大小 |
| | | SeekBarViewHeight = Application.GetRealHeight(8),//进度条的高度 |
| | | MinValue = 2700, |
| | | MaxValue = 6500, |
| | | |
| | | |
| | | }; |
| | | /// <summary> |
| | | /// 右边文本 |
| | | /// </summary> |
| | | public Button btn_right = new Button |
| | | { |
| | | |
| | | Width = Application.GetRealWidth(35), |
| | | Height = Application.GetRealWidth(24), |
| | | X = Application.GetRealWidth(294), |
| | | Y = Application.GetRealHeight(118), |
| | | Text = "6500k", |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | TextSize = TextSize.text12, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// View的方法 |
| | | /// </summary> |
| | | /// <param name="frame">父控件</param> |
| | | /// <param name="titleName">标题名称</param> |
| | | /// <param name="stateValue">之前状态值</param> |
| | | /// <param name="action">返回回调</param> |
| | | public void FLayoutView(FrameLayout frame, string titleName, string stateValue, Action<string, string> action) |
| | | { |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | frame.AddChidren(fLayout); |
| | | fLayout.AddChidren(frameLayout); |
| | | frameLayout.AddChidren(btnTitle); |
| | | frameLayout.AddChidren(btnCancel); |
| | | frameLayout.AddChidren(btnConfirm); |
| | | frameLayout.AddChidren(btn_left); |
| | | frameLayout.AddChidren(seekBarVol); |
| | | frameLayout.AddChidren(btn_right); |
| | | btnTitle.Text = titleName; |
| | | |
| | | //第一个变化记录选中值 |
| | | int brightnesValue = 0; |
| | | if (stateValue != "") |
| | | { |
| | | try |
| | | { |
| | | brightnesValue = int.Parse(UnitDisposeSring(stateValue)); |
| | | seekBarVol.Progress = brightnesValue; |
| | | } |
| | | catch { } |
| | | } |
| | | //进度条滑动点击事件 |
| | | EventHandler<int> progressclick = (sender2, e2) => |
| | | { |
| | | brightnesValue = seekBarVol.Progress; |
| | | |
| | | |
| | | }; |
| | | seekBarVol.OnProgressChangedEvent += progressclick; |
| | | seekBarVol.OnStopTrackingTouchEvent += progressclick; |
| | | //取消点击事件 |
| | | btnCancel.MouseUpEventHandler += (sender, e1) => |
| | | { |
| | | //移除fLayout界面 |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | //确定点击事件 |
| | | btnConfirm.MouseUpEventHandler += (sender, e1) => |
| | | { |
| | | |
| | | action(brightnesValue.ToString(), UnitSring(stateValue)); |
| | | //移除fLayout界面 |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | |
| | | |
| | | } |
| | | /// <summary> |
| | | //进度值显示单位 |
| | | /// </summary> |
| | | /// <param name="str"></param> |
| | | /// <returns></returns> |
| | | public string UnitSring(string str) |
| | | { |
| | | |
| | | //进来的状态 |
| | | if (str.Contains("k")) |
| | | { |
| | | //百分比 |
| | | return "k"; |
| | | } |
| | | |
| | | else |
| | | { |
| | | //没有单位 |
| | | return ""; |
| | | } |
| | | } |
| | | /// <summary> |
| | | ///去单位 |
| | | /// </summary> |
| | | /// <param name="str"></param> |
| | | /// <returns></returns> |
| | | public string UnitDisposeSring(string str) |
| | | { |
| | | |
| | | //进来的状态 |
| | | if (str.Contains("k")) |
| | | { |
| | | // |
| | | return str.Replace("k", ""); |
| | | } |
| | | else |
| | | { |
| | | //没有单位 |
| | | return str; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | logicjArray.Add(logicIfon); |
| | | var jObject = new JObject { { "homeId", LogicMethod.Current.HomeId }, { "logics", logicjArray } }; |
| | | |
| | | string str = jObject.ToString(); |
| | | responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Update, "编辑更新自动化", 5); |
| | | //如果是token过期则刷新token |
| | |
| | | case SPK.LightDimming: |
| | | case SPK.LightRGB: |
| | | case SPK.LightRGBW: |
| | | case SPK.LightCCT: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | |
| | | { |
| | | //显示编辑之前的设备状态 |
| | | GetEditDeviceState(device, index, lightSwitchView.btnState, brightnessView.btnState, null, null); |
| | | } |
| | | #endregion |
| | | } |
| | | break; |
| | | case SPK.LightCCT: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | | LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); |
| | | lightSwitchView.btnText.TextID = StringId.switchLogic; |
| | | fLayout.AddChidren(lightSwitchView.FLayoutView()); |
| | | ///亮度 |
| | | LogicView.FunTypeView brightnessView = new LogicView.FunTypeView(); |
| | | brightnessView.frameLayout.Y = lightSwitchView.frameLayout.Bottom; |
| | | brightnessView.btnText.TextID = StringId.brightnesLogic; |
| | | fLayout.AddChidren(brightnessView.FLayoutView()); |
| | | brightnessView.btnState.Text = "5%";//产品经理晓辉要求改的 2021-11-06 |
| | | ///色温 |
| | | LogicView.FunTypeView colorTemperatureView = new LogicView.FunTypeView(); |
| | | colorTemperatureView.frameLayout.Y = brightnessView.frameLayout.Bottom; |
| | | colorTemperatureView.btnText.TextID = StringId.ColorTemperature; |
| | | fLayout.AddChidren(colorTemperatureView.FLayoutView()); |
| | | colorTemperatureView.btnState.Text = "2700k"; |
| | | ///设备延时iewv |
| | | DelayView(fLayout, colorTemperatureView.frameLayout.Bottom); |
| | | #endregion |
| | | #region 点击事件 |
| | | ///开关点击事件 |
| | | lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | SwitchViewMethod(device, lightSwitchView.btnState, 2); |
| | | }; |
| | | ///亮度点击事件 |
| | | brightnessView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | BrightnessMethod(device, brightnessView.btnState, brightnessView.btnText.Text); |
| | | |
| | | }; |
| | | ///色温点击事件 |
| | | colorTemperatureView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | ColorTemperatureMethod(device, colorTemperatureView.btnState, colorTemperatureView.btnText.Text); |
| | | |
| | | }; |
| | | if (edit) |
| | | { |
| | | //显示编辑之前的设备状态 |
| | | GetEditDeviceState(device, index, lightSwitchView.btnState, brightnessView.btnState, colorTemperatureView.btnState, null); |
| | | } |
| | | #endregion |
| | | } |
| | |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 色温(cct)=功能下一级界面 |
| | | /// </summary> |
| | | /// <param name="device"></param> |
| | | /// <param name="button"></param> |
| | | private void ColorTemperatureMethod(Entity.Function device, Button button, string titleName) |
| | | { |
| | | #region 界面 |
| | | //之前的状态值 |
| | | string stateVlaue = button.Text; |
| | | LogicView.ColorTemperature brightness = new LogicView.ColorTemperature(); |
| | | brightness.FLayoutView(this, titleName, stateVlaue, (colorTemperatureValue, unitStr) => |
| | | { |
| | | //界面显示选中值 |
| | | button.Text = colorTemperatureValue + unitStr; |
| | | selectedState = device.spk + colorTemperatureValue.ToString(); |
| | | //设备属性值,云雀上定义好的; |
| | | string keyVlaue = ""; |
| | | switch (device.spk) |
| | | { |
| | | case SPK.LightCCT: |
| | | { |
| | | keyVlaue = "cct"; |
| | | } |
| | | break; |
| | | } |
| | | //数据封装 |
| | | AddDictionary(keyVlaue, colorTemperatureValue); |
| | | }); |
| | | #endregion |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 显示编辑之前的设备状态 |
| | | /// </summary> |
| | | /// <param name="device">编辑设备</param> |