From 441cf789e035bac39b8e38672b54ac99c1bc31fb Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 03 八月 2023 15:20:53 +0800
Subject: [PATCH] 色温灯调光条
---
HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs | 102 +++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 86 insertions(+), 16 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
index b71e0c6..b05731e 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
@@ -33,8 +33,15 @@
}
}
+ public override void RemoveFromParent()
+ {
+ base.RemoveFromParent();
+ }
+
public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
{
+ bodyView.RemoveAll();
+
btnCollection_Out = btnCollectionIcon;
btnFunctionName_Out = btnFunctionNameOut;
btnFromFloor_Out = btnFromFloorOut;
@@ -93,6 +100,7 @@
//};
+
//鍥為��鍒锋柊淇℃伅浜嬩欢
new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)).LoadTopView_SettingIcon( () => {
@@ -104,9 +112,22 @@
{
if (newGC != null)
{
- btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
- function.roomIds = newGC.uids;
- btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = newGC.GetUidListName();
+ var localTemp = FunctionList.List.groupControls.Find((obj) => obj.deviceId == newGC.deviceId);
+ if(localTemp!= null)
+ {
+ try
+ {
+ localTemp.sids = newGC.sids;
+ localTemp.name = newGC.name;
+ localTemp.roomIds = newGC.roomIds;
+ localTemp.uids = newGC.uids;
+ }
+ catch { }
+ function = newGC;
+ btnFunctionName_Out.Text = function.name;
+ btnFromFloor_Out.Text = function.GetRoomListName();
+ LoadPage(btnCollection, btnFunctionName, btnFunctionName);
+ }
}
});
}
@@ -178,17 +199,14 @@
}
//灞炴�ц缃尯鍩�
- var attrView = new VerticalScrolViewLayout()
+ VerticalScrolViewLayout attrView = new VerticalScrolViewLayout()
{
Y = Application.GetRealHeight(52),
Width = Application.GetRealWidth(343),
ScrollEnabled = false,
};
- //灞炴�ц缃尯鍩熼珮搴�
- int attrViewHight = Application.GetRealHeight(18 + 22);
-
-
controlView.AddChidren(attrView);
+
attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
btnSwitch = new Button()
@@ -217,7 +235,6 @@
function.Control(d);
}
};
-
if (hadRGB)
@@ -267,7 +284,6 @@
btnSwitchIcon.IsSelected = btnSwitch.IsSelected;
};
}
-
@@ -369,6 +385,8 @@
{
dimmerBar.Progress = 0;
}
+ btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
+ btnBrightnessText.Text = dimmerBar.Progress + "%";
};
}
@@ -466,6 +484,8 @@
{
dimmerBar.Progress = 0;
}
+ btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
+ btnBrightnessText.Text = dimmerBar.Progress + "%";
};
//attrView.AddChidren(new Button() { Height = Application.GetRealHeight(10) });
@@ -722,6 +742,43 @@
};
controlView.AddChidren(dimmerBar);
+
+ dimmerBar.OnProgressChangedEvent = (sender, e) =>
+ {
+ if (e == 0 && lastBrightness != 0)
+ {
+ btnSwitch.IsSelected = false;
+ lastBrightness = 0;
+ }
+ else
+ {
+ if (lastBrightness == 0)
+ lastBrightness = e;
+ btnSwitch.IsSelected = true;
+ }
+ if (e == 0 || e == 100)
+ {
+ var d = new Dictionary<string, string>();
+ d.Add(FunctionAttributeKey.Brightness, e.ToString());
+ function.Control(d);
+ }
+ else
+ {
+ if (350 < (DateTime.Now - function.refreshTime).TotalMilliseconds)
+ {
+ function.refreshTime = DateTime.Now;
+ new System.Threading.Thread(() =>
+ {
+ var d = new Dictionary<string, string>();
+ d.Add(FunctionAttributeKey.Brightness, e.ToString());
+ function.Control(d);
+ })
+ { IsBackground = true }.Start();
+ }
+ }
+ };
+
+
var btnMaxValuesText = new Button()
{
X = dimmerBar.Right,
@@ -734,6 +791,17 @@
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
};
controlView.AddChidren(btnMaxValuesText);
+
+ btnSwitch.MouseUpEventHandler += (sender, e) => {
+ if (btnSwitch.IsSelected)
+ {
+ dimmerBar.Progress = 100;
+ }
+ else
+ {
+ dimmerBar.Progress = 0;
+ }
+ };
#endregion
int heightMore = 375 - magriHeight-20;
@@ -799,6 +867,7 @@
};
barColorTemplatrue.MinValue = 27;
barColorTemplatrue.MaxValue = 65;
+ barColorTemplatrue.Progress = 38;
barColorTemplatrue.ProgressBarColor = 0x00000000;//鍏ㄩ儴閫忔槑
barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000;
barColorTemplatrue.SeekBarBackgroundColor = 0x00000000;
@@ -822,7 +891,7 @@
//6500K
var btnTempClolorMax = new Button();
btnTempClolorMax.Y = btnTempClolorMin.Y;
- btnTempClolorMax.X = barColorTemplatrue.Right - Application.GetRealWidth(30);
+ btnTempClolorMax.X = barColorTemplatrue.Right - Application.GetRealWidth(15);
btnTempClolorMax.Width = Application.GetRealWidth(54);
btnTempClolorMax.Height = Application.GetRealHeight(21);
btnTempClolorMax.Text = "6500K";
@@ -845,7 +914,7 @@
var btnGradualChangeText = new Button()
{
X = Application.GetRealWidth(35),
- Y = Application.GetRealHeight(375 + heightMore - magriHeight),
+ Y = hadCCT ? Application.GetRealHeight(375 + heightMore - magriHeight) : Application.GetRealHeight(heightMore+10),
Width = Application.GetRealWidth(224),
Height = Application.GetRealHeight(21),
TextAlignment = TextAlignment.CenterLeft,
@@ -874,9 +943,11 @@
var barColorful = new FrameLayout()
{
- X = btnColorfulEdit.Right + Application.GetRealWidth(15+5),
- Y = Application.GetRealHeight(412 + heightMore - magriHeight),
+ X = btnColorfulEdit.Right + Application.GetRealWidth(15 + 5),
Width = Application.GetRealWidth(170),
+ //X = Application.GetRealWidth(35),
+ //Width = Application.GetRealWidth(170 + 41),
+ Y = hadCCT ? Application.GetRealHeight(412 + heightMore - magriHeight) : Application.GetRealHeight(heightMore + 50),
Height = Application.GetRealHeight(8),
BackgroundImagePath = "FunctionIcon/Light/ColorfulBar.png",
};
@@ -904,8 +975,7 @@
function.SetAttrState(FunctionAttributeKey.Colorful, controlColorfulState);
var d = new Dictionary<string, string>();
d.Add(FunctionAttributeKey.Colorful, controlColorfulState);
-
- Control.Ins.SendWriteCommand(function, d);
+ function.Control(d);
}
catch (Exception ex)
{
--
Gitblit v1.8.0