From 43b0d5870d528f23ecd6aeceb6cfd4325188b46f Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 01 七月 2021 15:50:43 +0800 Subject: [PATCH] Revert "1" --- HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs | 71 ++++++++++++++++++++++++----------- 1 files changed, 49 insertions(+), 22 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs index 9a6c5c9..e0a5cfe 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs @@ -96,6 +96,8 @@ this.RefreshNowDeviceStatuMemory(this.device); //鍒濆鍖栫涓�涓储寮曢〉鐨勫唴瀹� this.InitFrameWhiteContent1(); + + Control.Ins.SendReadCommand(device); } /// <summary> @@ -241,7 +243,7 @@ this.FrameWhiteCentet1.AddChidren(btnFanView); //寮�鍏冲浘鏍� - this.btnSwitch = new IconViewControl(40); + this.btnSwitch = new IconViewControl(32); btnSwitch.Gravity = Gravity.CenterHorizontal; btnSwitch.Y = Application.GetRealHeight(468); btnSwitch.UnSelectedImagePath = "Public/PowerClose.png"; @@ -291,7 +293,7 @@ { frameBack.Close(); //鍙戦�佽妭鑳藉懡浠� - this.SendOtherComand(this.btnMode1, "energy", "true"); + this.SendOtherComand(this.btnMode1, FunctionAttributeKey.Energy, "true"); }); //鑸掗�� @@ -300,7 +302,7 @@ { frameBack.Close(); //鍙戦�佽垝閫傚懡浠� - this.SendOtherComand(this.btnMode1, "energy", "false"); + this.SendOtherComand(this.btnMode1, FunctionAttributeKey.Energy, "false"); }); } @@ -338,7 +340,7 @@ { frameBack.Close(); //鍙戦�侀�氶鍛戒护 - this.SendOtherComand(this.btnMode2, "mode", "fan"); + this.SendOtherComand(this.btnMode2, FunctionAttributeKey.Mode, "fan"); }); //鍔犳箍 @@ -347,7 +349,7 @@ { frameBack.Close(); //鍙戦�佸姞婀垮懡浠� - this.SendOtherComand(this.btnMode2, "mode", "humidification"); + this.SendOtherComand(this.btnMode2, FunctionAttributeKey.Mode, "humidification"); }); } @@ -385,7 +387,7 @@ { frameBack.Close(); //鍙戦�佹。浣嶅懡浠� - this.SendOtherComand(this.btnFan, "fan", "level_1"); + this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "level_1"); }); //2妗� @@ -394,7 +396,7 @@ { frameBack.Close(); //鍙戦�佹。浣嶅懡浠� - this.SendOtherComand(this.btnFan, "fan", "level_2"); + this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "level_2"); }); //3妗� @@ -403,7 +405,7 @@ { frameBack.Close(); //鍙戦�佹。浣嶅懡浠� - this.SendOtherComand(this.btnFan, "fan", "level_3"); + this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "level_3"); }); } @@ -532,9 +534,10 @@ HdlThreadLogic.Current.RunThread(() => { - var dic = new Dictionary<string, string>(); - dic.Add(comadKey, comadValue); - Control.Ins.SendWriteCommand(this.device, dic, true); + //鑾峰彇鍙戦�佸懡浠ょ殑鏍锋澘(bus鍗忚鏄渶瑕佷竴娆℃�ф妸鍏ㄩ儴鍛戒护涓�璧峰彂閫佺殑) + var dic = this.GetSendComandSample(); + dic[comadKey] = comadValue; + Control.Ins.SendWriteCommand(this.device, dic); HdlThreadLogic.Current.RunMain(() => { btnIcon.CanClick = true; @@ -552,14 +555,38 @@ string statu = this.btnSwitch.IsSelected == true ? "off" : "on"; HdlThreadLogic.Current.RunThread(() => { - var dic = new Dictionary<string, string>(); - dic.Add(FunctionAttributeKey.OnOff, statu); - Control.Ins.SendWriteCommand(this.device, dic, true); + //鑾峰彇鍙戦�佸懡浠ょ殑鏍锋澘(bus鍗忚鏄渶瑕佷竴娆℃�ф妸鍏ㄩ儴鍛戒护涓�璧峰彂閫佺殑) + var dic = this.GetSendComandSample(); + dic[FunctionAttributeKey.OnOff] = statu; + Control.Ins.SendWriteCommand(this.device, dic); HdlThreadLogic.Current.RunMain(() => { this.btnSwitch.CanClick = true; }); }); + } + + /// <summary> + /// 鑾峰彇鍙戦�佸懡浠ょ殑鏍锋澘(bus鍗忚鏄渶瑕佷竴娆℃�ф妸鍏ㄩ儴鍛戒护涓�璧峰彂閫佺殑) + /// </summary> + /// <returns></returns> + private Dictionary<string, string> GetSendComandSample() + { + var dic = new Dictionary<string, string>(); + //寮�鍏� + dic[FunctionAttributeKey.OnOff] = this.airFreshData.Open == true ? "on" : "off"; + //妯″紡 + dic[FunctionAttributeKey.Mode] = this.airFreshData.Mode; + //鑺傝兘 + dic[FunctionAttributeKey.Energy] = this.airFreshData.Energy; + //椋庨�� + dic[FunctionAttributeKey.FanSpeed] = this.airFreshData.Fan ; + //瀹ゅ唴娓╁害 + dic[FunctionAttributeKey.IndoorTemp] = this.airFreshData.Indoor_temp.ToString(); + ///瀹ゅ唴婀垮害 + dic[FunctionAttributeKey.IndoorHumidity] = this.airFreshData.Indoor_humidity.ToString(); + + return dic; } #endregion @@ -575,15 +602,15 @@ { var data = i_LocalDevice.attributes[i]; //寮�鍏� - if (data.key == "on_off") { this.airFreshData.Open = data.state == "on"; } + if (data.key == FunctionAttributeKey.OnOff) { this.airFreshData.Open = data.state == "on"; } //妯″紡 - else if (data.key == "mode") { this.airFreshData.Mode = data.state; } + else if (data.key == FunctionAttributeKey.Mode) { this.airFreshData.Mode = data.state; } //鑺傝兘 - else if (data.key == "energy") { this.airFreshData.Energy = data.state; } + else if (data.key == FunctionAttributeKey.Energy) { this.airFreshData.Energy = data.state; } //椋庨�� - else if (data.key == "fan") { this.airFreshData.Fan = data.state; } + else if (data.key == FunctionAttributeKey.FanSpeed) { this.airFreshData.Fan = data.state; } //婀垮害 - else if (data.key == "humidity") + else if (data.key == FunctionAttributeKey.Humidity) { if (data.state != string.Empty) { @@ -591,7 +618,7 @@ } } //瀹ゅ唴娓╁害 - else if (data.key == "indoor_temp") + else if (data.key == FunctionAttributeKey.IndoorTemp) { if (data.state != string.Empty) { @@ -599,7 +626,7 @@ } } //瀹ゅ唴婀垮害 - else if (data.key == "indoor_humidity") + else if (data.key == FunctionAttributeKey.IndoorHumidity) { if (data.state != string.Empty) { @@ -607,7 +634,7 @@ } } //杩囨护缃戝墿浣欓噺 - else if (data.key == "filter_remain") + else if (data.key == FunctionAttributeKey.FilterRemain) { if (data.state != string.Empty) { -- Gitblit v1.8.0