From 2029e64ec0491f7e511dc15bffaf821bfbabe2de Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 20 七月 2020 14:10:22 +0800
Subject: [PATCH] 上传一个很特别的新版本
---
ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs | 196 +++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 172 insertions(+), 24 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs
index dc81c80..e81a59c 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs
@@ -12,7 +12,6 @@
/// 鍒楄〃鎺т欢
/// </summary>
private VerticalScrolViewLayout listview = null;
-
/// <summary>
/// 闈㈡澘鐨勫洖璺�
/// </summary>
@@ -33,6 +32,28 @@
/// 鎸夐敭鐨勯鑹叉暟鎹�
/// </summary>
private Panel.KeyColorData keyColorData = null;
+ /// <summary>
+ /// 閫夋嫨鐫$湢鏃堕棿鐨勪簨浠� value:绱㈠紩(浠�0寮�濮�) 鏂囨湰淇℃伅璇风敤Text鑾峰彇
+ /// </summary>
+ public Action<int> timeAction = null;
+ /// <summary>
+ /// 褰撳墠閫夋嫨鐨勫姛鑳界被鍨嬬储寮�
+ /// </summary>
+ private int nowSelectNo = 0;
+ /// <summary>
+ /// /// <summary>
+ /// 鐫$湢鏃堕棿鐨勫��
+ /// </summary>
+ /// </summary>
+ public string sleepTimeText
+ {
+ get { return btnSleepTime.Text; }
+ set { btnSleepTime.Text = value; }
+ }
+ /// <summary>
+ ///鐫$湢鏃堕棿
+ /// </summary>
+ public NormalViewControl btnSleepTime = null;
#endregion
@@ -109,7 +130,7 @@
/// <param name="frameLinght">鍚勭鑳屽厜鐏殑瀹瑰櫒(鎺т欢浼哥缉浣跨敤)</param>
private void AddEnergyConservationRow()
{
- //缂╁皬:170 鎵╁ぇ:429
+ //缂╁皬:170 鎵╁ぇ:614
var frameBack = new FrameRowControl();
frameBack.BackgroundColor = UserCenterColor.Current.White;
frameBack.UseClickStatu = false;
@@ -125,7 +146,7 @@
btnSwitch.IsSelected = !btnSwitch.IsSelected;
energyModeInfo.enable = btnSwitch.IsSelected;
//灞曞紑鎴栬�呯缉灏忕殑楂樺害
- var value = Application.GetRealHeight(443);
+ var value = Application.GetRealHeight(614);
if (btnSwitch.IsSelected == true)
{
frameBack.Height += value;
@@ -191,12 +212,23 @@
if (energyModeInfo.enable == true)
{
//灞曞紑鎴栬�呯缉灏忕殑楂樺害
- var value = Application.GetRealHeight(443);
+ var value = Application.GetRealHeight(614);
frameBack.Height += value;
}
//娣诲姞鎺ヨ繎鎰熷簲
this.AddProximitySensorsRow(frameBack);
+
+ //搴曠嚎
+ var btnLine = new NormalViewControl(965, 5, true);
+ btnLine.Height = 1;
+ btnLine.X = Application.GetRealWidth(52);
+ btnLine.Y = Application.GetRealHeight(484 + 127);
+ btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
+ frameBack.AddChidren(btnLine);
+
+ //娣诲姞鐫$湢鏃堕棿
+ this.AddSleepTimeRow(frameBack);
}
#endregion
@@ -230,6 +262,100 @@
{
btnSwitch.IsSelected = true;
}
+ }
+ #endregion
+
+ #region 鈻� 鐫$湢鏃堕棿___________________________
+
+ /// <summary>
+ /// 鐫$湢鏃堕棿琛�
+ /// </summary>
+ private void AddSleepTimeRow(FrameRowControl frameRowControl)
+ {
+ //鐫$湢鏃堕棿琛�
+ var frameBack = new FrameRowControl();
+ frameBack.BackgroundColor = UserCenterColor.Current.White;
+ frameBack.UseClickStatu = false;
+ frameBack.Y = Application.GetRealHeight(784 - 170);
+ frameBack.Height = Application.GetRealHeight(170);
+ frameRowControl.AddChidren(frameBack);
+
+ //鐫$湢鏃堕棿
+ frameBack.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.SleepTime), 400);
+ //鍙崇澶�
+ frameBack.AddRightArrow();
+ btnSleepTime = new NormalViewControl(700, true);
+ switch (energyModeInfo.time)
+ {
+ case 15:
+ btnSleepTime.Text = "15s";
+ nowSelectNo = 0;
+ break;
+ case 60:
+ btnSleepTime.Text = "1min";
+ nowSelectNo = 1;
+ break;
+ case 300:
+ btnSleepTime.Text = "5min";
+ nowSelectNo = 2;
+ break;
+ }
+ frameBack.AddMostRightView(this.sleepTimeText, 700);
+
+ timeAction = null;
+ timeAction += (nowSelectNo) =>
+ {
+ switch (nowSelectNo)
+ {
+ case 0:
+ energyModeInfo.time = 15;
+ break;
+ case 1:
+ energyModeInfo.time = 60;
+ break;
+ case 2:
+ energyModeInfo.time = 300;
+ break;
+ }
+ AddSleepTimeRow(frameRowControl);
+ };
+ frameBack.ButtonClickEvent += (sender, e) =>
+ {
+ this.ShowSelectDeviceSleepTimeListForm();
+ };
+ }
+ #endregion
+
+ #region 鈻� 鏄剧ず閫夋嫨璁惧鐫$湢鏃堕棿_______________
+ /// <summary>
+ /// 鏄剧ず閫夋嫨璁惧鐫$湢鏃堕棿鐨勭晫闈�
+ /// </summary>
+ public void ShowSelectDeviceSleepTimeListForm()
+ {
+ //鏄剧ず鍒楄〃
+ var listText = new List<string>();
+ listText.Add("15s");
+ listText.Add("1min");
+ listText.Add("5min");
+ //鏍囬:閫夋嫨鍔熻兘绫诲瀷
+ var title = Language.StringByID(R.MyInternationalizationString.SleepTime);
+
+ var form = new BottomItemSelectForm();
+ form.CancelCallEvent = false;//鍏佽鍙栨秷
+ form.AddForm(title, listText, null, nowSelectNo);
+ form.FinishSelectEvent += (selectNo) =>
+ {
+ if (selectNo == nowSelectNo)
+ {
+ //閫夋嫨鐨勬槸鐩稿悓鐨�
+ return;
+ }
+ //-1:閫夋嫨鍙栨秷
+ this.sleepTimeText = selectNo == -1 ? string.Empty : listText[selectNo];
+ nowSelectNo = selectNo;
+ //璋冪敤鍥炶皟鍑芥暟
+ this.timeAction?.Invoke(nowSelectNo);
+ };
}
#endregion
@@ -315,7 +441,7 @@
btnColorView.Y = Application.GetRealHeight(5);
btnColorView.TextColor = UserCenterColor.Current.TextGrayColor1;
btnColorView.TextID = R.MyInternationalizationString.uColor;
- frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEventOnly);
+ frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEvent);
int R1 = Convert.ToInt32(this.keyColorData.CloseColorR, 16);
int G1 = Convert.ToInt32(this.keyColorData.CloseColorG, 16);
@@ -330,13 +456,13 @@
btnColorLine.Radius = (uint)this.GetPictrueRealSize(79) / 2;
btnColorLine.BorderWidth = 1;
btnColorLine.BorderColor = 0xffcccccc;
- frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEventOnly);
+ frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEvent);
var btnColor = new NormalViewControl(this.GetPictrueRealSize(69), this.GetPictrueRealSize(69), false);
btnColor.Gravity = Gravity.Center;
btnColor.Radius = (uint)this.GetPictrueRealSize(69) / 2;
btnColor.BackgroundColor = backColor;
- btnColorLine.AddChidren(btnColor, ChidrenBindMode.BindEventOnly);
+ btnColorLine.AddChidren(btnColor, ChidrenBindMode.BindEvent);
//鍙樻洿婊戝姩鏉$殑棰滆壊
seekBar1.ProgressBarColor = backColor;
@@ -345,7 +471,7 @@
btnRight.UnSelectedImagePath = "Item/RightNext.png";
btnRight.Y = Application.GetRealHeight(5);
btnRight.X = frameColor.Width - this.GetPictrueRealSize(58);
- frameColor.AddChidren(btnRight, ChidrenBindMode.BindEventOnly);
+ frameColor.AddChidren(btnRight, ChidrenBindMode.BindEvent);
btnRight.Y += this.GetPictrueRealSize(8);
frameColor.ButtonClickEvent += (sender, e) =>
@@ -477,7 +603,7 @@
btnColorView.Y = Application.GetRealHeight(5);
btnColorView.TextColor = UserCenterColor.Current.TextGrayColor1;
btnColorView.TextID = R.MyInternationalizationString.uColor;
- frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEventOnly);
+ frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEvent);
int R1 = Convert.ToInt32(this.keyColorData.OpenColorR, 16);
int G1 = Convert.ToInt32(this.keyColorData.OpenColorG, 16);
@@ -492,13 +618,13 @@
btnColorLine.Radius = (uint)this.GetPictrueRealSize(79) / 2;
btnColorLine.BorderWidth = 1;
btnColorLine.BorderColor = 0xffcccccc;
- frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEventOnly);
+ frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEvent);
var btnColor = new NormalViewControl(this.GetPictrueRealSize(69), this.GetPictrueRealSize(69), false);
btnColor.Gravity = Gravity.Center;
btnColor.Radius = (uint)this.GetPictrueRealSize(69) / 2;
btnColor.BackgroundColor = backColor;
- btnColorLine.AddChidren(btnColor, ChidrenBindMode.BindEventOnly);
+ btnColorLine.AddChidren(btnColor, ChidrenBindMode.BindEvent);
//鍙樻洿婊戝姩鏉$殑棰滆壊
seekBar1.ProgressBarColor = backColor;
@@ -507,28 +633,51 @@
btnRight.UnSelectedImagePath = "Item/RightNext.png";
btnRight.Y = Application.GetRealHeight(5);
btnRight.X = frameColor.Width - this.GetPictrueRealSize(58);
- frameColor.AddChidren(btnRight, ChidrenBindMode.BindEventOnly);
+ frameColor.AddChidren(btnRight, ChidrenBindMode.BindEvent);
btnRight.Y += this.GetPictrueRealSize(8);
frameColor.ButtonClickEvent += (sender, e) =>
{
- PanelColor(btnColor, seekBar1, R1, G1, B1);
+ PanelAfterColor(btnColor, seekBar1, R1, G1, B1);
};
btnColorView.ButtonClickEvent += (sender, e) =>
{
- PanelColor(btnColor, seekBar1, R1, G1, B1);
+ PanelAfterColor(btnColor, seekBar1, R1, G1, B1);
};
btnColor.ButtonClickEvent += (sender, e) =>
{
- PanelColor(btnColor, seekBar1, R1, G1, B1);
+ PanelAfterColor(btnColor, seekBar1, R1, G1, B1);
};
btnColorLine.ButtonClickEvent += (sender, e) =>
{
- PanelColor(btnColor, seekBar1, R1, G1, B1);
+ PanelAfterColor(btnColor, seekBar1, R1, G1, B1);
};
btnRight.ButtonClickEvent += (sender, e) =>
{
- PanelColor(btnColor, seekBar1, R1, G1, B1);
+ PanelAfterColor(btnColor, seekBar1, R1, G1, B1);
+ };
+ }
+
+ /// <summary>
+ /// PanelColorBefore
+ /// </summary>
+ private void PanelAfterColor(NormalViewControl btnColor, SeekBarControl seekBar1, int R1, int G1, int B1)
+ {
+ var form = new PanelColorSelectForm();
+ form.AddForm(R1, G1, B1);
+ form.FinishSelectColorEvent += (Rcolor, Gcolor, Bcolor) =>
+ {
+ R1 = Rcolor;
+ G1 = Gcolor;
+ B1 = Bcolor;
+
+ this.keyColorData.OpenColorR = Convert.ToString(Rcolor, 16);
+ this.keyColorData.OpenColorG = Convert.ToString(Gcolor, 16);
+ this.keyColorData.OpenColorB = Convert.ToString(Bcolor, 16);
+
+ btnColor.BackgroundColor = this.GetColorByRGB((byte)Rcolor, (byte)Gcolor, (byte)Bcolor);
+ //鍙樻洿婊戝姩鏉$殑棰滆壊
+ seekBar1.ProgressBarColor = btnColor.BackgroundColor;
};
}
#endregion
@@ -544,7 +693,7 @@
//寮�鍚繘搴︽潯
this.ShowProgressBar();
//浜害璋冭妭(浠栦滑璇撮殢渚挎嬁涓�璺洖璺氨琛屼簡)
- linghtLevelInfo = await HdlDevicePanelLogic.Current.GetDeviceLightSettion(panelDevice);
+ linghtLevelInfo = HdlDevicePanelLogic.Current.GetDeviceLightSettion(panelDevice);
if (linghtLevelInfo == null)
{
//鍏抽棴杩涘害鏉�
@@ -560,14 +709,14 @@
return false;
}
//鑺傝兘妯″紡(浠栦滑璇撮殢渚挎嬁涓�璺洖璺氨琛屼簡)
- energyModeInfo = await HdlDevicePanelLogic.Current.GetDeviceEnergyConservationMode(panelDevice);
+ energyModeInfo = HdlDevicePanelLogic.Current.GetDeviceEnergyConservationMode(panelDevice);
if (energyModeInfo == null)
{
//鍏抽棴杩涘害鏉�
this.CloseProgressBar(ShowReLoadMode.YES);
return false;
}
- keyColorData = await HdlDevicePanelLogic.Current.GetPanelEpointColorInfo(panelDevice);
+ keyColorData = HdlDevicePanelLogic.Current.GetPanelEpointColorInfo(panelDevice);
if (this.keyColorData == null)
{
//鍏抽棴杩涘害鏉�
@@ -591,7 +740,7 @@
{
this.ShowProgressBar();
//浜害璋冭妭鏇存敼(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�)
- var result = await HdlDevicePanelLogic.Current.SetDeviceLightSettion(panelDevice, linghtLevelInfo.panelDirectionsLevel, linghtLevelInfo.panelBacklightLevel);
+ var result = HdlDevicePanelLogic.Current.SetDeviceLightSettion(panelDevice, linghtLevelInfo.panelDirectionsLevel, linghtLevelInfo.panelBacklightLevel);
if (result == false)
{
this.CloseProgressBar();
@@ -600,8 +749,7 @@
//鑺傝兘妯″紡淇敼(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�)
//鑲栧織璞粰鎸夐敭鎺у埗闈㈡澘锛堝洓寮�鍏帶锛夎澶囷紝璇撮粯璁�15绉掓椂闂达紝杩欐牱鎺ヨ繎鎰熷簲鍔熻兘鎵嶅悎鐞�
- energyModeInfo.time = 15;
- result = await HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode(panelDevice, energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level);
+ result = HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode(panelDevice, energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level);
if (result == false)
{
this.CloseProgressBar();
@@ -615,7 +763,7 @@
return;
}
//璁剧疆鎸夐敭闈㈡澘鎸囧畾绔偣鐨勩�愭寚绀虹伅寮�鍏抽鑹层�戠殑淇℃伅
- result = await HdlDevicePanelLogic.Current.SetPanelEpointColorInfo(panelDevice, this.keyColorData);
+ result = HdlDevicePanelLogic.Current.SetPanelEpointColorInfo(panelDevice, this.keyColorData);
this.CloseProgressBar();
if (result == false)
{
--
Gitblit v1.8.0