From 160785587667cc0d927f85e44c139ec9dde13a9e Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 25 十一月 2019 14:30:13 +0800 Subject: [PATCH] 原来的 IOS 工程舍弃(注:没有合并其他组员的代码) --- ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs | 153 +++++++++++++++++++++++---------------------------- 1 files changed, 69 insertions(+), 84 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs index 75e2850..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 @@ -173,13 +190,6 @@ this.AddDeviceMenuRow(macAddress); } - //娣诲姞搴曢儴闂撮殭 - var frameTemp = new FrameLayout(); - frameTemp.Height = Application.GetRealHeight(23); - listView.AddChidren(frameTemp); - - //寮�鍚澶囧睘鎬у彉鏇寸洃鍚� - this.AddDeviceAttributePush(); //寮�鍚綉鍏冲湪绾跨洃娴嬬殑绾跨▼ this.StartGatewayOnlieCheckThread(); //妫�娴嬭澶囨柊鐗堟湰 @@ -567,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> /// 寮�鍚澶囧湪绾跨嚎绋� @@ -609,10 +597,6 @@ this.StartCheckDeviceOnline(); } - #endregion - - #region 鈻� 璁惧鍦ㄧ嚎___________________________ - /// <summary> /// 寮�鍚澶囧湪绾跨洃娴� /// </summary> @@ -623,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) { @@ -707,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> @@ -756,32 +767,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 @@ -851,23 +836,6 @@ #endregion - #region 鈻� 鍏抽棴鐣岄潰___________________________ - - /// <summary> - /// 鐢婚潰鍏抽棴 - /// </summary> - public override void CloseForm() - { - HdlDeviceAttributeLogic.Current.RemoveEvent("DeviceListFormSensor"); - HdlDeviceAttributeLogic.Current.RemoveEvent("DeviceListFormReceivePushOnline"); - - GatewayResourse.NowSelectGateway = null; - - base.CloseForm(); - } - - #endregion - #region 鈻� 鐣岄潰閲嶆柊婵�娲讳簨浠禵__________________ /// <summary> @@ -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