From 4ad6d53e2a8dc59d99405a053ddc46f49ae7a1b3 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期四, 14 十月 2021 11:55:51 +0800
Subject: [PATCH] 干接点新spk 兼容问题
---
HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs | 493 ++++++++++++++++++++++++++++--------------------------
1 files changed, 252 insertions(+), 241 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
index c0e7a94..2c3be59 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>
@@ -162,7 +162,7 @@
btnBrightnessText = new Button()
{
Gravity = Gravity.CenterHorizontal,
- Y = ((100 - Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.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",
@@ -173,10 +173,20 @@
controlView.AddChidren(btnBrightnessText);
#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 +60);
+ btnTempClolor.Y = Application.GetRealHeight(306 + 60);
btnTempClolor.Width = Application.GetRealWidth(224);
btnTempClolor.Height = Application.GetRealHeight(21);
btnTempClolor.TextAlignment = TextAlignment.CenterLeft;
@@ -185,12 +195,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;
@@ -205,11 +216,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;
@@ -232,7 +243,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;
@@ -537,241 +548,241 @@
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