From 37c315988c2dc11e4f477233f7a9f87d57bb61aa Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期一, 08 三月 2021 09:17:15 +0800 Subject: [PATCH] 数据结构优化修改 --- HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs | 81 ++++++++++++++++++++-------------------- 1 files changed, 41 insertions(+), 40 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs index d00e469..dfbc2d6 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs @@ -9,7 +9,7 @@ public partial class ACPage { static DateTime updataTime = DateTime.MinValue; - public static void UpdataStates(AC uAc) + public static void UpdataStates(Function updateTemp) { try { @@ -23,18 +23,19 @@ { return; } + AC temp = new AC(); updataTime = DateTime.Now; - bodyView.btnTemp.Text = uAc.GetAttrState(FunctionAttributeKey.SetTemp); - bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(uAc.GetAttrState((string)FunctionAttributeKey.IndoorTemp))) + "掳C"; - bodyView.btnMode.UnSelectedImagePath = uAc.GetModeIconPath(); - bodyView.btnWindSpeed.UnSelectedImagePath = uAc.GetFanIconPath(); - bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(uAc.GetAttrState(FunctionAttributeKey.SetTemp))); - if (uAc.trait_on_off.curValue.ToString() == "on") + bodyView.btnTemp.Text = updateTemp.GetAttrState(FunctionAttributeKey.SetTemp); + bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState((string)FunctionAttributeKey.IndoorTemp))) + "掳C"; + bodyView.btnMode.UnSelectedImagePath = temp.GetModeIconPath(updateTemp.GetAttrState(FunctionAttributeKey.Mode)); + bodyView.btnWindSpeed.UnSelectedImagePath = temp.GetFanIconPath(updateTemp.GetAttrState(FunctionAttributeKey.FanSpeed)); + bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.SetTemp))); + if (updateTemp.trait_on_off.curValue.ToString() == "on") { bodyView.arcBar.IsOffline = false; bodyView.btnSwitch.IsSelected = true; bodyView.arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; - if (uAc.GetAttrState((string)FunctionAttributeKey.Mode) == "fan") + if (updateTemp.GetAttrState((string)FunctionAttributeKey.Mode) == "fan") { bodyView.arcBar.IsClickable = false; } @@ -67,8 +68,8 @@ //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = aC.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = aC.GetRoomListName(); + btnFunctionName.Text = btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); }; } @@ -79,8 +80,8 @@ { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = aC.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - aC.CollectFunction(); + btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + function.CollectFunction(); }; } @@ -91,56 +92,56 @@ { btnMinus.MouseUpEventHandler = (sender, e) => { - if (aC.trait_on_off.curValue.ToString() == "off" || aC.GetAttrState(FunctionAttributeKey.Mode) == "fan") + if (function.trait_on_off.curValue.ToString() == "off" || function.GetAttrState(FunctionAttributeKey.Mode) == "fan") { return; } - var temp = Convert.ToInt32(aC.GetAttrState(FunctionAttributeKey.SetTemp)); - if (temp <= aC.GetAttribute(FunctionAttributeKey.Mode).min) + var temp = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)); + if (temp <= function.GetAttribute(FunctionAttributeKey.Mode).min) { return; } temp--; arcBar.Progress = temp; btnTemp.Text = temp.ToString(); - aC.SetAttrState(FunctionAttributeKey.SetTemp,temp.ToString()); - //Control.Send(CommandType_A.write, aC); + function.SetAttrState(FunctionAttributeKey.SetTemp,temp.ToString()); + //Control.Send(CommandType_A.write, function); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); - Control.Ins.SendWriteCommand(aC, d); + Control.Ins.SendWriteCommand(function, d); }; btnPlus.MouseUpEventHandler = (sender, e) => { - if (aC.trait_on_off.curValue.ToString() == "off" || aC.GetAttrState(FunctionAttributeKey.Mode) == "fan") + if (function.trait_on_off.curValue.ToString() == "off" || function.GetAttrState(FunctionAttributeKey.Mode) == "fan") { return; } - var temp = Convert.ToInt32(aC.GetAttrState(FunctionAttributeKey.SetTemp)); - if (temp >= aC.GetAttribute(FunctionAttributeKey.SetTemp).max) + var temp = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)); + if (temp >= function.GetAttribute(FunctionAttributeKey.SetTemp).max) { return; } temp++; arcBar.Progress = temp; btnTemp.Text = temp.ToString(); - aC.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); + function.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); - Control.Ins.SendWriteCommand(aC, d); - //aC.GetSendJObject + Control.Ins.SendWriteCommand(function, d); + //function.GetSendJObject }; arcBar.OnStopTrackingTouchEvent = (sender, e) => { - aC.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); + function.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); btnTemp.Text = arcBar.Progress.ToString(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); - Control.Ins.SendWriteCommand(aC, d); + Control.Ins.SendWriteCommand(function, d); }; arcBar.OnProgressChangedEvent = (sender, e) => { - aC.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); + function.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); btnTemp.Text = e.ToString(); }; } @@ -151,7 +152,7 @@ { btnMode.MouseUpEventHandler = (sender, e) => { - if (aC.trait_on_off.curValue.ToString() == "off") + if (function.trait_on_off.curValue.ToString() == "off") { return; } @@ -159,7 +160,7 @@ }; btnWindSpeed.MouseUpEventHandler = (sender, e) => { - if (aC.trait_on_off.curValue.ToString() == "off") + if (function.trait_on_off.curValue.ToString() == "off") { return; } @@ -169,8 +170,8 @@ btnSwitch.MouseUpEventHandler = (sender, e) => { btnSwitch.IsSelected = !btnSwitch.IsSelected; - aC.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; - if (aC.trait_on_off.curValue.ToString() == "on") + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; + if (function.trait_on_off.curValue.ToString() == "on") { arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; btnSwitch.IsSelected = true; @@ -183,8 +184,8 @@ arcBar.IsOffline = true; } System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, aC.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(aC, d); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(function, d); }; } @@ -200,14 +201,14 @@ EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => { btnModeIcon.IsSelected = btnModeText.IsSelected = true; - aC.SetAttrState(FunctionAttributeKey.Mode, curMode); - btnMode.UnSelectedImagePath = aC.GetModeIconPath(); + function.SetAttrState(FunctionAttributeKey.Mode, curMode); + btnMode.UnSelectedImagePath = acTemp.GetModeIconPath(function.GetAttrState(FunctionAttributeKey.Mode)); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); btnMode.UnSelectedImagePath = btnModeIcon.UnSelectedImagePath; d.Add(FunctionAttributeKey.Mode, curMode); - Control.Ins.SendWriteCommand(aC, d); + Control.Ins.SendWriteCommand(function, d); dialog.Close(); - if (aC.GetAttrState(FunctionAttributeKey.Mode) == "fan") + if (function.GetAttrState(FunctionAttributeKey.Mode) == "fan") { bodyView.arcBar.IsClickable = false; } @@ -232,11 +233,11 @@ EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => { btnFanIcon.IsSelected = btnFanText.IsSelected = true; - aC.SetAttrState(FunctionAttributeKey.FanSpeed, curFan); - btnWindSpeed.UnSelectedImagePath = aC.GetFanIconPath(); + function.SetAttrState(FunctionAttributeKey.FanSpeed, curFan); + btnWindSpeed.UnSelectedImagePath = acTemp.GetFanIconPath(function.GetAttrState(FunctionAttributeKey.FanSpeed)); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.FanSpeed, curFan); - Control.Ins.SendWriteCommand(aC, d); + Control.Ins.SendWriteCommand(function, d); btnWindSpeed.UnSelectedImagePath = btnFanIcon.UnSelectedImagePath; dialog.Close(); }; -- Gitblit v1.8.0