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/Light/ColorTureLampPage.cs | 94 +++++++++++++++++++++++----------------------- 1 files changed, 47 insertions(+), 47 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs index a2014d0..c7305f0 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs @@ -53,7 +53,8 @@ #endregion #region 鍖哄煙鍙橀噺 - Light light; + Light lightTemp = new Light(); + Function function; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; @@ -70,10 +71,10 @@ bodyView = null; } - public ColorTureLampPage(Light func) + public ColorTureLampPage(Function func) { bodyView = this; - light = func; + function = func; } public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut) @@ -82,8 +83,6 @@ btnFunctionName_Out = btnFunctionNameOut; btnFromFloor_Out = btnFromFloorOut; bodyView.BackgroundColor = CSS_Color.BackgroundColor; - //new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView(light,null); - //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Lights), light); controlView = new FrameLayout() { @@ -104,7 +103,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, - Text = light.name, + Text = function.name, }; controlView.AddChidren(btnFunctionName); @@ -117,7 +116,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = light.GetRoomListName() + Text = function.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); @@ -129,7 +128,7 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = light.collect + IsSelected = function.collect }; //controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� @@ -142,16 +141,16 @@ { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(108), - Width = Application.GetRealWidth(142 - 16 -16), + Width = Application.GetRealWidth(142 - 16 - 16), Height = Application.GetRealHeight(222), BorderColor = 0x00000000, CornerRadius = Application.GetRealWidth(20), BorderWidth = 0, - Progress = light.brightness, + Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)), IsProgressTextShow = false, }; controlView.AddChidren(dimmerBar); - if (light.trait_on_off.curValue.ToString() == "on") + if (function.trait_on_off.curValue.ToString() == "on") { dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); } @@ -159,17 +158,17 @@ { dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor); } - dimmerBar.Progress = light.brightness; + dimmerBar.Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)); btnBrightnessText = new Button() { Gravity = Gravity.CenterHorizontal, - Y = ((100 - light.brightness) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80), + Y = ((100 - Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80), Width = Application.GetRealWidth(56), Height = Application.GetRealWidth(46), UnSelectedImagePath = "FunctionIcon/Light/BrightnessBg.png", TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, - Text = light.brightness + "%", + Text = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)) + "%", }; controlView.AddChidren(btnBrightnessText); @@ -219,7 +218,7 @@ //鏄剧ず涓婃柟鐨凾xt barColorTemplatrue.ShowCustomTextView(Application.GetRealWidth(50), CSS_FontSize.PromptFontSize_FirstLevel, CSS_Color.FirstLevelTitleColor); var cct = 27; - int.TryParse(light.Attr_CCT.curValue.ToString(), out cct); + int.TryParse(function.GetAttrState(FunctionAttributeKey.CCT), out cct); barColorTemplatrue.Progress = cct; //璁剧疆鍒濆鍊� barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K"); @@ -282,7 +281,7 @@ // ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, // ProgressBarUnitSring = "s", // MaxValue = 10, - // Progress = light.fadeTime, + // Progress = function.fadeTime, // SeekBarPadding = Application.GetRealWidth(20), //}; //controlView.AddChidren(barFadeTime); @@ -309,7 +308,7 @@ Height = Application.GetRealWidth(32), UnSelectedImagePath = "Public/PowerClose.png", SelectedImagePath = "Public/PowerOpen.png", - IsSelected = light.trait_on_off.curValue.ToString() == "on", + IsSelected = function.trait_on_off.curValue.ToString() == "on", }; controlView.AddChidren(btnSwitch); @@ -329,10 +328,10 @@ LoadEventList(); - new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(light, actionRefresh); + new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(function, actionRefresh); new System.Threading.Thread(() => { - DriverLayer.Control.Ins.SendReadCommand(light); + DriverLayer.Control.Ins.SendReadCommand(function); }) { IsBackground = true }.Start(); } @@ -347,7 +346,8 @@ var dialogBody = new FrameLayout(); frameBack.AddChidren(dialogBody); - dialogBody.MouseUpEventHandler = (sender, e) => { + dialogBody.MouseUpEventHandler = (sender, e) => + { frameBack.Close(); }; @@ -393,12 +393,12 @@ btnCozyIcon.MouseUpEventHandler += (sender, e) => { barColorTemplatrue.Progress = 27; - light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100; - barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K"); + function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100); + barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K"); frameBack.Close(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png"; }; //娓╅Θ 2700k @@ -416,12 +416,12 @@ btnCozy.MouseUpEventHandler += (sender, e) => { barColorTemplatrue.Progress = 27; - light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100; - barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K"); + function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100); + barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K"); frameBack.Close(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(light, d); barColorTemplatrue.Progress = 27; + d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); barColorTemplatrue.Progress = 27; barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K"); frameBack.Close(); btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png"; @@ -439,12 +439,12 @@ btnMeetIcon.MouseUpEventHandler += (sender, e) => { barColorTemplatrue.Progress = 30; - light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100; - barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K"); + function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100); + barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K"); frameBack.Close(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png"; }; @@ -463,12 +463,12 @@ btnMeet.MouseUpEventHandler += (sender, e) => { barColorTemplatrue.Progress = 30; - light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100; - barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K"); + function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100); + barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K"); frameBack.Close(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png"; }; @@ -484,12 +484,12 @@ btnReadIcon.MouseUpEventHandler += (sender, e) => { barColorTemplatrue.Progress = 65; - light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100; - barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K"); + function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100); + barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K"); frameBack.Close(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png"; }; //闃呰 6500k @@ -507,12 +507,12 @@ btnRead.MouseUpEventHandler += (sender, e) => { barColorTemplatrue.Progress = 65; - light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100; - barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K"); + function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100); + barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K"); frameBack.Close(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png"; }; btnCozy.IsSelected = false; @@ -521,17 +521,17 @@ btnMeetIcon.IsSelected = false; btnRead.IsSelected = false; btnReadIcon.IsSelected = false; - if (light.Attr_CCT.curValue.ToString() == "2700") + if (function.GetAttrState(FunctionAttributeKey.CCT) == "2700") { btnCozy.IsSelected = true; btnCozyIcon.IsSelected = true; } - if (light.Attr_CCT.curValue.ToString() == "3000") + if (function.GetAttrState(FunctionAttributeKey.CCT) == "3000") { btnMeet.IsSelected = true; btnMeetIcon.IsSelected = true; } - if (light.Attr_CCT.curValue.ToString() == "6500") + if (function.GetAttrState(FunctionAttributeKey.CCT) == "6500") { btnRead.IsSelected = true; btnReadIcon.IsSelected = true; -- Gitblit v1.8.0