From 84e76cf2fcbe26142750131d3c27eaac0335e40a Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 11 三月 2021 11:04:08 +0800
Subject: [PATCH] 上传一个添加红外宝 Ios 版本
---
HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs | 130 ++++++++++++++++++++++++++-----------------
1 files changed, 78 insertions(+), 52 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
index d973bd2..03b6752 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
@@ -12,37 +12,43 @@
/// </summary>
public static void UpdataStates(Light uFunction)
{
- Application.RunOnMainThread(() =>
+ Application.RunOnMainThread((Action)(() =>
{
try
{
if (bodyView == null)
return;
- if (uFunction.functionType == bodyView.light.functionType && uFunction.sid == bodyView.light.sid)
+ if (uFunction.spk == bodyView.light.spk && uFunction.sid == bodyView.light.sid)
{
-
if (uFunction.trait_on_off.curValue.ToString() == "on")
{
bodyView.dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
if (!bodyView.onDimmerBar)
{
bodyView.dimmerBar.Progress = uFunction.brightness;
- }
- bodyView.btnBrightnessText.Text = uFunction.brightness + "%";
- bodyView.btnBrightnessText.Y = ((100 - uFunction.brightness) * Application.GetRealHeight(222 - 16 - 16) / 100) + Application.GetRealWidth(40);
+ }
+ bodyView.btnBrightnessText.Text = uFunction.brightness + "%";
+ bodyView.btnBrightnessText.Y = ((100 - uFunction.brightness) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80);
}
else
{
bodyView.dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor);
}
bodyView.btnSwitch.IsSelected = uFunction.trait_on_off.curValue.ToString() == "on";
+ bodyView.barColorTemplatrue.Enable = uFunction.trait_on_off.curValue.ToString() == "on";
+ var cct = 27;
+ int.TryParse(uFunction.Attr_CCT.curValue.ToString(), out cct);
+ bodyView.barColorTemplatrue.Progress = cct / 100;
+ //璁剧疆鍒濆鍊�
+ bodyView.barColorTemplatrue.SetCustomText(bodyView.barColorTemplatrue.Progress * 100 + "K");
+
}
}
catch (Exception ex)
{
MainPage.Log($"{bodyView.GetType().Name } UpdataStates error : {ex.Message}");
}
- });
+ }));
}
void LoadEventList()
@@ -64,11 +70,11 @@
/// </summary>
void LoadEvet_ChangeFadeTime()
{
- barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
- {
- light.fadeTime = e;
- light.SaveFunctionData(true);
- };
+ //barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
+ //{
+ // light.fadeTime = e;
+ // light.SaveFunctionData(true);
+ //};
}
/// <summary>
@@ -85,13 +91,22 @@
//璁剧疆鑷畾涔夌殑鏂囨湰
barColorTemplatrue.SetCustomText(value * 100 + "K");
light.Attr_CCT.curValue = value * 100;
- System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
- Control.Ins.SendWriteCommand(light, d);
+ //System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+ //d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
+ //Control.Ins.SendWriteCommand(light, d);
});
- System.Threading.Thread.Sleep(200);
+ //System.Threading.Thread.Sleep(200);
}).Start();
+ };
+
+ barColorTemplatrue.OnStopTrackingTouchEvent = (sender, value) =>
+ {
+ light.Attr_CCT.curValue = value * 100;
+ System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+ d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
+ Control.Ins.SendWriteCommand(light, d);
};
+
}
/// <summary>
@@ -101,7 +116,7 @@
{
btnCollection.MouseUpEventHandler += (sender, e) => {
btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
- light.SaveFunctionData(true);
+ light.CollectFunction();
};
}
@@ -113,49 +128,59 @@
dimmerBar.OnStartTrackingTouchEvent = (sender, e) => {
onDimmerBar = true;
};
- dimmerBar.OnStopTrackingTouchEvent = (sender, e) => {
+ dimmerBar.OnStopTrackingTouchEvent = (sender, e) =>
+ {
onDimmerBar = false;
light.brightness = dimmerBar.Progress;
- //Control.Send(CommandType_A.write, light);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
Control.Ins.SendWriteCommand(light, d);
- light.fadeTime = barFadeTime.Progress;
+ //light.fadeTime = barFadeTime.Progress;
+ btnBrightnessText.Text = dimmerBar.Progress + "%";
+
+ dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
};
- dimmerBar.OnProgressChangedEvent = (sender, e) => {
- light.fadeTime = 0;
- if (!btnSwitch.IsSelected)
- {
- dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
- }
- btnSwitch.IsSelected = e > 0 ? true : false;
- light.brightness = e;
- light.trait_on_off.curValue = e > 0 ? "on" : "off";
+ dimmerBar.OnProgressChangedEvent = (sender, e) =>
+ {
+ dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
+ //light.fadeTime = 0;
+ //if (!btnSwitch.IsSelected)
+ //{
+ // dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
+ //}
+ //btnSwitch.IsSelected = e > 0 ? true : false;
+ //light.brightness = e;
+ //light.trait_on_off.curValue = e > 0 ? "on" : "off";
- if (e == 0 || e == 100)
- {
- System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
- Control.Ins.SendWriteCommand(light, d);
- }
- else
- {
- if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds)
- {
- light.refreshTime = DateTime.Now;
- new System.Threading.Thread(() =>
- {
- System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
- Control.Ins.SendWriteCommand(light, d);
- })
- { IsBackground = true }.Start();
- }
- }
+ //if (e == 0 || e == 100)
+ //{
+ // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+ // d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
+ // Control.Ins.SendWriteCommand(light, d);
+ //}
+ //else
+ //{
+ // if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds)
+ // {
+ // light.refreshTime = DateTime.Now;
+ // new System.Threading.Thread(() =>
+ // {
+ // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+ // d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
+ // Control.Ins.SendWriteCommand(light, d);
+ // })
+ // { IsBackground = true }.Start();
+ // }
+ //}
- btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16 - 16) / 100) + Application.GetRealWidth(40);
- btnBrightnessText.Text = light.brightness + "%";
+ //btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16 - 16) / 100) + Application.GetRealWidth(40);
+ //btnBrightnessText.Text = light.brightness + "%";
+
+ btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80);
+ btnBrightnessText.Text = dimmerBar.Progress + "%";
};
+
+
}
/// <summary>
@@ -165,7 +190,7 @@
{
btnSwitch.MouseUpEventHandler += (sender, e) =>
{
- light.fadeTime = barFadeTime.Progress;
+ //light.fadeTime = barFadeTime.Progress;
btnSwitch.IsSelected = !btnSwitch.IsSelected;
if (btnSwitch.IsSelected)
{
@@ -180,6 +205,7 @@
light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString());
+ d.Add(FunctionAttributeKey.FadeTime, light.fadeTime.ToString());
if (btnSwitch.IsSelected)
{
d.Add(FunctionAttributeKey.Brightness, light.lastBrightness.ToString());
--
Gitblit v1.8.0