From c157f5a31db9878bfa4f0481378cbfc927e34074 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 23 八月 2023 10:04:03 +0800
Subject: [PATCH] 1
---
HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs | 239 +++++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 164 insertions(+), 75 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..8269b50 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
@@ -1,7 +1,5 @@
锘縰sing System;
using System.Collections.Generic;
-using HDL_ON.Common;
-using HDL_ON.DriverLayer;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
@@ -33,8 +31,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 +98,7 @@
//};
+
//鍥為��鍒锋柊淇℃伅浜嬩欢
new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)).LoadTopView_SettingIcon( () => {
@@ -104,9 +110,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,46 +197,50 @@
}
//灞炴�ц缃尯鍩�
- 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()
+ var btnOn = new Button()
{
- Gravity = Gravity.CenterHorizontal,
+ X = Application.GetRealWidth(100),
+ Y = Application.GetRealHeight(466),
+ Width = Application.GetMinRealAverage(32),
+ Height = Application.GetMinRealAverage(32),
+ //UnSelectedImagePath = "Public/PowerClose.png",
+ UnSelectedImagePath = "Public/PowerOpen.png",
+ };
+ controlView.AddChidren(btnOn);
+
+ var btnOff = new Button()
+ {
+ X = Application.GetRealWidth(180),
Y = Application.GetRealHeight(466),
Width = Application.GetMinRealAverage(32),
Height = Application.GetMinRealAverage(32),
UnSelectedImagePath = "Public/PowerClose.png",
- SelectedImagePath = "Public/PowerOpen.png",
+ //UnSelectedImagePath = "Public/PowerOpen.png",
};
- controlView.AddChidren(btnSwitch);
- btnSwitch.MouseUpEventHandler = (sender, e) => {
- if (btnSwitch.IsSelected)
- {
- btnSwitch.IsSelected = false;
- var d = new Dictionary<string, string>();
- d.Add(FunctionAttributeKey.OnOff, "off");
- function.Control(d);
- }
- else
- {
- btnSwitch.IsSelected = true;
- var d = new Dictionary<string, string>();
- d.Add(FunctionAttributeKey.OnOff, "on");
- function.Control(d);
- }
+ controlView.AddChidren(btnOff);
+ btnOn.MouseUpEventHandler = (sender, e) =>
+ {
+ var d = new Dictionary<string, string>();
+ d.Add(FunctionAttributeKey.OnOff, "on");
+ function.Control(d);
};
+ btnOff.MouseUpEventHandler = (sender, e) =>
+ {
+ var d = new Dictionary<string, string>();
+ d.Add(FunctionAttributeKey.OnOff, "off");
+ function.Control(d);
+ };
if (hadRGB)
@@ -250,30 +273,23 @@
btnSwitchIcon.MouseUpEventHandler = (sender, e) => {
if (btnSwitchIcon.IsSelected)
{
- btnSwitchIcon.IsSelected = btnSwitch.IsSelected = false;
var d = new Dictionary<string, string>();
d.Add(FunctionAttributeKey.OnOff, "off");
function.Control(d);
}
else
{
- btnSwitchIcon.IsSelected = btnSwitch.IsSelected = true;
var d = new Dictionary<string, string>();
d.Add(FunctionAttributeKey.OnOff, "on");
function.Control(d);
}
- };
- btnSwitch.MouseUpEventHandler += (sender, e) => {
- btnSwitchIcon.IsSelected = btnSwitch.IsSelected;
};
}
-
}
- Button btnSwitch;
/// <summary>
/// 鍔犺浇璋冨厜灞炴�ц缃帶浠�
@@ -321,23 +337,32 @@
};
dimmerView.AddChidren(btnBrightnessText);
+ dimmerBar.OnStopTrackingTouchEvent = (sender, e) => {
+ new System.Threading.Thread(() =>
+ {
+ var d = new Dictionary<string, string>();
+ d.Add(FunctionAttributeKey.Brightness, e.ToString());
+ function.Control(d);
+ })
+ { IsBackground = true }.Start();
+ };
+
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());
+ d.Add(FunctionAttributeKey.OnOff, e == 0 ? "off" : "on");
function.Control(d);
}
else
@@ -358,17 +383,6 @@
btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
btnBrightnessText.Text = dimmerBar.Progress + "%";
- };
-
- btnSwitch.MouseUpEventHandler += (sender, e) => {
- if (btnSwitch.IsSelected)
- {
- dimmerBar.Progress = 100;
- }
- else
- {
- dimmerBar.Progress = 0;
- }
};
}
@@ -417,24 +431,33 @@
};
dimmerView.AddChidren(btnBrightnessText);
+ dimmerBar.OnStopTrackingTouchEvent = (sender, e) => {
+ new System.Threading.Thread(() =>
+ {
+ var d = new Dictionary<string, string>();
+ d.Add(FunctionAttributeKey.Brightness, e.ToString());
+ function.Control(d);
+ })
+ { IsBackground = true }.Start();
+ };
+
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());
+ d.Add(FunctionAttributeKey.OnOff, e == 0 ? "off" : "on");
function.Control(d);
}
else
@@ -457,17 +480,7 @@
btnBrightnessText.Text = dimmerBar.Progress + "%";
};
- btnSwitch.MouseUpEventHandler += (sender, e) => {
- if (btnSwitch.IsSelected)
- {
- dimmerBar.Progress = 100;
- }
- else
- {
- dimmerBar.Progress = 0;
- }
- };
-
+
//attrView.AddChidren(new Button() { Height = Application.GetRealHeight(10) });
#region 鑹叉俯
@@ -646,7 +659,22 @@
};
colorPicker.ColorChaged += (sender2, e2) =>
{
+ if ( pointIsRight == false)
+ {
+ return;
+ }
+ //if (colorPicker.ColorImagePath == "FunctionIcon/Light/ColorWheelGray.png")
+ //{
+ // return;
+ //}
+ if (function.refreshTime.AddMilliseconds(350) > DateTime.Now)
+ {
+ MainPage.Log("棰戠箒鎺у埗锛岄��鍑�");
+ return;
+ }
+ function.refreshTime = DateTime.Now;
rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString();
+
btnCurColor.BackgroundColor = (uint)(0xFF000000 + rgbTemp.GetRGBcolor(rgbString));
var d = new Dictionary<string, string>();
d.Add(FunctionAttributeKey.RGB, rgbString);
@@ -657,9 +685,13 @@
pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y);
if (pointIsRight == false)
{
- //鐐圭殑鍖哄煙涓嶆槸鍦嗙洏鍐�
+ //pointIsRight:鐐圭殑鍖哄煙涓嶆槸鍦嗙洏鍐�
return;
}
+ //if (colorPicker.ColorImagePath == "FunctionIcon/Light/ColorWheelGray.png")
+ //{
+ // return;
+ //}
//鏄剧ず鐧界偣
btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2;
btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2;
@@ -674,8 +706,6 @@
//褰撻紶鏍囩偣涓嬩簨浠跺鐞�
colorPicker.MouseDownEventHandler(sender, e);
};
-
-
#region 浜害璋冭妭
var btnBrightnessText = new Button()
@@ -722,6 +752,66 @@
};
controlView.AddChidren(dimmerBar);
+ dimmerBar.OnStopTrackingTouchEvent = (sender, e) => {
+ new System.Threading.Thread(() =>
+ {
+ var d = new Dictionary<string, string>();
+ d.Add(FunctionAttributeKey.Brightness, e.ToString());
+ function.Control(d);
+ })
+ { IsBackground = true }.Start();
+ };
+
+ dimmerBar.OnProgressChangedEvent = (sender, e) =>
+ {
+ if (e == 0 && lastBrightness != 0)
+ {
+ lastBrightness = 0;
+ }
+ else
+ {
+ if (lastBrightness == 0)
+ lastBrightness = e;
+ }
+ if (e == 0 || e == 100)
+ {
+ var d = new Dictionary<string, string>();
+ d.Add(FunctionAttributeKey.Brightness, e.ToString());
+ d.Add(FunctionAttributeKey.OnOff, e == 0 ? "off" : "on");
+ 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();
+ }
+ }
+ //if (e == 0)
+ //{
+ // if (colorPicker.ColorImagePath != "FunctionIcon/Light/ColorWheelGray.png")
+ // {
+ // colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png";
+ // }
+ //}
+ //else
+ //{
+ // if (colorPicker.ColorImagePath != "FunctionIcon/Light/ColorWheel.png")
+ // {
+ // colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheel.png";
+ // }
+ //}
+ };
+
+
+
var btnMaxValuesText = new Button()
{
X = dimmerBar.Right,
@@ -734,6 +824,7 @@
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
};
controlView.AddChidren(btnMaxValuesText);
+
#endregion
int heightMore = 375 - magriHeight-20;
@@ -799,6 +890,7 @@
};
barColorTemplatrue.MinValue = 27;
barColorTemplatrue.MaxValue = 65;
+ barColorTemplatrue.Progress = 38;
barColorTemplatrue.ProgressBarColor = 0x00000000;//鍏ㄩ儴閫忔槑
barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000;
barColorTemplatrue.SeekBarBackgroundColor = 0x00000000;
@@ -822,7 +914,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";
@@ -833,9 +925,7 @@
#endregion
-
heightMore = 70;
-
}
if (hadColorful)
@@ -845,7 +935,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 +964,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 +996,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)
{
@@ -916,8 +1007,6 @@
};
#endregion
-
-
}
--
Gitblit v1.8.0