| | |
| | | btnFan.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | ShowFanSelectView(); |
| | | //return; |
| | | //if ( !btnSwitch.IsSelected){return;} |
| | | //var curFanSpeedIndex = fanSpeedList.IndexOf(device.GetAttrState(FunctionAttributeKey.FanSpeed)); |
| | | //var sendFanSpeedIndex = curFanSpeedIndex == fanSpeedList.Count - 1 ? 0 : 1+curFanSpeedIndex; |
| | | |
| | | //device.SetAttrState(FunctionAttributeKey.FanSpeed, fanSpeedList[sendFanSpeedIndex]); |
| | | //new System.Threading.Thread(() => |
| | | //{ |
| | | // Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | // d.Add(FunctionAttributeKey.FanSpeed, fanSpeedList[sendFanSpeedIndex]); |
| | | // Control.Ins.SendWriteCommand(device, d); |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | //RefreshFanSpeed(); |
| | | }; |
| | | //风速文本 |
| | | this.btnFanView = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false); |
| | |
| | | }); |
| | | } |
| | | |
| | | //if (fanAttr.value.Contains("low")) |
| | | //{ |
| | | // //1档 |
| | | // var iconPath = this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "low" ? "FunctionIcon/AirFresh/Fan1Select.png" : "FunctionIcon/AirFresh/Fan1.png"; |
| | | // menuContr.AddRowMenu(Language.StringByID(StringId.FanOneGear), iconPath, this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "low", () => |
| | | // { |
| | | // frameBack.Close(); |
| | | // //发送档位命令 |
| | | // this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "low"); |
| | | // }); |
| | | //} |
| | | |
| | | //if (fanAttr.value.Contains("medium")) |
| | | //{ |
| | | // //2档 |
| | | // var iconPath = this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "medium" ? "FunctionIcon/AirFresh/Fan2Select.png" : "FunctionIcon/AirFresh/Fan2.png"; |
| | | // menuContr.AddRowMenu(Language.StringByID(StringId.FanTwoGear), iconPath, this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "medium", () => |
| | | // { |
| | | // frameBack.Close(); |
| | | // //发送档位命令 |
| | | // this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "medium"); |
| | | // }); |
| | | //} |
| | | |
| | | //if (fanAttr.value.Contains("high")) |
| | | //{ |
| | | // //3档 |
| | | // var iconPath = this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "high" ? "FunctionIcon/AirFresh/Fan3Select.png" : "FunctionIcon/AirFresh/Fan3.png"; |
| | | // menuContr.AddRowMenu(Language.StringByID(StringId.FanThreeGear), iconPath, this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "high", () => |
| | | // { |
| | | // frameBack.Close(); |
| | | // //发送档位命令 |
| | | // this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "high"); |
| | | // }); |
| | | //} |
| | | } |
| | | |
| | | #endregion |
| | |
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | | //获取发送命令的样板(bus协议是需要一次性把全部命令一起发送的) |
| | | var dic = this.GetSendComandSample(); |
| | | dic[comadKey] = comadValue; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add(comadKey, comadValue); |
| | | Control.Ins.SendWriteCommand(this.device, dic); |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | btnIcon.CanClick = true; |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取发送命令的样板(bus协议是需要一次性把全部命令一起发送的) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private Dictionary<string, string> GetSendComandSample() |
| | | { |
| | | var dic = new Dictionary<string, string>(); |
| | | //开关 |
| | | dic[FunctionAttributeKey.OnOff] = this.device.GetAttrState(FunctionAttributeKey.OnOff); |
| | | //风速 |
| | | dic[FunctionAttributeKey.FanSpeed] = this.device.GetAttrState(FunctionAttributeKey.FanSpeed); |
| | | |
| | | return dic; |
| | | } |
| | | |
| | | #endregion |