From a1b0ab7044100daaa7e0f1da2d2ca45e38098963 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 29 三月 2021 09:13:25 +0800
Subject: [PATCH] 2021-3-29-2
---
HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs | 55 ++++++++++++++++++++++++++++++++++---------------------
1 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
index e6e56cb..1c22cb3 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
@@ -40,7 +40,7 @@
{
if (btn.Tag.ToString() == upfunc.sid + "_DimmerBar")
{
- //btn.Progress = (upfunc as Light).trait_brightness.value.value.ToString() == "on";
+ btn.Progress = Convert.ToInt32(upfunc.GetAttrState(FunctionAttributeKey.Brightness));
}
}
}
@@ -109,10 +109,8 @@
{
if (function.Spk_Prefix == FunctionCategory.Light)
{
- var light = function as Light;
- light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
- //Control.Send(CommandType_A.write, function);
- System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+ function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
+ Dictionary<string, string> d = new Dictionary<string, string>();
d.Add("on_off", function.trait_on_off.curValue.ToString());
Control.Ins.SendWriteCommand(function, d);
}
@@ -128,7 +126,6 @@
{
if(function.spk == SPK.LightDimming || function.spk == SPK.LightRGB)
{
- var light = function as Light;
dimmerControlBar.OnStartTrackingTouchEvent = (sender, e) => {
onDimmerBar = true;
(bodyDiv.Parent as VerticalScrolViewLayout).ScrollEnabled = false;
@@ -136,10 +133,10 @@
dimmerControlBar.OnStopTrackingTouchEvent = (sender, e) => {
onDimmerBar = false;
(bodyDiv.Parent as VerticalScrolViewLayout).ScrollEnabled = true;
- light.brightness = dimmerControlBar.Progress;
- System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("brightness", light.brightness.ToString());
- Control.Ins.SendWriteCommand(light, d);
+ function.SetAttrState(FunctionAttributeKey.Brightness, dimmerControlBar.Progress.ToString());
+ Dictionary<string, string> d = new Dictionary<string, string>();
+ d.Add(FunctionAttributeKey.Brightness, dimmerControlBar.Progress.ToString());
+ Control.Ins.SendWriteCommand(function, d);
};
dimmerControlBar.OnProgressChangedEvent = (sender, e) => {
dimmerControlBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1;
@@ -183,7 +180,7 @@
/// <param name="btnStop"></param>
/// <param name="btnOpen"></param>
/// <param name="btnClose"></param>
- void LoadEvent_ControlCurtain(Button btnStop, Button btnOpen, Button btnClose, Curtain curtain)
+ void LoadEvent_ControlCurtain(Button btnStop, Button btnOpen, Button btnClose, Function curtain)
{
btnClose.MouseUpEventHandler = (sender, e) =>
{
@@ -191,9 +188,9 @@
btnStop.IsSelected = false;
btnOpen.IsSelected = false;
curtain.trait_on_off.curValue = "off";
- curtain.percent = 0;
- System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("on_off", curtain.trait_on_off.curValue.ToString());
+ curtain.SetAttrState(FunctionAttributeKey.Percent, 0);
+ Dictionary<string, string> d = new Dictionary<string, string>();
+ d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
Control.Ins.SendWriteCommand(curtain, d);
};
@@ -203,8 +200,8 @@
btnClose.IsSelected = false;
btnOpen.IsSelected = false;
curtain.trait_on_off.curValue = "stop";
- System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("on_off", curtain.trait_on_off.curValue.ToString());
+ Dictionary<string, string> d = new Dictionary<string, string>();
+ d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
Control.Ins.SendWriteCommand(curtain, d);
};
@@ -214,9 +211,9 @@
btnClose.IsSelected = false;
btnStop.IsSelected = false;
curtain.trait_on_off.curValue = "on";
- curtain.percent = 100;
- System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("on_off", curtain.trait_on_off.curValue.ToString());
+ curtain.SetAttrState(FunctionAttributeKey.Percent, 100);
+ Dictionary<string, string> d = new Dictionary<string, string>();
+ d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
Control.Ins.SendWriteCommand(curtain, d);
};
}
@@ -234,7 +231,15 @@
};
btnUp.MouseUpEventHandler = (sender, e) =>
{
- btnUp.IsSelected = false;
+ new System.Threading.Thread(() =>
+ {
+ System.Threading.Thread.Sleep(2000);
+ Application.RunOnMainThread(() =>
+ {
+ btnUp.IsSelected = false;
+ });
+ })
+ { IsBackground = true }.Start();
function.SetAttrState(FunctionAttributeKey.Position, "up");
Dictionary<string, string> d = new Dictionary<string, string>();
d.Add(FunctionAttributeKey.Position, "up");
@@ -247,7 +252,15 @@
};
btnDown.MouseUpEventHandler = (sender, e) =>
{
- btnDown.IsSelected = false;
+ new System.Threading.Thread(() =>
+ {
+ System.Threading.Thread.Sleep(2000);
+ Application.RunOnMainThread(() =>
+ {
+ btnDown.IsSelected = false;
+ });
+ })
+ { IsBackground = true }.Start();
function.SetAttrState(FunctionAttributeKey.Position, "down");
Dictionary<string, string> d = new Dictionary<string, string>();
d.Add(FunctionAttributeKey.Position, "down");
--
Gitblit v1.8.0