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/Electrical/FanPageBLL.cs | 42 ++++++++++++++++++++---------------------- 1 files changed, 20 insertions(+), 22 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs index 11f6b3b..86a0e73 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs @@ -10,7 +10,7 @@ /// <summary> /// 鏇存柊鐏厜鐘舵�� /// </summary> - public static void UpdataState(Fan uFan) + public static void UpdataState(Function updateTemp) { Application.RunOnMainThread(() => { @@ -18,9 +18,9 @@ { if (bodyView == null) return; - bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uFan.trait_on_off.curValue.ToString() == "on"; - bodyView.barGradualChange.ProgressBarColor = uFan.trait_on_off.curValue.ToString() == "on" ? CSS.CSS_Color.MainColor : CSS.CSS_Color.PromptingColor2; - bodyView.barGradualChange.Progress = uFan.openLevel; + bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = updateTemp.trait_on_off.curValue.ToString() == "on"; + bodyView.barGradualChange.ProgressBarColor = updateTemp.trait_on_off.curValue.ToString() == "on" ? CSS.CSS_Color.MainColor : CSS.CSS_Color.PromptingColor2; + bodyView.barGradualChange.Progress = Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.OpenLevel)); } catch (Exception ex) { @@ -38,9 +38,9 @@ //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = fan.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = fan.GetRoomListName(); - //fan.SaveFunctionData(true); + btnFunctionName.Text = btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); + //function.SaveFunctionData(true); }; } @@ -50,8 +50,8 @@ void LoadCollectionEvent() { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = fan.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - fan.CollectFunction(); + btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + function.CollectFunction(); }; } @@ -66,11 +66,11 @@ new System.Threading.Thread(() => { - fan.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; - //Control.Send(CommandType_A.write, this.fan); + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; + //Control.Send(CommandType_A.write, this.function); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", fan.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(fan, d); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; @@ -80,24 +80,22 @@ new System.Threading.Thread(() => { - fan.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; - //Control.Send(CommandType_A.write, this.fan); + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", fan.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(fan, d); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; barGradualChange.OnProgressChangedEvent = (sender, e) => { - fan.openLevel = e; + function.SetAttrState(FunctionAttributeKey.OpenLevel, e.ToString()); new System.Threading.Thread(() => { - fan.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; - //Control.Send(CommandType_A.write, this.fan); + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", fan.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(fan, d); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; -- Gitblit v1.8.0