From e79b65b97a8ae1eae5ee172dea1b52d041006599 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期三, 02 九月 2020 17:24:32 +0800
Subject: [PATCH] 2020-09-02-3
---
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs | 218 ++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 147 insertions(+), 71 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
index a4417a0..bc0a6b3 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
@@ -151,7 +151,7 @@
listView.BeginHeaderRefreshingAction += () =>
{
//鍒锋柊璁惧鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
- UserView.UserPage.Instance.RefreshForm = true;
+ UserView.UserPage.Instance.RefreshAllForm = true;
HdlThreadLogic.Current.RunThread(() =>
{
@@ -269,7 +269,8 @@
btnRight.ButtonClickEvent += (sender, e) =>
{
//鍥炶矾鏁板ぇ浜�1鎵嶅睍寮�
- if (Common.LocalDevice.Current.GetDevicesCountByMac(deviceMac) > 1)
+ var listMacDevice = LocalDevice.Current.GetDevicesByMac(deviceMac, false);
+ if (listMacDevice.Count > 1)
{
btnRight.IsSelected = !btnRight.IsSelected;
//灞曞紑鎴栬�呮姌鍙犳槑缁嗗垪琛�
@@ -277,9 +278,20 @@
}
else
{
+ if (LocalDevice.Current.IsMiniLight(listMacDevice[0]) == true)
+ {
+ //mini澶滅伅鐨勫姛鑳借缃晫闈�
+ var room = HdlRoomLogic.Current.GetRoomByDevice(listMacDevice[0]);
+ var form = new MainPage.DeviceDetailInfoForm();
+ form.AddForm(listMacDevice[0], room);
+ }
+ else
+ {
+ //璁惧淇℃伅鐣岄潰
+ var form = new DeviceMacInfoEditorForm();
+ form.AddForm(deviceMac);
+ }
btnNew.Visible = false;
- var form = new DeviceMacInfoEditorForm();
- form.AddForm(deviceMac);
//鐣岄潰璺宠浆,璁板綍褰撳墠鐨勬鍦ㄦ搷浣滅殑璁惧鐨凪ac鍦板潃
this.nowActionDeviceMac = deviceMac;
}
@@ -296,9 +308,22 @@
form2.AddForm(deviceMac);
return;
}
+ var listMacDevice = LocalDevice.Current.GetDevicesByMac(deviceMac, false);
+ if (listMacDevice.Count > 0 && LocalDevice.Current.IsMiniLight(listMacDevice[0]) == true)
+ {
+ //mini澶滅伅鐨勫姛鑳借缃晫闈�
+ var room = HdlRoomLogic.Current.GetRoomByDevice(listMacDevice[0]);
+ var form = new MainPage.DeviceDetailInfoForm();
+ form.AddForm(listMacDevice[0], room);
+ }
+ else
+ {
+ //璁惧淇℃伅鐣岄潰
+ var form = new DeviceMacInfoEditorForm();
+ form.AddForm(deviceMac);
+ }
+
btnNew.Visible = false;
- var form = new DeviceMacInfoEditorForm();
- form.AddForm(deviceMac);
//鐣岄潰璺宠浆,璁板綍褰撳墠鐨勬鍦ㄦ搷浣滅殑璁惧鐨凪ac鍦板潃
this.nowActionDeviceMac = deviceMac;
};
@@ -333,11 +358,29 @@
var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
if (isShow == true)
{
+ //澶囨敞锛氶潰鏉夸腑鍙樉绀虹湡瀹炵殑璁惧锛屽叾浠栧睘浜庣粦瀹氱殑鍥炶矾涓嶆樉绀�
//鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑
var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
{
var listTemp = Common.LocalDevice.Current.GetMutilfunctionPanelByMac(listDevice);
+ //灞曞紑妯″紡鏃讹紝鎵╁ぇ渚濇嵁涓�:瀹冩湁鍑犱釜瀛愭帶浠�
+ heightValue = (listTemp.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
+ //鏍囬鑷繁灏辨槸涓�涓瓙鎺т欢
+ if (rowInfo.frameTable.ChildrenCount == 1)
+ {
+ foreach (CommonDevice info in listTemp)
+ {
+ //鍔犺浇瀹冪殑鍒楄〃
+ this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo);
+ }
+ }
+ }
+ else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir
+ || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment
+ || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEnvironment)
+ {
+ var listTemp = Common.LocalDevice.Current.GetPanelMatchEpointByMac(listDevice);
//灞曞紑妯″紡鏃讹紝鎵╁ぇ渚濇嵁涓�:瀹冩湁鍑犱釜瀛愭帶浠�
heightValue = (listTemp.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
//鏍囬鑷繁灏辨槸涓�涓瓙鎺т欢
@@ -476,12 +519,6 @@
var form = new DeviceAirConditioner.IndoorUnitSettionForm();
form.AddForm((AC)device);
}
- //鐜闈㈡澘
- else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEnvironment)
- {
- var form = new DeviceFunctionSettionForm();
- form.AddForm(device, true);
- }
//鏂伴闈㈡澘
else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
{
@@ -489,7 +526,7 @@
//骞叉帴鐐�
if (device.Type == DeviceType.FreshAir)
{
- var form = new DevicePanel.PanelFangyueFreshAirButtonSettionForm();
+ var form = new DevicePanel.PanelSettionWithSourceForm();
form.AddForm(device);
}
else
@@ -497,6 +534,27 @@
var form = new DeviceFunctionSettionForm();
form.AddForm(device, true);
}
+ }
+ //绠�绾︾幆澧冮潰鏉跨殑鎸夐敭閰嶇疆
+ else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment)
+ {
+
+ if (device.Type == DeviceType.FreshAir || device.Type == DeviceType.Thermostat)
+ {
+ var form = new DevicePanel.PanelSettionWithSourceForm();
+ form.AddForm(device);
+ }
+ else
+ {
+ var form = new DeviceFunctionSettionForm();
+ form.AddForm(device, true);
+ }
+ }
+ //绠�绾﹀鍔熻兘闈㈡澘鐨勬寜閿厤缃�
+ else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
+ {
+ var form = new DeviceFunctionSettionForm();
+ form.AddForm(device, true);
}
//鏂规偊闈㈡澘
else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueTwo
@@ -587,7 +645,7 @@
{
lock (dicRowInfo)
{
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
if (this.listView == null)
{
@@ -636,7 +694,7 @@
/// <summary>
/// 婊戝姩鎺т欢涓嬫媺鍒锋柊
/// </summary>
- private async void ListViewBeginHeaderRefreshing()
+ private void ListViewBeginHeaderRefreshing()
{
//濡傛灉褰撳墠浣忓畢鏄櫄鎷熺殑
if (Common.Config.Instance.Home.IsVirtually == true)
@@ -663,11 +721,16 @@
{
//鏄剧ず杩涘害鏉�
ProgressBar.Show();
- int result2 = await HdlGatewayLogic.Current.ReBindNewGateway(realWay);
+ int result2 = HdlGatewayLogic.Current.ReBindNewGateway(realWay);
//鍏抽棴杩涘害鏉�
ProgressBar.Close();
if (result2 == -1)
{
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ //闅愯棌涓嬫媺鍒锋柊鐗规晥
+ listView.EndHeaderRefreshing();
+ });
return;
}
}
@@ -679,7 +742,7 @@
}
//鑾峰彇鍏ㄩ儴璁惧
- int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(nowGateway);
+ int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(nowGateway, false);
if (this.Parent == null)
{
return;
@@ -716,7 +779,7 @@
//鍒锋柊缃戝叧鍦ㄧ嚎鐘舵��
HdlGatewayLogic.Current.RefreshGatewayOnlineStatu(new List<ZbGateway>() { zbGateway });
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
if (this.gatewayViewRow != null && this.gatewayViewRow.zbGatewayId == selectGwId)
{
@@ -744,7 +807,7 @@
}
if (gateWay.GwId == this.gatewayViewRow.zbGatewayId)
{
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
//鐩稿悓鐨勭姸鎬�,涓嶉渶瑕佸啀娆″埛鏂�
if (this.gatewayViewRow.isOnline != online)
@@ -788,18 +851,31 @@
string gwId = GatewayResourse.NowSelectGatewayId;
HdlThreadLogic.Current.RunThread(() =>
{
- System.Threading.Thread.Sleep(2000);
- //杩欓噷涓昏鍙槸鑾峰彇鍦ㄧ嚎鐘舵��
- var list = LocalDevice.Current.GetDeviceOnlineList(gwId);
- HdlThreadLogic.Current.RunMain(() =>
+ if (this.Parent == null) { return; }
+ //鑾峰彇璁惧鍒楄〃
+ var listDevice = Common.LocalDevice.Current.GetDeviceByGatewayID(gwId);
+ var listCheck = new List<string>();
+ foreach (var device in listDevice)
{
- for (int i = 0; i < list.Count; i++)
+ if (this.Parent == null) { return; }
+ if (listCheck.Contains(device.DeviceAddr) == false)
{
- //璁剧疆璁惧鍦ㄧ嚎鐘舵��
- this.ReceiveDeviceStatu(list[i]);
+ //鍙涓�涓洖璺嵆鍙�
+ listCheck.Add(device.DeviceAddr);
+ var deviceInfo = Common.LocalDevice.Current.ReadDeviceEpointDeviceInfo(device);
+ if (deviceInfo != null)
+ {
+ //鍙樻洿鍦ㄧ嚎鐘舵��
+ device.IsOnline = deviceInfo.IsOnline;
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ //璁剧疆璁惧鍦ㄧ嚎鐘舵��
+ this.ReceiveDeviceStatu(device);
+ }, ShowErrorMode.NO);
+ }
+ System.Threading.Thread.Sleep(50);
}
-
- }, ShowErrorMode.NO);
+ }
});
}
@@ -823,13 +899,8 @@
var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
if (localDevice != null)
{
- //鍦ㄧ嚎鐘舵�佷竴鏍风殑璇濓紝涓嶉渶瑕佸埛鏂�
- if (localDevice.IsOnline != device.IsOnline)
- {
- //淇濆瓨鐘舵��
- localDevice.IsOnline = device.IsOnline;
- localDevice.ReSave();
- }
+ //淇濆瓨鐘舵��
+ localDevice.IsOnline = device.IsOnline;
}
rowInfo.MenuRow.IsOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(device);
@@ -898,9 +969,9 @@
/// <param name="list">ota璁惧</param>
private void CheckDeviceNewVersion(List<OTADevice> list)
{
- HdlThreadLogic.Current.RunThread(async () =>
+ HdlThreadLogic.Current.RunThread(() =>
{
- await System.Threading.Tasks.Task.Delay(2000);
+ System.Threading.Thread.Sleep(2000);
foreach (var ota in list)
{
if (this.Parent == null)
@@ -908,10 +979,10 @@
return;
}
//娣诲姞鍗囩骇鍥轰欢淇℃伅(鎴愪笉鎴愬姛閮芥棤鎵�璋�)
- var result = await HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.ZigbeeDevice, ota.HwVersion.ToString(), ota.ImgTypeId.ToString());
+ var result = HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.A璁惧, ota.HwVersion.ToString(), ota.ImgTypeId.ToString());
//鑾峰彇璁惧鏈�鏂扮増鏈�
- var deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.ZigbeeDevice,
+ var deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.A璁惧,
ota.HwVersion.ToString(),
ota.ImgTypeId.ToString(),
ota.ImgVersion);
@@ -922,7 +993,7 @@
}
//鎷ユ湁鏂扮増鏈�
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
if (this.dicRowInfo.ContainsKey(ota.DeviceAddr) == true)
{
@@ -988,14 +1059,27 @@
{
if (this.dicRowInfo.ContainsKey(deviceAddr) == true)
{
- var row = this.dicRowInfo[deviceAddr];
- row.MenuRow?.RefreshControlInfo(true);
- //鏄庣粏
- if (row.dicDetailRow != null)
+ var rowInfo = this.dicRowInfo[deviceAddr];
+ //妫�娴嬭繖涓澶囨槸鍚﹁鍒犻櫎 2020.01.13鍙樻洿:杩藉姞Ota璁惧鐨勫垽鏂�
+ if (LocalDevice.Current.GetDevicesByMac(deviceAddr).Count == 0
+ && LocalDevice.Current.GetOTADevice(deviceAddr) == null)
{
- foreach (var detailRow in row.dicDetailRow.Values)
+ //绉婚櫎鎺т欢
+ rowInfo.dicDetailRow = null;
+ rowInfo.frameTable.RemoveFromParent();
+
+ this.dicRowInfo.Remove(deviceAddr);
+ }
+ else
+ {
+ //鍒锋柊璁惧淇℃伅
+ rowInfo.MenuRow?.RefreshControlInfo(true);
+ if (rowInfo.dicDetailRow != null)
{
- detailRow.RefreshControlInfo();
+ foreach (var contr in rowInfo.dicDetailRow.Values)
+ {
+ contr?.RefreshControlInfo();
+ }
}
}
}
@@ -1018,6 +1102,20 @@
if (device == null || device.DeviceAddr == null)
{
continue;
+ }
+
+ //鑾峰彇璁惧绫诲瀷鐨�
+ var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
+ if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_SimpleEnvironment)
+ {
+ foreach (var outClu in device.OutClusterList)
+ {
+ //鍘绘帀绠�绾︾幆澧冮潰鏉跨被鐨勫悇绉嶆湇鍔$璁惧锛屽鍐呮満涓嶆樉绀�
+ if (outClu.OutCluster == 513)
+ {
+ continue;
+ }
+ }
}
if (dic.ContainsKey(device.DeviceAddr) == false)
{
@@ -1047,30 +1145,8 @@
{
if (this.nowActionDeviceMac != null)
{
- var rowInfo = this.dicRowInfo[nowActionDeviceMac];
- //妫�娴嬭繖涓澶囨槸鍚﹁鍒犻櫎 2020.01.13鍙樻洿:杩藉姞Ota璁惧鐨勫垽鏂�
- if (Common.LocalDevice.Current.GetDevicesByMac(nowActionDeviceMac).Count == 0
- && Common.LocalDevice.Current.GetOTADevice(nowActionDeviceMac) == null)
- {
- //绉婚櫎鎺т欢
- rowInfo.dicDetailRow = null;
- rowInfo.frameTable.RemoveFromParent();
-
- this.dicRowInfo.Remove(nowActionDeviceMac);
- rowInfo = null;
- }
- else
- {
- //鍒锋柊璁惧淇℃伅
- rowInfo.MenuRow?.RefreshControlInfo(true);
- if (rowInfo.dicDetailRow != null)
- {
- foreach (var contr in rowInfo.dicDetailRow.Values)
- {
- contr?.RefreshControlInfo();
- }
- }
- }
+ //鍒锋柊鎸囧畾璁惧琛岀殑淇℃伅
+ this.RefreshDeviceRow(this.nowActionDeviceMac);
}
//娓呯┖璁板綍
this.nowActionDeviceMac = null;
@@ -1281,7 +1357,7 @@
}
#endregion
- #region 鈻� 鑷畾涔夋櫤鑳介煶绠辨帶浠禵____________________
+ #region 鈻� 鑷畾涔夋櫤鑳介煶绠辨帶浠禵________________
/// <summary>
/// 鑷畾涔夌綉鍏虫帶浠�
--
Gitblit v1.8.0