2022年06月30日13:59:08
更新自动化支持梦幻窗帘功能
| | |
| | | } |
| | | } |
| | | break; |
| | | case SPK.CurtainDream: |
| | | { |
| | | string percent = GetKeyValue("percent", dicList); |
| | | string angle = GetKeyValue("angle", dicList); |
| | | if (percent != "" && angle != "") |
| | | { |
| | | stateStr += Language.StringByID(StringId.onLogic) + percent + "%;"; |
| | | stateStr +=Language.StringByID(StringId.Angle)+angle + "°"; |
| | | } |
| | | else if (percent != "") |
| | | { |
| | | stateStr = Language.StringByID(StringId.onLogic) + percent + "%"; |
| | | } |
| | | else if (angle != "") |
| | | { |
| | | stateStr = Language.StringByID(StringId.onLogic) + Language.StringByID(StringId.Angle) + angle + "°"; |
| | | } |
| | | } |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | { |
| | |
| | | |
| | | } |
| | | break; |
| | | case SPK.CurtainDream: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | | string value = dic["value"]; |
| | | switch (dic["key"]) |
| | | { |
| | | case "percent": |
| | | { |
| | | if (button1 == null) |
| | | { |
| | | //怕调试软件乱上东西导致抛异常 |
| | | break; |
| | | } |
| | | button1.Text = value + "%"; |
| | | } |
| | | break; |
| | | case "angle": |
| | | { |
| | | if (button2 == null) |
| | | { |
| | | //怕调试软件乱上东西导致抛异常 |
| | | break; |
| | | } |
| | | button2.Text = value + "°"; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | { |
| | |
| | | case SPK.CurtainSwitch: |
| | | case SPK.CurtainRoller: |
| | | case SPK.CurtainTrietex: |
| | | case SPK.CurtainDream: |
| | | { |
| | | strPath = "LogicIcon/curtainlogic.png"; |
| | | } |
| | |
| | | var curtainjosn = deviceList.Find((device) => |
| | | device.spk == SPK.CurtainSwitch |
| | | || device.spk == SPK.CurtainTrietex |
| | | || device.spk == SPK.CurtainRoller); |
| | | || device.spk == SPK.CurtainRoller |
| | | || device.spk == SPK.CurtainDream); |
| | | if (curtainjosn != null) |
| | | { |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.Curtain)); |
| | |
| | | functionTypeList.Add(SPK.CurtainSwitch); |
| | | functionTypeList.Add(SPK.CurtainRoller); |
| | | functionTypeList.Add(SPK.CurtainTrietex); |
| | | functionTypeList.Add(SPK.CurtainDream); |
| | | } |
| | | ///空调类 |
| | | else if (deviceType == Language.StringByID(StringId.AC)) |
| | |
| | | deviceTypeList.Add(SPK.AirSwitch); |
| | | deviceTypeList.Add(SPK.PanelSocket); |
| | | deviceTypeList.Add(SPK.ElectricSocket); |
| | | deviceTypeList.Add(SPK.CurtainDream); |
| | | } |
| | | break; |
| | | } |
| | |
| | | /// <param name="titleName">标题名称</param> |
| | | /// <param name="stateValue">之前状态值</param> |
| | | /// <param name="action">返回回调</param> |
| | | public void FLayoutView(FrameLayout frame, string titleName,string stateValue, Action<string> action) |
| | | public void FLayoutView(FrameLayout frame, string titleName,string stateValue, Action<string,string> action) |
| | | { |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | |
| | | frameLayout.AddChidren(btn_add); |
| | | frameLayout.AddChidren(btn_add_click); |
| | | btnTitle.Text = titleName; |
| | | //进来的状态 |
| | | if (stateValue.Contains("%")) |
| | | { |
| | | //百分比 |
| | | } |
| | | else if (stateValue.Contains("°")) |
| | | { |
| | | //角度 |
| | | //角度取值范围 |
| | | seekBarVol.MinValue = 0; |
| | | seekBarVol.MaxValue = 180; |
| | | seekBarVol.ProgressBarUnitSring = "°"; |
| | | } |
| | | else |
| | | { |
| | | //音量没有单位 |
| | | seekBarVol.MinValue = 0; |
| | | seekBarVol.MaxValue = 100; |
| | | seekBarVol.ProgressBarUnitSring = ""; |
| | | } |
| | | //第一个变化记录选中值 |
| | | int brightnesValue = 0; |
| | | if (stateValue != "") |
| | | { |
| | | try |
| | | { |
| | | //进来的状态 |
| | | brightnesValue = int.Parse(stateValue.Replace("%", "")); |
| | | brightnesValue = int.Parse(UnitDisposeSring(stateValue)); |
| | | seekBarVol.Progress = brightnesValue; |
| | | } |
| | | catch { } |
| | |
| | | //{ |
| | | // return; |
| | | //} |
| | | action(brightnesValue.ToString()); |
| | | action(brightnesValue.ToString(), UnitSring(stateValue)); |
| | | //移除fLayout界面 |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | |
| | | |
| | | } |
| | | /// <summary> |
| | | //进度值显示单位 |
| | | /// </summary> |
| | | /// <param name="str"></param> |
| | | /// <returns></returns> |
| | | public string UnitSring(string str) |
| | | { |
| | | |
| | | //进来的状态 |
| | | if (str.Contains("%")) |
| | | { |
| | | //百分比 |
| | | return "%"; |
| | | } |
| | | else if (str.Contains("°")) |
| | | { |
| | | //角度 |
| | | return "°"; |
| | | |
| | | } |
| | | else { |
| | | //没有单位 |
| | | return ""; |
| | | } |
| | | } |
| | | /// <summary> |
| | | ///去单位 |
| | | /// </summary> |
| | | /// <param name="str"></param> |
| | | /// <returns></returns> |
| | | public string UnitDisposeSring(string str) |
| | | { |
| | | |
| | | //进来的状态 |
| | | if (str.Contains("%")) |
| | | { |
| | | //百分比 |
| | | return str.Replace("%", ""); |
| | | } |
| | | else if (str.Contains("°")) |
| | | { |
| | | //角度 |
| | | return str.Replace("°", ""); |
| | | } |
| | | else |
| | | { |
| | | //没有单位 |
| | | return str; |
| | | } |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// View的方法 |
| | |
| | | #endregion |
| | | } |
| | | break; |
| | | case SPK.CurtainDream: |
| | | { |
| | | #region 界面 |
| | | ///百分比 |
| | | LogicView.FunTypeView crtainPercentumView = new LogicView.FunTypeView(); |
| | | crtainPercentumView.btnText.TextID = StringId.percentum; |
| | | fLayout.AddChidren(crtainPercentumView.FLayoutView()); |
| | | crtainPercentumView.btnState.Text = "5%";//产品经理晓辉要求改的 2021-11-06 |
| | | ///角度 |
| | | LogicView.FunTypeView AngleView = new LogicView.FunTypeView(); |
| | | AngleView.frameLayout.Y = crtainPercentumView.frameLayout.Bottom; |
| | | AngleView.btnText.TextID = StringId.Angle; |
| | | fLayout.AddChidren(AngleView.FLayoutView()); |
| | | AngleView.btnState.Text = "10°"; |
| | | ///设备延时iewv |
| | | DelayView(fLayout, AngleView.frameLayout.Bottom); |
| | | #endregion |
| | | #region 点击事件 |
| | | |
| | | ///百分比点击事件 |
| | | crtainPercentumView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | BrightnessMethod(device, crtainPercentumView.btnState, crtainPercentumView.btnText.Text); |
| | | }; |
| | | ///角度点击事件 |
| | | AngleView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | BrightnessMethod(device, AngleView.btnState, AngleView.btnText.Text); |
| | | }; |
| | | if (edit) |
| | | { |
| | | //显示编辑之前的设备状态 |
| | | GetEditState(device, index, crtainPercentumView.btnState, AngleView.btnState, null, null); |
| | | } |
| | | #endregion |
| | | } |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | { |
| | |
| | | //之前的状态值 |
| | | string stateVlaue = button.Text; |
| | | LogicView.BrightnessView brightness = new LogicView.BrightnessView(); |
| | | brightness.FLayoutView(this, titleName, stateVlaue, (brightnesValue) => |
| | | brightness.FLayoutView(this, titleName, stateVlaue, (brightnesValue, unitStr) => |
| | | { |
| | | //界面显示选中值 |
| | | button.Text = brightnesValue + "%"; |
| | | button.Text = brightnesValue + unitStr; |
| | | selectedState = device.spk + brightnesValue.ToString(); |
| | | //设备属性值,云雀上定义好的; |
| | | string keyVlaue = ""; |
| | |
| | | break; |
| | | case SPK.CurtainRoller: |
| | | case SPK.CurtainTrietex: |
| | | case SPK.CurtainDream: |
| | | { |
| | | keyVlaue = "percent"; |
| | | if (unitStr == "°") |
| | | { |
| | | //角度 |
| | | keyVlaue = "angle"; |
| | | } |
| | | } |
| | | break; |
| | | } |