| | |
| | | /// <summary>
|
| | | /// 列表控件
|
| | | /// </summary>
|
| | | private VerticalListControl listView = null;
|
| | | private VerticalListRefreshControl listView = null;
|
| | | /// <summary>
|
| | | /// 行控件的信息(Keys:Mac地址)
|
| | | /// </summary>
|
| | |
| | | this.gatewayViewRow = new MyGatewayControl(GatewayResourse.NowSelectGateway);
|
| | | bodyFrameLayout.AddChidren(gatewayViewRow);
|
| | | gatewayViewRow.InitControl();
|
| | | //设置网关接受在线状态推送
|
| | | this.AddGatewayOnlinePush();
|
| | |
|
| | | //初始化搜索控件
|
| | | this.InitSearchControl();
|
| | |
| | | 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
|
| | |
| | | this.AddDeviceMenuRow(macAddress);
|
| | | }
|
| | |
|
| | | //添加底部间隙
|
| | | var frameTemp = new FrameLayout();
|
| | | frameTemp.Height = Application.GetRealHeight(23);
|
| | | listView.AddChidren(frameTemp);
|
| | |
|
| | | //开启设备属性变更监听
|
| | | this.AddDeviceAttributePush();
|
| | | //开启网关在线监测的线程
|
| | | this.StartGatewayOnlieCheckThread();
|
| | | //检测设备新版本
|
| | |
| | |
|
| | | #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>
|
| | | /// 开启设备在线线程
|
| | |
| | | this.StartCheckDeviceOnline();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 设备在线___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 开启设备在线监测
|
| | | /// </summary>
|
| | |
| | | {
|
| | | 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)
|
| | | {
|
| | |
| | |
|
| | | #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>
|
| | |
| | | });
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | #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
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 关闭界面___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 画面关闭
|
| | | /// </summary>
|
| | | public override void CloseForm()
|
| | | {
|
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("DeviceListFormSensor");
|
| | | HdlDeviceAttributeLogic.Current.RemoveEvent("DeviceListFormReceivePushOnline");
|
| | |
|
| | | GatewayResourse.NowSelectGateway = null;
|
| | |
|
| | | base.CloseForm();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 界面重新激活事件___________________
|
| | |
|
| | | /// <summary>
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 关闭界面___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 画面关闭
|
| | | /// </summary>
|
| | | public override void CloseFormBefore()
|
| | | {
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceListFormSensor");
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceListFormReceivePushOnline");
|
| | |
|
| | | GatewayResourse.NowSelectGateway = null;
|
| | |
|
| | | base.CloseFormBefore();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 结构体类___________________________
|
| | |
|
| | | /// <summary>
|