| | |
| | | //初始化搜索控件
|
| | | this.InitSearchControl();
|
| | |
|
| | | new System.Threading.Thread(() =>
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //初始化设备列表控件
|
| | | this.InitDeviceListControl();
|
| | | })
|
| | | { IsBackground = true }.Start();
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | private void AddDeviceDetailRow(FrameListControl frame, CommonDevice device)
|
| | | {
|
| | | var rowInfo = this.dicRowInfo[device.DeviceAddr];
|
| | | rowInfo.dicDetailRow = new Dictionary<string, DeviceRoomControl>();
|
| | | if (rowInfo.dicDetailRow == null)
|
| | | {
|
| | | rowInfo.dicDetailRow = new Dictionary<string, DeviceRoomControl>();
|
| | | }
|
| | |
|
| | | //行控件
|
| | | var rowDevice = new DeviceRoomControl(device, frame.rowSpace / 2);
|
| | |
| | | rowDevice.frameTable.AddBottomLine();
|
| | | //右箭头
|
| | | rowDevice.frameTable.AddRightArrow();
|
| | | //在线状态
|
| | | rowDevice.isOnline = device.IsOnline == 1;
|
| | |
|
| | | //保存控件
|
| | | string maikey = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | |
| | | }
|
| | |
|
| | | string selectGwId = HdlGatewayLogic.Current.GetGatewayId(GatewayResourse.NowSelectGateway);
|
| | | new System.Threading.Thread(() =>
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | ZbGateway zbGateway = HdlGatewayLogic.Current.GetLocalGateway(selectGwId);
|
| | | if (zbGateway == null)
|
| | |
| | | this.StartDeviceListControlThread(online);
|
| | | }
|
| | | });
|
| | | })
|
| | | { IsBackground = true }.Start();
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | return;
|
| | | }
|
| | | string gwId = HdlGatewayLogic.Current.GetGatewayId(GatewayResourse.NowSelectGateway);
|
| | | new System.Threading.Thread(async () =>
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | //这里主要只是获取在线状态
|
| | | var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId);
|
| | | var result = await Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, this.ReceiveDeviceStatuPush);
|
| | | })
|
| | | { IsBackground = true }.Start();
|
| | | var result = await Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, this.ReceiveDeviceStatuPush, ShowErrorMode.NO);
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 接受设备在线推送(网关在线推送即在线)
|
| | | /// 接受设备在线推送
|
| | | /// </summary>
|
| | | /// <param name="device"></param>
|
| | | private void ReceiveDeviceStatuPush(CommonDevice device)
|
| | | {
|
| | | lock (dicRowInfo)
|
| | | {
|
| | | if (device == null || this.Parent == null)
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | DeviceObjectControl row = null;
|
| | | DeviceObjRowInfo rowInfo = null;
|
| | | if (this.dicRowInfo.ContainsKey(device.DeviceAddr) == true)
|
| | | {
|
| | | row = this.dicRowInfo[device.DeviceAddr].MenuRow;
|
| | | rowInfo = this.dicRowInfo[device.DeviceAddr];
|
| | | }
|
| | | if (row == null)
|
| | | if (rowInfo == null || rowInfo.MenuRow == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | localDevice.ReSave();
|
| | | }
|
| | |
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (row != null)
|
| | | if (rowInfo != null)
|
| | | {
|
| | | row.isOnline = device.IsOnline == 1;
|
| | | rowInfo.MenuRow.isOnline = device.IsOnline == 1;
|
| | | if (rowInfo.dicDetailRow != null)
|
| | | {
|
| | | foreach (var detailRow in rowInfo.dicDetailRow.Values)
|
| | | {
|
| | | detailRow.isOnline = rowInfo.MenuRow.isOnline;
|
| | | }
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | /// <param name="list">ota设备</param>
|
| | | private void CheckDeviceNewVersion(List<OTADevice> list)
|
| | | {
|
| | | new System.Threading.Thread(async () =>
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | await System.Threading.Tasks.Task.Delay(2000);
|
| | | foreach (var ota in list)
|
| | |
| | | }
|
| | | });
|
| | | }
|
| | | })
|
| | | { IsBackground = true }.Start();
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | /// <param name="listDevice"></param>
|
| | | private void MargeAllDeviceByMac(List<CommonDevice> listDevice)
|
| | | {
|
| | | //设备排序
|
| | | List<CommonDevice> listSort = Common.LocalDevice.Current.SortDeviceList(listDevice);
|
| | | //根据Mac全部分组
|
| | | var dic = new Dictionary<string, List<CommonDevice>>();
|
| | | foreach (CommonDevice device in listSort)
|
| | | foreach (CommonDevice device in listDevice)
|
| | | {
|
| | | if (device == null || device.DeviceAddr == null)
|
| | | {
|
| | |
| | | /// <summary>
|
| | | /// 自身的上层界面关闭后,它自身处于最上层时,触发的事件
|
| | | /// </summary>
|
| | | public override void FormActionAgainEvent()
|
| | | public override int FormActionAgainEvent()
|
| | | {
|
| | | if (this.nowActionDeviceMac == null)
|
| | | {
|
| | | return;
|
| | | return 1;
|
| | | }
|
| | | var rowInfo = this.dicRowInfo[nowActionDeviceMac];
|
| | | //检测这个设备是否被删除
|
| | |
| | | this.nowActionDeviceMac = null;
|
| | | //网关控件刷新
|
| | | this.gatewayViewRow.RefreshControl();
|
| | |
|
| | | return 1;
|
| | | }
|
| | |
|
| | | #endregion
|