From e1a8f2f7e4d850beedeb1469610b878c1427e976 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 15 十二月 2021 09:01:53 +0800 Subject: [PATCH] 更新 --- HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs | 783 +++++++++++++++++++++++++++++++------------------------ 1 files changed, 434 insertions(+), 349 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs index 63f7030..a40ee00 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs @@ -41,7 +41,7 @@ /// <summary> /// 鑹叉俯鐨勬粦鍔ㄦ帶浠� /// </summary> - SeekBarControl barColorTemplatrue; + CCTSeekBarControl barColorTemplatrue; /// <summary> /// 寮�鍏虫寜閽� /// </summary> @@ -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,29 +128,29 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = light.collect + IsSelected = function.collect }; - //controlView.AddChidren(btnCollection); + controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� - if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare) - { - controlView.AddChidren(btnCollection); - } + //if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare) + //{ + // controlView.AddChidren(btnCollection); + //} dimmerBar = new WaveSeekBarOn() { Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealHeight(74 + 16), - Width = Application.GetRealWidth(142 - 40), - Height = Application.GetRealHeight(222 - 16 - 16), + Y = Application.GetRealHeight(108), + 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,25 +158,100 @@ { 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 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16 - 16) / 100) + Application.GetRealWidth(40), + 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); + controlView.AddChidren(btnBrightnessText); + + + #region 娓愬彉鏃堕棿璋冭妭 + if (function.GetAttribute(FunctionAttributeKey.FadeTime) != null) + { + var btnGradualChangeText = new Button() + { + X = Application.GetRealWidth(35), + Y = Application.GetRealHeight(306 + 40), + Width = Application.GetRealWidth(224), + Height = Application.GetRealHeight(21), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextID = StringId.SpeedOfChange, + }; + controlView.AddChidren(btnGradualChangeText); + + var btnGradualChangeMinValuesText = new Button() + { + X = Application.GetRealWidth(35), + Y = btnGradualChangeText.Bottom + Application.GetRealHeight(5), + Width = Application.GetRealWidth(22), + Height = Application.GetRealHeight(21), + Text = "0s", + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + }; + controlView.AddChidren(btnGradualChangeMinValuesText); + + barFadeTime = new DiyImageSeekBar() + { + X = btnGradualChangeMinValuesText.Right, + Y = Application.GetRealHeight(360), + Width = Application.GetRealWidth(210), + Height = Application.GetRealHeight(54), + SeekBarViewHeight = Application.GetRealHeight(8), + ThumbImagePath = "Public/ThumbImage.png", + ThumbImageHeight = Application.GetRealHeight(54), + ProgressBarColor = CSS_Color.MainColor, + ProgressTextColor = CSS_Color.FirstLevelTitleColor, + ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, + ProgressBarUnitSring = "s", + MaxValue = 10, + Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.FadeTime)), + SeekBarPadding = Application.GetRealWidth(20), + }; + controlView.AddChidren(barFadeTime); + + var btnGradualChangeMaxValuesText = new Button() + { + X = barFadeTime.Right, + Y = btnGradualChangeText.Bottom + Application.GetRealHeight(5), + Width = Application.GetRealWidth(35), + Height = Application.GetRealHeight(21), + Text = "10s", + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + }; + controlView.AddChidren(btnGradualChangeMaxValuesText); + } + #endregion + #region 鑹叉俯 + var cctAttr = function.GetAttribute(FunctionAttributeKey.CCT); + if(cctAttr.min == 0) + { + cctAttr.min = 2700; + } + if(cctAttr.max == 0) + { + cctAttr.max = 6500; + } + //鑹叉俯 var btnTempClolor = new Button(); btnTempClolor.X = Application.GetRealWidth(35); - btnTempClolor.Y = Application.GetRealHeight(306); + btnTempClolor.Y = Application.GetRealHeight(395); btnTempClolor.Width = Application.GetRealWidth(224); btnTempClolor.Height = Application.GetRealHeight(21); btnTempClolor.TextAlignment = TextAlignment.CenterLeft; @@ -186,12 +260,13 @@ btnTempClolor.TextID = StringId.ColorTemperature; controlView.AddChidren(btnTempClolor); + //2700K var btnTempClolorMin = new Button(); btnTempClolorMin.Y = btnTempClolor.Bottom + Application.GetRealHeight(9); btnTempClolorMin.Width = Application.GetRealWidth(54); btnTempClolorMin.Height = Application.GetRealHeight(21); - btnTempClolorMin.Text = "2700K"; + btnTempClolorMin.Text = cctAttr.min + "K"; btnTempClolorMin.TextAlignment = TextAlignment.CenterRight; btnTempClolorMin.TextColor = CSS_Color.PromptingColor1; btnTempClolorMin.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; @@ -206,11 +281,11 @@ btnColorTemplatrueBack.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatureBar.png"; controlView.AddChidren(btnColorTemplatrueBack); //婊戝姩鏉℃帶浠� - barColorTemplatrue = new SeekBarControl(); + barColorTemplatrue = new CCTSeekBarControl(); barColorTemplatrue.X = btnTempClolorMin.Right; barColorTemplatrue.Y = Application.GetRealHeight(340); - barColorTemplatrue.MinValue = 27; - barColorTemplatrue.MaxValue = 65; + barColorTemplatrue.MinValue = cctAttr.min /100; + barColorTemplatrue.MaxValue = cctAttr.max / 100; barColorTemplatrue.ProgressBarColor = 0x00000000;//鍏ㄩ儴閫忔槑 barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000; barColorTemplatrue.SeekBarBackgroundColor = 0x00000000; @@ -218,6 +293,9 @@ barColorTemplatrue.Y = btnTempClolorMin.Y - (barColorTemplatrue.Height - btnTempClolorMin.Height) / 2; //鏄剧ず涓婃柟鐨凾xt barColorTemplatrue.ShowCustomTextView(Application.GetRealWidth(50), CSS_FontSize.PromptFontSize_FirstLevel, CSS_Color.FirstLevelTitleColor); + var cct = 27; + int.TryParse(function.GetAttrState(FunctionAttributeKey.CCT), out cct); + barColorTemplatrue.Progress = cct; //璁剧疆鍒濆鍊� barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K"); @@ -230,7 +308,7 @@ btnTempClolorMax.X = barColorTemplatrue.Right; btnTempClolorMax.Width = Application.GetRealWidth(54); btnTempClolorMax.Height = Application.GetRealHeight(21); - btnTempClolorMax.Text = "6500K"; + btnTempClolorMax.Text = cctAttr.max + "K"; btnTempClolorMax.TextAlignment = TextAlignment.CenterLeft; btnTempClolorMax.TextColor = CSS_Color.PromptingColor1; btnTempClolorMax.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; @@ -238,85 +316,25 @@ #endregion - #region 娓愬彉鏃堕棿璋冭妭 - var btnGradualChangeText = new Button() - { - X = Application.GetRealWidth(35), - Y = Application.GetRealHeight(385), - Width = Application.GetRealWidth(224), - Height = Application.GetRealHeight(21), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - TextID = StringId.SpeedOfChange, - }; - controlView.AddChidren(btnGradualChangeText); - - var btnGradualChangeMinValuesText = new Button() - { - X = Application.GetRealWidth(35), - Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8), - Width = Application.GetRealWidth(22), - Height = Application.GetRealHeight(21), - Text = "0s", - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - }; - controlView.AddChidren(btnGradualChangeMinValuesText); - - barFadeTime = new DiyImageSeekBar() - { - X = btnGradualChangeMinValuesText.Right, - Y = Application.GetRealHeight(412 - 21) + Application.GetRealHeight(8), - Width = Application.GetRealWidth(210), - Height = Application.GetRealHeight(54), - SeekBarViewHeight = Application.GetRealHeight(8), - ThumbImagePath = "Public/ThumbImage.png", - ThumbImageHeight = Application.GetRealHeight(54), - ProgressBarColor = CSS_Color.MainColor, - ProgressTextColor = CSS_Color.FirstLevelTitleColor, - ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, - ProgressBarUnitSring = "s", - MaxValue = 10, - Progress = light.fadeTime, - SeekBarPadding = Application.GetRealWidth(20), - }; - controlView.AddChidren(barFadeTime); - - var btnGradualChangeMaxValuesText = new Button() - { - X = barFadeTime.Right, - Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8), - Width = Application.GetRealWidth(35), - Height = Application.GetRealHeight(21), - Text = "10s", - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - }; - controlView.AddChidren(btnGradualChangeMaxValuesText); - #endregion - btnSwitch = new Button() { - X = Application.GetRealWidth(184), - Y = Application.GetRealHeight(462), - Width = Application.GetRealWidth(40), - Height = Application.GetRealWidth(40), + X = Application.GetRealWidth(180), + Y = Application.GetRealHeight(466), + Width = Application.GetRealWidth(32), + 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); //鑹叉俯鐨勫揩鎹锋柟寮忓浘鏍� btnShortcut = new Button(); - btnShortcut.X = Application.GetRealWidth(104); + btnShortcut.X = Application.GetRealWidth(116); btnShortcut.Y = btnSwitch.Y; - btnShortcut.Width = Application.GetRealWidth(40); - btnShortcut.Height = Application.GetRealWidth(40); - btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatrueQuick.png"; + btnShortcut.Width = Application.GetRealWidth(32); + btnShortcut.Height = Application.GetRealWidth(32); + btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png"; controlView.AddChidren(btnShortcut); btnShortcut.MouseUpEventHandler += (sender, e) => { @@ -326,10 +344,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(); } @@ -341,6 +359,14 @@ { //鏁翠釜鐏拌壊鐣岄潰 var frameBack = new Dialog(); + + var dialogBody = new FrameLayout(); + frameBack.AddChidren(dialogBody); + dialogBody.MouseUpEventHandler = (sender, e) => + { + frameBack.Close(); + }; + frameBack.Show(); //鐧借壊鐨勮儗鏅�(鐢ㄥ浘鐗囨暣鐨�) @@ -378,12 +404,18 @@ btnCozyIcon.Width = Application.GetRealWidth(24); btnCozyIcon.Height = Application.GetRealWidth(24); btnCozyIcon.UnSelectedImagePath = "FunctionIcon/Light/CozyIcon.png"; + btnCozyIcon.SelectedImagePath = "FunctionIcon/Light/CozyIconOn.png"; frameWhite.AddChidren(btnCozyIcon); btnCozyIcon.MouseUpEventHandler += (sender, e) => - { + { barColorTemplatrue.Progress = 27; - barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K"); - frameBack.Close(); + 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, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); + btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png"; }; //娓╅Θ 2700k var btnCozy = new Button(); @@ -394,13 +426,21 @@ btnCozy.Text = Language.StringByID(StringId.Cozy) + " 2700K"; btnCozy.TextSize = CSS_FontSize.TextFontSize; btnCozy.TextColor = CSS_Color.FirstLevelTitleColor; + btnCozy.SelectedTextColor = CSS_Color.MainColor; btnCozy.TextAlignment = TextAlignment.CenterLeft; frameWhite.AddChidren(btnCozy); btnCozy.MouseUpEventHandler += (sender, e) => { barColorTemplatrue.Progress = 27; + 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, (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"; }; //浼氬鍥炬爣 @@ -410,12 +450,18 @@ btnMeetIcon.Width = Application.GetRealWidth(24); btnMeetIcon.Height = Application.GetRealWidth(24); btnMeetIcon.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIcon.png"; + btnMeetIcon.SelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png"; frameWhite.AddChidren(btnMeetIcon); btnMeetIcon.MouseUpEventHandler += (sender, e) => - { + { barColorTemplatrue.Progress = 30; - barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K"); - frameBack.Close(); + 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, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); + btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png"; }; //浼氬 3000k @@ -427,13 +473,19 @@ btnMeet.Text = Language.StringByID(StringId.MeetingGuests) + " 3000K"; btnMeet.TextSize = CSS_FontSize.TextFontSize; btnMeet.TextColor = CSS_Color.FirstLevelTitleColor; + btnMeet.SelectedTextColor = CSS_Color.MainColor; btnMeet.TextAlignment = TextAlignment.CenterLeft; frameWhite.AddChidren(btnMeet); btnMeet.MouseUpEventHandler += (sender, e) => { barColorTemplatrue.Progress = 30; - barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K"); - frameBack.Close(); + 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, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); + btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png"; }; //闃呰鍥炬爣 @@ -443,12 +495,18 @@ btnReadIcon.Width = Application.GetRealWidth(24); btnReadIcon.Height = Application.GetRealWidth(24); btnReadIcon.UnSelectedImagePath = "FunctionIcon/Light/ReadIcon.png"; + btnReadIcon.SelectedImagePath = "FunctionIcon/Light/ReadIconOn.png"; frameWhite.AddChidren(btnReadIcon); btnReadIcon.MouseUpEventHandler += (sender, e) => - { + { barColorTemplatrue.Progress = 65; - barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K"); - frameBack.Close(); + 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, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); + btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png"; }; //闃呰 6500k var btnRead = new Button(); @@ -458,251 +516,278 @@ btnRead.Height = Application.GetRealWidth(24); btnRead.Text = Language.StringByID(StringId.Reading) + " 6500K"; btnRead.TextSize = CSS_FontSize.TextFontSize; - btnRead.TextColor = CSS_Color.MainColor; + btnRead.TextColor = CSS_Color.FirstLevelTitleColor; + btnRead.SelectedTextColor = CSS_Color.MainColor; btnRead.TextAlignment = TextAlignment.CenterLeft; frameWhite.AddChidren(btnRead); btnRead.MouseUpEventHandler += (sender, e) => - { + { barColorTemplatrue.Progress = 65; - barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K"); - frameBack.Close(); - }; + 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, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); + btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png"; + }; + btnCozy.IsSelected = false; + btnCozyIcon.IsSelected = false; + btnMeet.IsSelected = false; + btnMeetIcon.IsSelected = false; + btnRead.IsSelected = false; + btnReadIcon.IsSelected = false; + if (function.GetAttrState(FunctionAttributeKey.CCT) == "2700") + { + btnCozy.IsSelected = true; + btnCozyIcon.IsSelected = true; + } + if (function.GetAttrState(FunctionAttributeKey.CCT) == "3000") + { + btnMeet.IsSelected = true; + btnMeetIcon.IsSelected = true; + } + if (function.GetAttrState(FunctionAttributeKey.CCT) == "6500") + { + btnRead.IsSelected = true; + btnReadIcon.IsSelected = true; + } } - + } + + /// <summary> + /// 宸﹀彸婊戝姩鐨勮繘搴︽潯鎺т欢 + /// </summary> + public class CCTSeekBarControl : DiyImageSeekBar + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 杩涘害鍊兼敼鍙�,濡傛灉瑕佽缃垵濮嬭繘搴﹀��,姝ゅ彉閲忚鍦ㄨ缃垵濮嬭繘搴﹀�间箣鍓嶈繘琛岃缃�(绗竴涓弬鏁�0:婊戝姩鐨勬椂鍊�,1:鎵嬫寚寮硅捣鐨勬椂鍊�) + /// </summary> + public Action<int, int> ProgressChangedEvent = null; + /// <summary> + /// 杩涘害鏉″彲鐢ㄦ椂鐨勮儗鏅壊 + /// </summary> + private uint ProgressBarEnableColor = 0; + /// <summary> + /// 杩涘害鏉′笉鍙敤鏃剁殑鑳屾櫙鑹�(榛樿鐏拌壊) + /// </summary> + public uint ProgressBarUnEnableColor = 0xffe8e8e8; + /// <summary> + /// 褰撳墠鍙敤鐘舵�� + /// </summary> + private bool nowEnable = true; + /// <summary> + /// 鎺т欢鑳藉惁浣跨敤 + /// </summary> + public new bool Enable + { + set + { + //鐘舵�佹病鏈夋敼鍙� + if (nowEnable == value) { return; } + nowEnable = value; + + this.IsClickable = value; + if (value == true) + { + //鍘熸潵鐨勯鑹� + base.ProgressBarColor = ProgressBarEnableColor; + } + else + { + //鐏拌壊 + base.ProgressBarColor = ProgressBarUnEnableColor; + } + } + } + + /// <summary> + /// 杩涘害鏉¢鑹� + /// </summary> + public new uint ProgressBarColor + { + set + { + ProgressBarEnableColor = value; + base.ProgressBarColor = value; + } + } + + private int m_SeekBarPadding = Application.GetRealWidth(20); + /// <summary> + /// 杩涘害鏉′笌宸﹀彸涓よ竟鐨勮竟妗嗙殑杈硅窛(閲嶅啓搴曞眰灞炴��) + /// </summary> + public new int SeekBarPadding + { + set + { + m_SeekBarPadding = value; + base.SeekBarPadding = value; + } + } + + private int m_MaxValue = 0; + /// <summary> + /// 杩涘害鏉℃渶澶у��(閲嶅啓搴曞眰灞炴��) + /// </summary> + public new int MaxValue + { + set + { + m_MaxValue = value; + base.MaxValue = value; + } + } + + private int m_MinValue = 0; + /// <summary> + /// 杩涘害鏉℃渶灏忓��(閲嶅啓搴曞眰灞炴��) + /// </summary> + public new int MinValue + { + set + { + m_MinValue = value; + base.MinValue = value; + } + } + /// <summary> + /// 涓婃柟鏄剧ず鐨勬枃鏈� + /// </summary> + private Button btnTopView = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + /// <summary> /// 宸﹀彸婊戝姩鐨勮繘搴︽潯鎺т欢 /// </summary> - private class SeekBarControl : DiyImageSeekBar - { - #region 鈻� 鍙橀噺澹版槑___________________________ - - /// <summary> - /// 杩涘害鍊兼敼鍙�,濡傛灉瑕佽缃垵濮嬭繘搴﹀��,姝ゅ彉閲忚鍦ㄨ缃垵濮嬭繘搴﹀�间箣鍓嶈繘琛岃缃�(绗竴涓弬鏁�0:婊戝姩鐨勬椂鍊�,1:鎵嬫寚寮硅捣鐨勬椂鍊�) - /// </summary> - public Action<int, int> ProgressChangedEvent = null; - /// <summary> - /// 杩涘害鏉″彲鐢ㄦ椂鐨勮儗鏅壊 - /// </summary> - private uint ProgressBarEnableColor = 0; - /// <summary> - /// 杩涘害鏉′笉鍙敤鏃剁殑鑳屾櫙鑹�(榛樿鐏拌壊) - /// </summary> - public uint ProgressBarUnEnableColor = 0xffe8e8e8; - /// <summary> - /// 褰撳墠鍙敤鐘舵�� - /// </summary> - private bool nowEnable = true; - /// <summary> - /// 鎺т欢鑳藉惁浣跨敤 - /// </summary> - public new bool Enable - { - set - { - //鐘舵�佹病鏈夋敼鍙� - if (nowEnable == value) { return; } - nowEnable = value; - - this.IsClickable = value; - if (value == true) - { - //鍘熸潵鐨勯鑹� - base.ProgressBarColor = ProgressBarEnableColor; - } - else - { - //鐏拌壊 - base.ProgressBarColor = ProgressBarUnEnableColor; - } - } - } - - /// <summary> - /// 杩涘害鏉¢鑹� - /// </summary> - public new uint ProgressBarColor - { - set - { - ProgressBarEnableColor = value; - base.ProgressBarColor = value; - } - } - - private int m_SeekBarPadding = Application.GetRealWidth(20); - /// <summary> - /// 杩涘害鏉′笌宸﹀彸涓よ竟鐨勮竟妗嗙殑杈硅窛(閲嶅啓搴曞眰灞炴��) - /// </summary> - public new int SeekBarPadding - { - set - { - m_SeekBarPadding = value; - base.SeekBarPadding = value; - } - } - - private int m_MaxValue = 0; - /// <summary> - /// 杩涘害鏉℃渶澶у��(閲嶅啓搴曞眰灞炴��) - /// </summary> - public new int MaxValue - { - set - { - m_MaxValue = value; - base.MaxValue = value; - } - } - - private int m_MinValue = 0; - /// <summary> - /// 杩涘害鏉℃渶灏忓��(閲嶅啓搴曞眰灞炴��) - /// </summary> - public new int MinValue - { - set - { - m_MinValue = value; - base.MinValue = value; - } - } - /// <summary> - /// 涓婃柟鏄剧ず鐨勬枃鏈� - /// </summary> - private Button btnTopView = null; - - #endregion - - #region 鈻� 鍒濆鍖朹____________________________ - - /// <summary> - /// 宸﹀彸婊戝姩鐨勮繘搴︽潯鎺т欢 - /// </summary> - /// <param name="i_width">瀹藉害,闈炵湡瀹炲��</param> - public SeekBarControl(int i_width = 210) - { - this.Width = Application.GetRealWidth(i_width); - this.Height = Application.GetRealHeight(54); - //鍦嗙悆鐨勫搴� - this.ThumbImageHeight = Application.GetRealHeight(54); - this.ThumbImagePath = "Public/ThumbImage.png"; - //杩涘害鏉$殑瀹藉害 - this.SeekBarViewHeight = Application.GetRealHeight(8); - //涓婃柟鏄惁鏄剧ず鏂囨湰 - this.IsProgressTextShow = false; - this.Gravity = Gravity.CenterHorizontal; - //杩涘害鏉¢鑹� - this.ProgressBarColor = CSS_Color.MainColor; - //宸﹀彸杈硅窛 - this.SeekBarPadding = Application.GetRealWidth(20); - - //杩涘害鏉″�兼敼鍙樹簨浠� - this.OnProgressChangedEvent += this.MyProgressChangedEvent; - //鎵嬫寚寮硅捣浜嬩欢 - this.OnStopTrackingTouchEvent += this.MyStopTrackingTouchEvent; - } - - #endregion - - #region 鈻� 浜嬩欢_______________________________ - - /// <summary> - /// 杩涘害鏉″�兼敼鍙樹簨浠� - /// </summary> - /// <param name="sender"></param> - /// <param name="value"></param> - private void MyProgressChangedEvent(object sender, int value) - { - if (this.ProgressChangedEvent == null) - { - this.OnProgressChangedEvent -= this.MyProgressChangedEvent; - return; - } - - this.ProgressChangedEvent(0, value); - } - - /// <summary> - /// 鎵嬫寚寮硅捣浜嬩欢 - /// </summary> - /// <param name="sender"></param> - /// <param name="value"></param> - private void MyStopTrackingTouchEvent(object sender, int value) - { - if (this.ProgressChangedEvent == null) - { - this.OnStopTrackingTouchEvent -= this.MyStopTrackingTouchEvent; - return; - } - //寮硅捣浜嬩欢涓嶉渶瑕佸垽鏂椂闂� - this.ProgressChangedEvent(1, value); - } - - #endregion - - #region 鈻� 鑷畾涔変笂鏂规樉绀烘枃鏈琠________________ - - /// <summary> - /// 鍦ㄤ笂鏂规樉绀鸿嚜瀹氫箟鏂囨湰 - /// </summary> - /// <param name="i_width">瀹藉害(鐪熷疄鍊�)</param> - /// <param name="textSize">鏂囧瓧澶у皬</param> - /// <param name="textColor">鏂囧瓧棰滆壊</param> - public void ShowCustomTextView(int i_width, int textSize, uint textColor) - { - if (this.btnTopView != null) { return; } - - int contrHeight = Application.GetRealHeight(24); - this.btnTopView = new Button(); - btnTopView.Width = i_width; - btnTopView.Height = contrHeight; - btnTopView.TextColor = textColor; - btnTopView.TextSize = textSize; - btnTopView.TextAlignment = TextAlignment.Center; - btnTopView.Y = this.Y - contrHeight + Application.GetRealHeight(20); - //鍒濆鍖栨椂,X杞村彲浠ヤ笉鐢ㄧ悊浼� - - this.Parent.AddChidren(btnTopView); - } - - /// <summary> - /// 璁剧疆鑷畾涔夋枃鏈俊鎭� - /// </summary> - /// <param name="i_text"></param> - public void SetCustomText(string i_text) - { - if (this.btnTopView == null) { return; } - - this.btnTopView.Text = i_text; - //婊戞潯鏈�宸﹁竟鐨勮窛绂� - int XX = this.X + this.m_SeekBarPadding; - //褰撳墠婊戞潯鎵�鍦ㄧ殑澶ц嚧鐧惧垎姣� - int tempValue = this.Progress - this.m_MinValue; - if (tempValue < 0) { tempValue = 0; } - decimal persent = (decimal)tempValue / (this.m_MaxValue - this.m_MinValue); - //褰撳墠婊戞潯鎵�鍦ㄧ殑澶ц嚧浣嶇疆 - XX += (int)((this.Width - this.m_SeekBarPadding * 2) * persent); - //鍥犱负瑕佸眳涓�,鎵�浠ュ噺鎺夎嚜瀹氫箟鎺т欢鐨勫搴︾殑涓�鑸� - XX = XX - this.btnTopView.Width / 2; - - this.btnTopView.X = XX; - } - - #endregion - - #region 鈻� 涓�鑸柟娉昣__________________________ - - /// <summary> - /// 鎺т欢鎽ф瘉 - /// </summary> - public override void RemoveFromParent() - { - this.ProgressChangedEvent = null; - base.RemoveFromParent(); - } - - #endregion + /// <param name="i_width">瀹藉害,闈炵湡瀹炲��</param> + public CCTSeekBarControl(int i_width = 210) + { + ProgressChangeDelayTime = 30; + this.Width = Application.GetRealWidth(i_width); + this.Height = Application.GetRealHeight(54); + //鍦嗙悆鐨勫搴� + this.ThumbImageHeight = Application.GetRealHeight(54); + this.ThumbImagePath = "Public/ThumbImage.png"; + //杩涘害鏉$殑瀹藉害 + this.SeekBarViewHeight = Application.GetRealHeight(8); + //涓婃柟鏄惁鏄剧ず鏂囨湰 + this.IsProgressTextShow = false; + this.Gravity = Gravity.CenterHorizontal; + //杩涘害鏉¢鑹� + this.ProgressBarColor = CSS_Color.MainColor; + //宸﹀彸杈硅窛 + this.SeekBarPadding = Application.GetRealWidth(20); + + //杩涘害鏉″�兼敼鍙樹簨浠� + this.OnProgressChangedEvent += this.MyProgressChangedEvent; + //鎵嬫寚寮硅捣浜嬩欢 + this.OnStopTrackingTouchEvent += this.MyStopTrackingTouchEvent; + } + + #endregion + + #region 鈻� 浜嬩欢_______________________________ + + /// <summary> + /// 杩涘害鏉″�兼敼鍙樹簨浠� + /// </summary> + /// <param name="sender"></param> + /// <param name="value"></param> + private void MyProgressChangedEvent(object sender, int value) + { + if (this.ProgressChangedEvent == null) + { + this.OnProgressChangedEvent -= this.MyProgressChangedEvent; + return; + } + this.ProgressChangedEvent(0, value); + } + + /// <summary> + /// 鎵嬫寚寮硅捣浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="value"></param> + private void MyStopTrackingTouchEvent(object sender, int value) + { + if (this.ProgressChangedEvent == null) + { + this.OnStopTrackingTouchEvent -= this.MyStopTrackingTouchEvent; + return; + } + //寮硅捣浜嬩欢涓嶉渶瑕佸垽鏂椂闂� + this.ProgressChangedEvent(1, value); + } + + #endregion + + #region 鈻� 鑷畾涔変笂鏂规樉绀烘枃鏈琠________________ + + /// <summary> + /// 鍦ㄤ笂鏂规樉绀鸿嚜瀹氫箟鏂囨湰 + /// </summary> + /// <param name="i_width">瀹藉害(鐪熷疄鍊�)</param> + /// <param name="textSize">鏂囧瓧澶у皬</param> + /// <param name="textColor">鏂囧瓧棰滆壊</param> + public void ShowCustomTextView(int i_width, int textSize, uint textColor) + { + if (this.btnTopView != null) { return; } + + int contrHeight = Application.GetRealHeight(24); + this.btnTopView = new Button(); + btnTopView.Width = i_width; + btnTopView.Height = contrHeight; + btnTopView.TextColor = textColor; + btnTopView.TextSize = textSize; + btnTopView.TextAlignment = TextAlignment.Center; + btnTopView.Y = this.Y - contrHeight + Application.GetRealHeight(20); + //鍒濆鍖栨椂,X杞村彲浠ヤ笉鐢ㄧ悊浼� + + this.Parent.AddChidren(btnTopView); + } + + /// <summary> + /// 璁剧疆鑷畾涔夋枃鏈俊鎭� + /// </summary> + /// <param name="i_text"></param> + public void SetCustomText(string i_text) + { + if (this.btnTopView == null) { return; } + + this.btnTopView.Text = i_text; + //婊戞潯鏈�宸﹁竟鐨勮窛绂� + int XX = this.X + this.m_SeekBarPadding; + //褰撳墠婊戞潯鎵�鍦ㄧ殑澶ц嚧鐧惧垎姣� + int tempValue = this.Progress - this.m_MinValue; + if (tempValue < 0) { tempValue = 0; } + decimal persent = (decimal)tempValue / (this.m_MaxValue - this.m_MinValue); + //褰撳墠婊戞潯鎵�鍦ㄧ殑澶ц嚧浣嶇疆 + XX += (int)((this.Width - this.m_SeekBarPadding * 2) * persent); + //鍥犱负瑕佸眳涓�,鎵�浠ュ噺鎺夎嚜瀹氫箟鎺т欢鐨勫搴︾殑涓�鑸� + XX = XX - this.btnTopView.Width / 2; + + this.btnTopView.X = XX; } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鎺т欢鎽ф瘉 + /// </summary> + public override void RemoveFromParent() + { + this.ProgressChangedEvent = null; + base.RemoveFromParent(); + } + + #endregion } -} +} \ No newline at end of file -- Gitblit v1.8.0