From f14dcfd967404e197e7ec995ca8d6f2b090d3b7d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 11 九月 2020 09:16:59 +0800
Subject: [PATCH] 优化多功能面板:绑定温湿度传感器目标,和设备列表回路显示。优化数据矫正功能温湿度度不设置的情况。优化门锁时间设置最后一天和最后最后一个月的时间显示等 细节
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs | 111 +++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 86 insertions(+), 25 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs
index 1e53f96..75a9421 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs
@@ -40,7 +40,7 @@
/// </summary>
private CommonDevice device = null;
/// <summary>
- /// 褰撳墠閫夋嫨鐨勫姛鑳界被鍨嬬储寮�
+ /// 褰撳墠閫夋嫨鐨勫姛鑳界被鍨嬬储寮� -1:杩樻病鏈夎缃繃 0:涓嶆寚瀹� 1:寮�鍏� 2:鐏厜 3:鎻掑骇
/// </summary>
private int nowSelectNo = -1;
@@ -74,11 +74,14 @@
|| this.device.Type == DeviceType.OnOffOutput)
{
//娌¤寮哄埗骞叉秹鐨勮瘽
- if (m_SetCanSelect == true)
+ if (m_SetCanSelect == true && Common.Config.Instance.Home.IsShowTemplate == false)
{
this.UseClickStatu = true;
//鍙崇澶�
this.AddRightArrow();
+
+ //璇诲彇璁惧鍔熻兘绫诲瀷
+ this.ReadDeviceFunctionType();
this.ButtonClickEvent += (sender, e) =>
{
@@ -108,26 +111,46 @@
var form = new BottomItemSelectForm();
form.CancelCallEvent = true;//鍏佽鍙栨秷
- form.AddForm(title, listText, nowSelectNo);
+ form.AddForm(title, listText, null, nowSelectNo - 1);
form.FinishSelectEvent += (selectNo) =>
{
- if (selectNo == nowSelectNo)
+ if (selectNo == nowSelectNo - 1)
{
//閫夋嫨鐨勬槸鐩稿悓鐨�
return;
}
//-1:閫夋嫨鍙栨秷
this.Text = selectNo == -1 ? string.Empty : listText[selectNo];
- nowSelectNo = selectNo;
+ nowSelectNo = selectNo + 1;
- //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨�
- this.RefreshDfunctionType();
+ this.CanClick = false;
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ //璁剧疆鍔熻兘绫诲瀷鍒扮綉鍏�
+ var result = Common.LocalDevice.Current.SendDeviceFunctionTypeToGateway(this.device, (DeviceFunctionType)nowSelectNo);
+
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ if (result == true)
+ {
+ //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨�
+ this.RefreshDfunctionType();
- //璁惧鏀瑰彉鍔熻兘绫诲瀷鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
- UserView.UserPage.Instance.RefreshForm = true;
+ //璁惧鏀瑰彉鍔熻兘绫诲瀷鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
+ UserView.UserPage.Instance.RefreshAllForm = true;
- //璋冪敤鍥炶皟鍑芥暟
- this.FinishSelectEvent?.Invoke(nowSelectNo);
+ //璋冪敤鍥炶皟鍑芥暟
+ this.FinishSelectEvent?.Invoke(nowSelectNo);
+ }
+ else
+ {
+ //璁剧疆璁惧鍔熻兘绫诲瀷澶辫触
+ var alert = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uSetDeviceFunctionTypeFail));
+ alert.Show();
+ }
+ this.CanClick = true;
+ });
+ });
};
}
#endregion
@@ -145,45 +168,55 @@
var myFunType = this.device.DfunctionType;
//鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛�
string strType = string.Empty;
- if (myFunType == DeviceFunctionType.A鐏厜)
+
+ if (this.device.DfunctionType == DeviceFunctionType.A涓嶆寚瀹�)
{
- strType = Language.StringByID(R.MyInternationalizationString.uLight);
- nowSelectNo = 1;
+ nowSelectNo = 0;
}
else if (this.device.DfunctionType == DeviceFunctionType.A寮�鍏�)
{
strType = Language.StringByID(R.MyInternationalizationString.uSwitch);
- nowSelectNo = 0;
+ nowSelectNo = 1;
+ }
+ else if (myFunType == DeviceFunctionType.A鐏厜)
+ {
+ strType = Language.StringByID(R.MyInternationalizationString.uLight);
+ nowSelectNo = 2;
}
else if (this.device.DfunctionType == DeviceFunctionType.A鎻掑骇)
{
strType = Language.StringByID(R.MyInternationalizationString.uSocket1);
- nowSelectNo = 2;
+ nowSelectNo = 3;
}
if (this.device.Type == DeviceType.ColorDimmableLight
+ || this.device.Type == DeviceType.ColorTemperatureLight
|| this.device.Type == DeviceType.DimmableLight)
{
//鐏厜绫诲浐瀹氫负 鐏厜
- strType = Language.StringByID(R.MyInternationalizationString.uLight);
- nowSelectNo = 1;
+ var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A418");
+ strType = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
+ nowSelectNo = 2;
}
else if (this.device.Type == DeviceType.WindowCoveringDevice)
{
//绐楀笜鍥哄畾涓� 閬槼
- strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100);
+ var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A400");
+ strType = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
nowSelectNo = -1;
}
else if (this.device.Type == DeviceType.Thermostat)
{
//绌鸿皟鍥哄畾涓� 绌鸿皟
- strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId3600);
+ var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A406");
+ strType = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
nowSelectNo = -1;
}
else if (this.device.Type == DeviceType.DoorLock)
{
//闂ㄩ攣鍥哄畾涓� 闂ㄩ攣
- strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2800);
+ var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A405");
+ strType = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
nowSelectNo = -1;
}
else if (this.device.Type == DeviceType.FreshAir)
@@ -223,6 +256,7 @@
|| this.device.Type == DeviceType.Thermostat//绌鸿皟
|| this.device.Type == DeviceType.FreshAir//鏂伴
|| this.device.Type == DeviceType.PMSensor //PM2.5
+ || this.device.Type == DeviceType.ColorTemperatureLight //鑹叉俯鐏�
|| this.device.Type == DeviceType.WindowCoveringDevice)//绐楀笜
{
return true;
@@ -253,7 +287,7 @@
/// </summary>
private void RefreshDfunctionType()
{
- if (this.nowSelectNo == 0)
+ if (this.nowSelectNo == 1)
{
this.device.DfunctionType = DeviceFunctionType.A寮�鍏�;
if (this.device.IsCustomizeImage == false)
@@ -262,7 +296,7 @@
this.device.IconPath = "Device/Switch.png";
}
}
- else if (this.nowSelectNo == 1)
+ else if (this.nowSelectNo == 2)
{
this.device.DfunctionType = DeviceFunctionType.A鐏厜;
if (this.device.IsCustomizeImage == false)
@@ -271,7 +305,7 @@
this.device.IconPath = "Device/Light.png";
}
}
- else if (this.nowSelectNo == 2)
+ else if (this.nowSelectNo == 3)
{
this.device.DfunctionType = DeviceFunctionType.A鎻掑骇;
if (this.device.IsCustomizeImage == false)
@@ -282,7 +316,7 @@
}
else
{
- this.device.DfunctionType = DeviceFunctionType.A鏈畾涔�;
+ this.device.DfunctionType = DeviceFunctionType.A涓嶆寚瀹�;
if (this.device.IsCustomizeImage == false)
{
//閲嶆柊璁剧疆鍥剧墖
@@ -302,5 +336,32 @@
}
#endregion
+
+ #region 鈻� 璇诲彇璁惧鍔熻兘绫诲瀷___________________
+
+ /// <summary>
+ /// 璇诲彇璁惧鍔熻兘绫诲瀷
+ /// </summary>
+ private void ReadDeviceFunctionType()
+ {
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ //璇诲彇璁惧鍔熻兘绫诲瀷
+ var info = Common.LocalDevice.Current.ReadDeviceEpointDeviceInfo(this.device);
+ if (info != null && ((int)this.device.DfunctionType) != info.FunctionType)
+ {
+ this.device.DfunctionType = (DeviceFunctionType)info.FunctionType;
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ //鍒锋柊鎺т欢
+ this.InitDefultData();
+ //鍒锋柊璁惧鍔熻兘绫诲瀷
+ this.RefreshDfunctionType();
+ });
+ }
+ });
+ }
+
+ #endregion
}
}
--
Gitblit v1.8.0