From 74a9ba8e9a2df9c39f9c2eb212a5ac889a055cd4 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 03 十二月 2019 10:47:51 +0800
Subject: [PATCH] 优化UI细节(请合并最新代码)
---
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs | 165 +++++++++++++++++++++++++------------------------------
1 files changed, 75 insertions(+), 90 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
index db02ddd..1d82707 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
@@ -20,7 +20,7 @@
/// <summary>
/// 鍒楄〃鎺т欢
/// </summary>
- private VerticalListControl listView = null;
+ private VerticalListRefreshControl listView = null;
/// <summary>
/// 琛屾帶浠剁殑淇℃伅(Keys锛歁ac鍦板潃)
/// </summary>
@@ -90,8 +90,6 @@
this.gatewayViewRow = new MyGatewayControl(GatewayResourse.NowSelectGateway);
bodyFrameLayout.AddChidren(gatewayViewRow);
gatewayViewRow.InitControl();
- //璁剧疆缃戝叧鎺ュ彈鍦ㄧ嚎鐘舵�佹帹閫�
- this.AddGatewayOnlinePush();
//鍒濆鍖栨悳绱㈡帶浠�
this.InitSearchControl();
@@ -128,10 +126,29 @@
txtSearchControl.BindEvent(this.SetRowDataBySearchKeys);
//鍒楄〃鎺т欢
- listView = new VerticalListControl(29);
+ listView = new VerticalListRefreshControl(29);
listView.Y = txtSearchControl.Bottom + Application.GetRealHeight(29);
listView.Height = frame.Height - txtSearchControl.Bottom - Application.GetRealHeight(29);
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);
+ }
+ });
+ });
+ };
}
#endregion
@@ -158,12 +175,8 @@
//鏍规嵁MAC鍚堝苟璁惧鍒楄〃
this.MargeAllDeviceByMac(listDevice);
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
- if (this.Parent == null)
- {
- return;
- }
var listOta = new List<OTADevice>();
foreach (var macAddress in this.dicRowInfo.Keys)
{
@@ -176,13 +189,7 @@
//娣诲姞璁惧鐨勮彍鍗曡
this.AddDeviceMenuRow(macAddress);
}
- //娣诲姞搴曢儴闂撮殭
- var frameTemp = new FrameLayout();
- frameTemp.Height = Application.GetRealHeight(23);
- listView.AddChidren(frameTemp);
- //寮�鍚澶囧睘鎬у彉鏇寸洃鍚�
- this.AddDeviceAttributePush();
//寮�鍚綉鍏冲湪绾跨洃娴嬬殑绾跨▼
this.StartGatewayOnlieCheckThread();
//妫�娴嬭澶囨柊鐗堟湰
@@ -570,29 +577,7 @@
#endregion
- #region 鈻� 璁惧灞炴�у彉鏇存帹閫乢__________________
-
- /// <summary>
- /// 璁惧灞炴�у彉鏇存帹閫�
- /// </summary>
- /// <param name="device"></param>
- public override void DeviceAttributePush(CommonDevice device)
- {
- if (dicRowInfo.ContainsKey(device.DeviceAddr) == false)
- {
- return;
- }
- var rowInfo = dicRowInfo[device.DeviceAddr];
- Application.RunOnMainThread(() =>
- {
- //鍒锋柊鑿滃崟
- rowInfo.MenuRow?.RefreshControlInfo(false);
- });
- }
-
- #endregion
-
- #region 鈻� 寮�鍚澶囧湪绾跨嚎绋媉__________________
+ #region 鈻� 璁惧鍦ㄧ嚎妫�娴媉______________________
/// <summary>
/// 寮�鍚澶囧湪绾跨嚎绋�
@@ -612,10 +597,6 @@
this.StartCheckDeviceOnline();
}
- #endregion
-
- #region 鈻� 璁惧鍦ㄧ嚎___________________________
-
/// <summary>
/// 寮�鍚澶囧湪绾跨洃娴�
/// </summary>
@@ -626,20 +607,24 @@
{
return;
}
+
+ //娣诲姞鎺ユ敹璁惧鍦ㄧ嚎涓婃姤鐨勭洃鍚�
+ HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceListFormReceivePushOnline", ReceiveComandDiv.A璁惧鍦ㄧ嚎涓婃姤, this.ReceiveDeviceStatu);
+
string gwId = HdlGatewayLogic.Current.GetGatewayId(GatewayResourse.NowSelectGateway);
HdlThreadLogic.Current.RunThread(() =>
{
//杩欓噷涓昏鍙槸鑾峰彇鍦ㄧ嚎鐘舵��
var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId);
- var result = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, this.ReceiveDeviceStatuPush, ShowErrorMode.NO);
+ var result = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, this.ReceiveDeviceStatu, ShowErrorMode.NO);
});
}
/// <summary>
- /// 鎺ュ彈璁惧鍦ㄧ嚎鎺ㄩ��
+ /// 鎺ュ彈璁惧鐘舵��
/// </summary>
/// <param name="device"></param>
- private void ReceiveDeviceStatuPush(CommonDevice device)
+ private void ReceiveDeviceStatu(CommonDevice device)
{
lock (dicRowInfo)
{
@@ -710,6 +695,29 @@
#endregion
+ #region 鈻� 浼犳劅鍣ㄦ姤璀________________________
+
+ /// <summary>
+ /// 寮�鍚紶鎰熷櫒鎶ヨ鐩戣
+ /// </summary>
+ private void StartCheckDeviceAlarm()
+ {
+ HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceListFormSensor", ReceiveComandDiv.A浼犳劅鍣ㄤ笂鎶�, (device) =>
+ {
+ Application.RunOnMainThread(() =>
+ {
+ if (this.dicRowInfo.ContainsKey(device.DeviceAddr) == false)
+ {
+ return;
+ }
+ //鏄剧ず浼犳劅鍣ㄤ笂鎶ョ殑鐗规晥
+ this.dicRowInfo[device.DeviceAddr].MenuRow?.StartSensorPushAppeal();
+ });
+ });
+ }
+
+ #endregion
+
#region 鈻� 璁惧鏂扮増鏈琠________________________
/// <summary>
@@ -763,32 +771,6 @@
#endregion
- #region 鈻� 浼犳劅鍣ㄦ姤璀________________________
-
- /// <summary>
- /// 寮�鍚紶鎰熷櫒鎶ヨ鐩戣
- /// </summary>
- private void StartCheckDeviceAlarm()
- {
- HdlDeviceAttributeLogic.Current.AddAttributeEvent("DeviceListFormSensor", "IASInfoReport", (device) =>
- {
- Application.RunOnMainThread(() =>
- {
- if (this.dicRowInfo.ContainsKey(device.DeviceAddr) == false)
- {
- return;
- }
- var row = this.dicRowInfo[device.DeviceAddr].MenuRow;
- if (row != null)
- {
- row.frameTable.StartSelectStatuAppeal(3000);
- }
- });
- });
- }
-
- #endregion
-
#region 鈻� 瀹炵幇澶栭儴璋冪敤_______________________
/// <summary>
@@ -801,6 +783,11 @@
if (this.dicRowInfo.ContainsKey(deviceAddr) == false)
{
var localDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceAddr);
+ if (localDevice.Count == 0)
+ {
+ //鍏ョ綉涔嬪悗锛屽張鎶婂畠鍒犱簡
+ return;
+ }
var rowNewInfo = new DeviceObjRowInfo();
rowNewInfo.DeviceMac = deviceAddr;
rowNewInfo.MacName = Common.LocalDevice.Current.GetDeviceMacName(localDevice[0]);
@@ -809,8 +796,6 @@
//鍒涘缓鏂扮殑琛�
this.AddDeviceMenuRow(deviceAddr);
-
- return;
}
}
@@ -847,23 +832,6 @@
info.DeviveTypeName = Common.LocalDevice.Current.GetDeviceObjectText(dic[mac]);
this.dicRowInfo[mac] = info;
}
- }
-
- #endregion
-
- #region 鈻� 鍏抽棴鐣岄潰___________________________
-
- /// <summary>
- /// 鐢婚潰鍏抽棴
- /// </summary>
- public override void CloseForm()
- {
- HdlDeviceAttributeLogic.Current.RemoveEvent("DeviceListFormSensor");
- HdlDeviceAttributeLogic.Current.RemoveEvent("DeviceListFormReceivePushOnline");
-
- GatewayResourse.NowSelectGateway = null;
-
- base.CloseForm();
}
#endregion
@@ -911,6 +879,23 @@
#endregion
+ #region 鈻� 鍏抽棴鐣岄潰___________________________
+
+ /// <summary>
+ /// 鐢婚潰鍏抽棴
+ /// </summary>
+ public override void CloseFormBefore()
+ {
+ HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceListFormSensor");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceListFormReceivePushOnline");
+
+ GatewayResourse.NowSelectGateway = null;
+
+ base.CloseFormBefore();
+ }
+
+ #endregion
+
#region 鈻� 缁撴瀯浣撶被___________________________
/// <summary>
--
Gitblit v1.8.0