From fd3c74df4d30a88d490d0c5b469df821f1bb2d78 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 04 八月 2020 14:53:25 +0800
Subject: [PATCH] 更换新接口之前的备份
---
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs | 100 +++++++++++++++++++++++++++++---------------------
1 files changed, 58 insertions(+), 42 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
index 1c30f0e..8d3f858 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
@@ -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 (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;
};
@@ -625,7 +650,7 @@
{
lock (dicRowInfo)
{
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
if (this.listView == null)
{
@@ -674,7 +699,7 @@
/// <summary>
/// 婊戝姩鎺т欢涓嬫媺鍒锋柊
/// </summary>
- private async void ListViewBeginHeaderRefreshing()
+ private void ListViewBeginHeaderRefreshing()
{
//濡傛灉褰撳墠浣忓畢鏄櫄鎷熺殑
if (Common.Config.Instance.Home.IsVirtually == true)
@@ -701,7 +726,7 @@
{
//鏄剧ず杩涘害鏉�
ProgressBar.Show();
- int result2 = await HdlGatewayLogic.Current.ReBindNewGateway(realWay);
+ int result2 = HdlGatewayLogic.Current.ReBindNewGateway(realWay);
//鍏抽棴杩涘害鏉�
ProgressBar.Close();
if (result2 == -1)
@@ -717,7 +742,7 @@
}
//鑾峰彇鍏ㄩ儴璁惧
- int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(nowGateway);
+ int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(nowGateway, false);
if (this.Parent == null)
{
return;
@@ -754,7 +779,7 @@
//鍒锋柊缃戝叧鍦ㄧ嚎鐘舵��
HdlGatewayLogic.Current.RefreshGatewayOnlineStatu(new List<ZbGateway>() { zbGateway });
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
if (this.gatewayViewRow != null && this.gatewayViewRow.zbGatewayId == selectGwId)
{
@@ -782,7 +807,7 @@
}
if (gateWay.GwId == this.gatewayViewRow.zbGatewayId)
{
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
//鐩稿悓鐨勭姸鎬�,涓嶉渶瑕佸啀娆″埛鏂�
if (this.gatewayViewRow.isOnline != online)
@@ -848,7 +873,7 @@
this.ReceiveDeviceStatu(device);
}, ShowErrorMode.NO);
}
- System.Threading.Thread.Sleep(30);
+ System.Threading.Thread.Sleep(50);
}
}
});
@@ -1034,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();
+ }
}
}
}
@@ -1107,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;
--
Gitblit v1.8.0