From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 28 二月 2020 15:25:13 +0800
Subject: [PATCH] 2020.2.28
---
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs | 86 ++++++++++++++++++++++++++++++++++++-------
1 files changed, 72 insertions(+), 14 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
index b413b7b..227534e 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
@@ -43,6 +43,8 @@
/// </summary>
public void ShowForm()
{
+ this.ScrollEnabled = false;
+
//璁剧疆鏍囬淇℃伅
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.DeviceManagement));
@@ -132,21 +134,10 @@
frame.AddChidren(listView);
listView.BeginHeaderRefreshingAction += () =>
{
- //涓嬫媺鍒锋柊
HdlThreadLogic.Current.RunThread(() =>
{
- //鑾峰彇鍏ㄩ儴璁惧
- bool result = LocalDevice.Current.SetDeviceToMemmoryByGateway(GatewayResourse.NowSelectGateway);
- HdlThreadLogic.Current.RunMain(() =>
- {
- //闅愯棌涓嬫媺鍒锋柊鐗规晥
- listView.EndHeaderRefreshing();
- if (result == true)
- {
- //閲嶆柊鍒锋柊鐣岄潰
- this.InitMiddleFrame(false);
- }
- });
+ //涓嬫媺鍒锋柊
+ this.ListViewBeginHeaderRefreshing();
});
};
}
@@ -175,6 +166,10 @@
//鏍规嵁MAC鍚堝苟璁惧鍒楄〃
this.MargeAllDeviceByMac(listDevice);
+ if (this.Parent == null)
+ {
+ return;
+ }
HdlThreadLogic.Current.RunMain(() =>
{
var listOta = new List<OTADevice>();
@@ -528,6 +523,60 @@
#endregion
+ #region 鈻� 涓嬫媺鍒锋柊___________________________
+
+ /// <summary>
+ /// 婊戝姩鎺т欢涓嬫媺鍒锋柊
+ /// </summary>
+ private async void ListViewBeginHeaderRefreshing()
+ {
+ //濡傛灉鏄湪绾跨殑
+ if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(GatewayResourse.NowSelectGateway) == true)
+ {
+ //妫�娴嬪箍鎾埌鐨勮繖涓綉鍏虫槸鍚︽嫢鏈変綇瀹匢D
+ ZbGateway realWay = null;
+ if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, GatewayResourse.NowSelectGateway) == true)
+ {
+ //閲嶆柊璁剧疆浣忓畢ID(杩欎釜搴旇鏄笉缁忚繃APP,鐩存帴鎶婄綉鍏虫仮澶嶄簡鍑哄巶璁剧疆)
+ if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.getGatewayBaseInfo.HomeId) == true)
+ {
+ //鏄剧ず杩涘害鏉�
+ ProgressBar.Show();
+ int result2 = await HdlGatewayLogic.Current.ReBindNewGateway(realWay);
+ //鍏抽棴杩涘害鏉�
+ ProgressBar.Close();
+ if (result2 == -1)
+ {
+ return;
+ }
+ }
+ }
+ }
+ if (this.Parent == null)
+ {
+ return;
+ }
+
+ //鑾峰彇鍏ㄩ儴璁惧
+ int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(GatewayResourse.NowSelectGateway);
+ if (this.Parent == null)
+ {
+ return;
+ }
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ //闅愯棌涓嬫媺鍒锋柊鐗规晥
+ listView.EndHeaderRefreshing();
+ if (result != -1)
+ {
+ //閲嶆柊鍒锋柊鐣岄潰
+ this.InitMiddleFrame(false);
+ }
+ });
+ }
+
+ #endregion
+
#region 鈻� 缃戝叧鍦ㄧ嚎妫�娴媉______________________
/// <summary>
@@ -625,7 +674,16 @@
{
//杩欓噷涓昏鍙槸鑾峰彇鍦ㄧ嚎鐘舵��
var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId);
- var result = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, this.ReceiveDeviceStatu, ShowErrorMode.NO);
+ int statu = 0;
+ var list = LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
+ if (statu != -1)
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ //璁剧疆璁惧鍦ㄧ嚎鐘舵��
+ this.ReceiveDeviceStatu(list[i]);
+ }
+ }
});
}
--
Gitblit v1.8.0