From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 09:07:13 +0800
Subject: [PATCH] 新云端Ver1.3
---
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs | 389 ++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 271 insertions(+), 118 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
index 187bdb5..f95ecea 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
@@ -1,4 +1,5 @@
锘縰sing Shared.Common;
+using Shared.Phone.UserCenter.SmartSound;
using System;
using System.Collections.Generic;
using System.Text;
@@ -12,7 +13,10 @@
public class DeviceListMainForm : EditorCommonForm
{
#region 鈻� 鍙橀噺澹版槑___________________________
-
+ /// <summary>
+ /// 鏅鸿兘闊崇
+ /// </summary>
+ private MySmartSoundControl smmartSoundView = null;
/// <summary>
/// 缃戝叧鎺т欢
/// </summary>
@@ -86,9 +90,21 @@
//娓呯┖bodyFrame
this.ClearBodyFrame();
+ smmartSoundView = new MySmartSoundControl();
+ bodyFrameLayout.AddChidren(smmartSoundView);
+ smmartSoundView.InitControl();
+ //褰撳墠涓嶆槸铏氭嫙浣忓畢鐨勮瘽
+ if (Config.Instance.Home.IsVirtually == false)
+ {
+ smmartSoundView.ButtonClickEvent += (sernder, e) =>
+ {
+ var form = new SmartSoundListForm();
+ form.AddForm();
+ };
+ }
//鍒濆鍖栫綉鍏宠鎺т欢
- GatewayResourse.NowSelectGatewayId = GatewayResourse.AppOldSelectGatewayId;
- var nowGateway = HdlGatewayLogic.Current.GetLocalGateway(GatewayResourse.AppOldSelectGatewayId);
+ HdlGatewayResourse.NowSelectGatewayId = HdlGatewayResourse.AppOldSelectGatewayId;
+ var nowGateway = HdlGatewayLogic.Current.GetLocalGateway(HdlGatewayResourse.AppOldSelectGatewayId);
this.gatewayViewRow = new MyGatewayControl(nowGateway);
bodyFrameLayout.AddChidren(gatewayViewRow);
gatewayViewRow.InitControl();
@@ -135,7 +151,7 @@
listView.BeginHeaderRefreshingAction += () =>
{
//鍒锋柊璁惧鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
- UserView.UserPage.Instance.RefreshForm = true;
+ UserView.UserPage.Instance.RefreshAllForm = true;
HdlThreadLogic.Current.RunThread(() =>
{
@@ -155,8 +171,8 @@
private void InitDeviceListControl()
{
//鑾峰彇璁惧鍒楄〃
- var listDevice = Common.LocalDevice.Current.GetDeviceByGatewayID(GatewayResourse.NowSelectGatewayId);
- var listSpecialOta = Common.LocalDevice.Current.GetSpecialOtaDevice(GatewayResourse.NowSelectGatewayId);
+ var listDevice = HdlDeviceCommonLogic.Current.GetDeviceByGatewayID(HdlGatewayResourse.NowSelectGatewayId);
+ var listSpecialOta = HdlDeviceCommonLogic.Current.GetSpecialOtaDevice(HdlGatewayResourse.NowSelectGatewayId);
listDevice.AddRange(listSpecialOta);
this.dicRowInfo.Clear();
@@ -180,7 +196,7 @@
foreach (var macAddress in this.dicRowInfo.Keys)
{
//鑾峰彇ota璁惧
- var ota = Common.LocalDevice.Current.GetOTADevice(macAddress);
+ var ota = HdlDeviceCommonLogic.Current.GetOTADevice(macAddress);
if (ota != null)
{
listOta.Add(ota);
@@ -213,7 +229,7 @@
//鍒涘缓涓�涓彲浠ュ睍寮�鍜屾敹缂╃殑FrameLayout,鐩稿綋浜庤彍鍗曟爮
var frameTable = new FrameListControl(29);
- frameTable.Height = ControlCommonResourse.ListViewRowHeight + frameTable.rowSpace;
+ frameTable.Height = HdlControlResourse.ListViewRowHeight + frameTable.rowSpace;
listView.AddChidren(frameTable);
rowInfo.frameTable = frameTable;
@@ -232,12 +248,12 @@
//鎻愮ず鏂扮増鏈�
var btnNew = new InformationTipView(rowMenu.btnIcon);
btnNew.Visible = false;
- rowMenu.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEventOnly);
+ rowMenu.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEvent);
rowMenu.AddTag("btnNew", btnNew);
//妫�娴嬭澶囨槸鍚︽嫢鏈夊畾浣嶇殑鍔熻兘
- var listdevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
- if (listdevice.Count > 0 && Common.LocalDevice.Current.DeviceIsCanFixedPosition(listdevice[0]) == true)
+ var listdevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceMac);
+ if (listdevice.Count > 0 && HdlDeviceCommonLogic.Current.DeviceIsCanFixedPosition(listdevice[0]) == true)
{
//瀹氫綅
var btnPosition = rowMenu.AddEditorControl(false);
@@ -245,7 +261,7 @@
btnPosition.ButtonClickEvent += (sender, e) =>
{
//瀹氫綅
- Common.LocalDevice.Current.SetFixedPositionCommand(listdevice[0]);
+ HdlDeviceCommonLogic.Current.SetFixedPositionCommand(listdevice[0], true);
};
}
@@ -253,7 +269,8 @@
btnRight.ButtonClickEvent += (sender, e) =>
{
//鍥炶矾鏁板ぇ浜�1鎵嶅睍寮�
- if (Common.LocalDevice.Current.GetDevicesCountByMac(deviceMac) > 1)
+ var listMacDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceMac, false);
+ if (listMacDevice.Count > 1)
{
btnRight.IsSelected = !btnRight.IsSelected;
//灞曞紑鎴栬�呮姌鍙犳槑缁嗗垪琛�
@@ -261,9 +278,20 @@
}
else
{
+ if (HdlDeviceCommonLogic.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;
}
@@ -274,15 +302,28 @@
//闅愯棌鑿滃崟
rowMenu.HideMenu();
//寮哄埗璺宠浆鐪熷疄璁惧鐣岄潰
- if (UserCenterResourse.HideOption.GotoRealDeviceForm == 1)
+ if (HdlUserCenterResourse.HideOption.GotoRealDeviceForm == 1)
{
var form2 = new DeviceAddSuccessForm();
form2.AddForm(deviceMac);
return;
}
+ var listMacDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceMac, false);
+ if (listMacDevice.Count > 0 && HdlDeviceCommonLogic.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;
};
@@ -313,17 +354,35 @@
//瀹冨師鏉ョ殑楂樺害
int oldHeight = rowInfo.frameTable.Height;
//鍙樻洿鐨勯珮搴�,榛樿涓哄垪琛ㄩ殣钘�
- int heightValue = ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace;
- var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
+ int heightValue = HdlControlResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace;
+ var listDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceMac);
if (isShow == true)
{
+ //澶囨敞锛氶潰鏉夸腑鍙樉绀虹湡瀹炵殑璁惧锛屽叾浠栧睘浜庣粦瀹氱殑鍥炶矾涓嶆樉绀�
//鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑
- var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
+ var deviceEnumInfo = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(listDevice);
if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
{
- var listTemp = Common.LocalDevice.Current.GetMutilfunctionPanelByMac(listDevice);
+ var listTemp = HdlDeviceCommonLogic.Current.GetMutilfunctionPanelByMac(listDevice);
//灞曞紑妯″紡鏃讹紝鎵╁ぇ渚濇嵁涓�:瀹冩湁鍑犱釜瀛愭帶浠�
- heightValue = (listTemp.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
+ heightValue = (listTemp.Count + 1) * (HdlControlResourse.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 = HdlDeviceCommonLogic.Current.GetPanelMatchEpointByMac(listDevice);
+ //灞曞紑妯″紡鏃讹紝鎵╁ぇ渚濇嵁涓�:瀹冩湁鍑犱釜瀛愭帶浠�
+ heightValue = (listTemp.Count + 1) * (HdlControlResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
//鏍囬鑷繁灏辨槸涓�涓瓙鎺т欢
if (rowInfo.frameTable.ChildrenCount == 1)
{
@@ -337,7 +396,7 @@
else
{
//灞曞紑妯″紡鏃讹紝鎵╁ぇ渚濇嵁涓�:瀹冩湁鍑犱釜瀛愭帶浠�
- heightValue = (listDevice.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
+ heightValue = (listDevice.Count + 1) * (HdlControlResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
//鏍囬鑷繁灏辨槸涓�涓瓙鎺т欢
if (rowInfo.frameTable.ChildrenCount == 1)
{
@@ -369,9 +428,9 @@
//琛屾帶浠�
var rowDevice = new DeviceRoomControl(device, frame.rowSpace / 2);
- rowDevice.MainKeys = LocalDevice.Current.GetDeviceMainKeys(device);
+ rowDevice.MainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device);
frame.AddChidren(rowDevice);
- rowDevice.frameTable.LeftOffset = Application.GetRealWidth(173) - ControlCommonResourse.XXLeft;
+ rowDevice.frameTable.LeftOffset = Application.GetRealWidth(173) - HdlControlResourse.XXLeft;
rowDevice.InitControl();
//搴曠嚎
rowDevice.frameTable.AddBottomLine();
@@ -380,11 +439,11 @@
//鍦ㄧ嚎鐘舵��
rowDevice.IsOnline = rowInfo.MenuRow.IsOnline;
//淇濆瓨鎺т欢
- string maikey = Common.LocalDevice.Current.GetDeviceMainKeys(device);
+ string maikey = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device);
rowInfo.dicDetailRow[maikey] = rowDevice;
//妫�娴嬭澶囨槸鍚︽嫢鏈夊畾浣嶇殑鍔熻兘
- if (Common.LocalDevice.Current.DeviceIsCanFixedPosition(device) == true)
+ if (HdlDeviceCommonLogic.Current.DeviceIsCanFixedPosition(device) == true)
{
//瀹氫綅
var btnPosition = rowDevice.AddEditorControl(false);
@@ -392,7 +451,7 @@
btnPosition.ButtonClickEvent += (sender, e) =>
{
//瀹氫綅
- Common.LocalDevice.Current.SetFixedPositionCommand(device);
+ HdlDeviceCommonLogic.Current.SetFixedPositionCommand(device);
};
}
@@ -460,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)
{
@@ -473,7 +526,7 @@
//骞叉帴鐐�
if (device.Type == DeviceType.FreshAir)
{
- var form = new DevicePanel.PanelFangyueFreshAirButtonSettionForm();
+ var form = new DevicePanel.PanelSettionWithSourceForm();
form.AddForm(device);
}
else
@@ -481,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
@@ -571,7 +645,7 @@
{
lock (dicRowInfo)
{
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
if (this.listView == null)
{
@@ -620,7 +694,7 @@
/// <summary>
/// 婊戝姩鎺т欢涓嬫媺鍒锋柊
/// </summary>
- private async void ListViewBeginHeaderRefreshing()
+ private void ListViewBeginHeaderRefreshing()
{
//濡傛灉褰撳墠浣忓畢鏄櫄鎷熺殑
if (Common.Config.Instance.Home.IsVirtually == true)
@@ -635,23 +709,28 @@
return;
}
//濡傛灉鏄湪绾跨殑
- var nowGateway = HdlGatewayLogic.Current.GetLocalGateway(GatewayResourse.NowSelectGatewayId);
- if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(nowGateway) == true)
+ var nowGateway = HdlGatewayLogic.Current.GetLocalGateway(HdlGatewayResourse.NowSelectGatewayId);
+ if (HdlGatewayLogic.Current.CheckGatewayOnlineByMemory(nowGateway) == true)
{
//妫�娴嬪箍鎾埌鐨勮繖涓綉鍏虫槸鍚︽嫢鏈変綇瀹匢D
ZbGateway realWay = null;
if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, nowGateway) == true)
{
//閲嶆柊璁剧疆浣忓畢ID(杩欎釜搴旇鏄笉缁忚繃APP,鐩存帴鎶婄綉鍏虫仮澶嶄簡鍑哄巶璁剧疆)
- if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.getGatewayBaseInfo.HomeId) == true)
+ if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.HomeId) == true)
{
//鏄剧ず杩涘害鏉�
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;
}
}
@@ -663,7 +742,7 @@
}
//鑾峰彇鍏ㄩ儴璁惧
- int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(nowGateway);
+ int result = HdlDeviceCommonLogic.Current.SetDeviceToMemmoryByGateway(nowGateway.GwId, false);
if (this.Parent == null)
{
return;
@@ -689,7 +768,7 @@
/// </summary>
private void StartGatewayOnlieCheckThread()
{
- string selectGwId = GatewayResourse.NowSelectGatewayId;
+ string selectGwId = HdlGatewayResourse.NowSelectGatewayId;
HdlThreadLogic.Current.RunThread(() =>
{
ZbGateway zbGateway = HdlGatewayLogic.Current.GetLocalGateway(selectGwId);
@@ -700,11 +779,11 @@
//鍒锋柊缃戝叧鍦ㄧ嚎鐘舵��
HdlGatewayLogic.Current.RefreshGatewayOnlineStatu(new List<ZbGateway>() { zbGateway });
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
if (this.gatewayViewRow != null && this.gatewayViewRow.zbGatewayId == selectGwId)
{
- bool online = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbGateway);
+ bool online = HdlGatewayLogic.Current.CheckGatewayOnlineByMemory(zbGateway);
//鍒锋柊鎺т欢鍦ㄧ嚎鐘舵��
this.gatewayViewRow?.RefreshOnlineStatu();
//鏍规嵁缃戝叧鍦ㄧ嚎鐘舵�佸埛鏂拌澶囧湪绾跨姸鎬�
@@ -726,9 +805,9 @@
{
return;
}
- if (HdlGatewayLogic.Current.GetGatewayId(gateWay) == this.gatewayViewRow.zbGatewayId)
+ if (gateWay.GwId == this.gatewayViewRow.zbGatewayId)
{
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
//鐩稿悓鐨勭姸鎬�,涓嶉渶瑕佸啀娆″埛鏂�
if (this.gatewayViewRow.isOnline != online)
@@ -769,21 +848,34 @@
/// </summary>
private void RefreshDeviceOnlineStatu()
{
- string gwId = GatewayResourse.NowSelectGatewayId;
+ string gwId = HdlGatewayResourse.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 = HdlDeviceCommonLogic.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 = HdlDeviceCommonLogic.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);
+ }
});
}
@@ -803,20 +895,15 @@
return;
}
//鍒锋柊璁惧鐨勫湪绾跨姸鎬�
- string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
- var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
+ string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device);
+ var localDevice = HdlDeviceCommonLogic.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);
+ rowInfo.MenuRow.IsOnline = HdlDeviceCommonLogic.Current.CheckDeviceIsOnline(device);
if (rowInfo.dicDetailRow != null)
{
foreach (var detailRow in rowInfo.dicDetailRow.Values)
@@ -882,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)
@@ -892,10 +979,10 @@
return;
}
//娣诲姞鍗囩骇鍥轰欢淇℃伅(鎴愪笉鎴愬姛閮芥棤鎵�璋�)
- var result = await HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.ZigbeeDevice, ota.HwVersion.ToString(), ota.ImgTypeId.ToString());
+ var result = HdlFirmwareUpdateLogic.Current.AddFirmwareVersionInfo(FirmwareLevelType.A璁惧, ota.HwVersion.ToString(), ota.ImgTypeId.ToString());
//鑾峰彇璁惧鏈�鏂扮増鏈�
- var deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.ZigbeeDevice,
+ var deviceFirmware = HdlFirmwareUpdateLogic.Current.GetFirmwareMostVersionInfo(FirmwareLevelType.A璁惧,
ota.HwVersion.ToString(),
ota.ImgTypeId.ToString(),
ota.ImgVersion);
@@ -906,7 +993,7 @@
}
//鎷ユ湁鏂扮増鏈�
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
if (this.dicRowInfo.ContainsKey(ota.DeviceAddr) == true)
{
@@ -938,11 +1025,11 @@
//鏂板缓涓�涓璞�
if (this.dicRowInfo.ContainsKey(deviceAddr) == false)
{
- var localDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceAddr);
+ var localDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceAddr);
if (localDevice.Count == 0)
{
//閽堝鍗曠函鍙湁涓�涓�200绔偣鐨勮澶�
- var ota = Common.LocalDevice.Current.GetOTADevice(deviceAddr);
+ var ota = HdlDeviceCommonLogic.Current.GetOTADevice(deviceAddr);
if (ota == null)
{
//鍏ョ綉涔嬪悗锛屽張鎶婂畠鍒犱簡
@@ -952,8 +1039,8 @@
}
var rowNewInfo = new DeviceObjRowInfo();
rowNewInfo.DeviceMac = deviceAddr;
- rowNewInfo.MacName = Common.LocalDevice.Current.GetDeviceMacName(localDevice[0]);
- rowNewInfo.DeviveTypeName = Common.LocalDevice.Current.GetDeviceObjectText(localDevice);
+ rowNewInfo.MacName = HdlDeviceCommonLogic.Current.GetDeviceMacName(localDevice[0]);
+ rowNewInfo.DeviveTypeName = HdlDeviceCommonLogic.Current.GetDeviceObjectText(localDevice);
this.dicRowInfo[deviceAddr] = rowNewInfo;
//鍒涘缓鏂扮殑琛�
@@ -972,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 (HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceAddr).Count == 0
+ && HdlDeviceCommonLogic.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();
+ }
}
}
}
@@ -1003,6 +1103,20 @@
{
continue;
}
+
+ //鑾峰彇璁惧绫诲瀷鐨�
+ var deviceEnumInfo = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
+ if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment)
+ {
+ foreach (var outClu in device.OutClusterList)
+ {
+ //鍘绘帀绠�绾︾幆澧冮潰鏉跨被鐨勫悇绉嶆湇鍔$璁惧锛屽鍐呮満涓嶆樉绀�
+ if (outClu.OutCluster == 513)
+ {
+ continue;
+ }
+ }
+ }
if (dic.ContainsKey(device.DeviceAddr) == false)
{
dic[device.DeviceAddr] = new List<CommonDevice>();
@@ -1014,8 +1128,8 @@
{
var info = new DeviceObjRowInfo();
info.DeviceMac = mac;
- info.MacName = Common.LocalDevice.Current.GetDeviceMacName(dic[mac][0]);
- info.DeviveTypeName = Common.LocalDevice.Current.GetDeviceObjectText(dic[mac]);
+ info.MacName = HdlDeviceCommonLogic.Current.GetDeviceMacName(dic[mac][0]);
+ info.DeviveTypeName = HdlDeviceCommonLogic.Current.GetDeviceObjectText(dic[mac]);
this.dicRowInfo[mac] = info;
}
}
@@ -1029,32 +1143,22 @@
/// </summary>
public override int FormActionAgainEvent()
{
+ if (HdlGatewayResourse.AppOldSelectGatewayId != this.gatewayViewRow.zbGatewayId)
+ {
+ //杩欎釜缃戝叧琚暣鎺変簡,闇�瑕侀噸鏂板垵濮嬪寲鐣岄潰
+ this.nowActionDeviceMac = null;
+ this.oldShowRightMuneRow = null;
+ //閲嶆柊閫夋嫨缃戝叧
+ HdlGatewayLogic.Current.RefreshAppOldSelectGatewayId();
+ //鍒濆鍖栫晫闈�
+ this.InitMiddleFrame();
+ return 1;
+ }
+
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;
@@ -1132,9 +1236,9 @@
/// </summary>
private NormalViewControl btnName = null;
/// <summary>
- /// 鍦ㄧ嚎鐘舵��
+ /// 鍦ㄧ嚎鐘舵��(鍒濆鐘舵�佷负鍦ㄧ嚎)
/// </summary>
- public bool isOnline = false;
+ public bool isOnline = true;
/// <summary>
/// 鑷畾涔夌綉鍏虫帶浠�
@@ -1145,9 +1249,10 @@
this.UseClickStatu = false;
if (i_zbGateway != null)
{
- this.zbGatewayId = HdlGatewayLogic.Current.GetGatewayId(i_zbGateway);
+ this.zbGatewayId = i_zbGateway.GwId;
}
this.BackgroundColor = UserCenterColor.Current.White;
+ this.Y = Application.GetRealHeight(174);
this.Height = Application.GetRealHeight(173);
}
@@ -1178,11 +1283,11 @@
{
btnName.Text = HdlGatewayLogic.Current.GetGatewayName(zbway);
//鍦ㄧ嚎鐘舵��
- this.isOnline = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway);
- if (this.isOnline == false)
- {
- btnName.TextColor = UserCenterColor.Current.TextGrayColor1;
- }
+ //this.isOnline = HdlGatewayLogic.Current.CheckGatewayOnlineByMemory(zbway);
+ //if (this.isOnline == false)
+ //{
+ // btnName.TextColor = UserCenterColor.Current.TextGrayColor1;
+ //}
}
else
{
@@ -1247,7 +1352,7 @@
return;
}
//鍦ㄧ嚎鐘舵��
- bool statu = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway);
+ bool statu = HdlGatewayLogic.Current.CheckGatewayOnlineByMemory(zbway);
if (this.isOnline != statu)
{
this.isOnline = statu;
@@ -1262,7 +1367,55 @@
}
}
}
+ #endregion
+ #region 鈻� 鑷畾涔夋櫤鑳介煶绠辨帶浠禵________________
+
+ /// <summary>
+ /// 鑷畾涔夌綉鍏虫帶浠�
+ /// </summary>
+ private class MySmartSoundControl : FrameRowControl
+ {
+
+ /// <summary>
+ /// 缃戝叧鍚嶅瓧鎺т欢
+ /// </summary>
+ private NormalViewControl btnName = null;
+
+ /// <summary>
+ /// 鑷畾闊崇鍏虫帶浠�
+ /// </summary>
+ public MySmartSoundControl()
+ {
+ this.UseClickStatu = false;
+ this.BackgroundColor = UserCenterColor.Current.White;
+ this.Height = Application.GetRealHeight(173);
+
+ //this.InitControl();
+ }
+
+
+ /// <summary>
+ /// 鍒濆鍖栨帶浠�
+ /// </summary>
+ public void InitControl()
+ {
+ //鍥炬爣
+ var btnIcon = this.AddLeftIcon(81);
+ btnIcon.UnSelectedImagePath = "SmartSound/SoundIcon.png";
+
+ //鏄剧ず鏂囨湰
+ btnName = this.AddLeftCaption(string.Empty, 700);
+ btnName.Height = Application.GetRealHeight(60);
+ btnName.TextSize = 15;
+ btnName.Y = Application.GetRealHeight(57);
+ btnName.Text = "鏅鸿兘闊崇";
+
+ this.AddRightArrow();
+ this.AddMostRightView("", 300, false).Name = "smartSoundLayout";
+ this.AddBottomLine();
+ }
+ }
#endregion
}
}
--
Gitblit v1.8.0