| | |
| | | /// </summary>
|
| | | public void ShowForm()
|
| | | {
|
| | | this.ScrollEnabled = false;
|
| | |
|
| | | //设置标题信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.DeviceManagement));
|
| | |
|
| | |
| | | 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();
|
| | | });
|
| | | };
|
| | | }
|
| | |
| | | //根据MAC合并设备列表
|
| | | this.MargeAllDeviceByMac(listDevice);
|
| | |
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | var listOta = new List<OTADevice>();
|
| | |
| | | rowInfo.MenuRow = rowMenu;
|
| | | //向右图标
|
| | | var btnRight = rowMenu.frameTable.AddMostRightEmptyIcon(58, 58);
|
| | | btnRight.UnSelectedImagePath = "Item/Next.png";
|
| | | btnRight.UnSelectedImagePath = "Item/RightNext.png";
|
| | | btnRight.SelectedImagePath = "Item/Down.png";
|
| | | rowMenu.frameTable.ChangedChidrenBindMode(btnRight, ChidrenBindMode.NotBind);
|
| | |
|
| | |
| | | //pir传感器
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.Sensor_Pir)
|
| | | {
|
| | | var form = new DevicePirSensor.PirSensorBindTargetSettionForm();
|
| | | form.AddForm((IASZone)device);
|
| | | if (device is IASZone)
|
| | | {
|
| | | var form = new DevicePirSensor.PirSensorBindTargetSettionForm();
|
| | | form.AddForm((IASZone)device);
|
| | | }
|
| | | else
|
| | | {
|
| | | //pir传感器,他们又搞了个继电器在里面
|
| | | var form = new DeviceFunctionSettionForm();
|
| | | form.AddForm(device, true);
|
| | | }
|
| | | }
|
| | | //中央空调
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.AirConditioner_ZbGateway)
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 下拉刷新___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 滑动控件下拉刷新
|
| | | /// </summary>
|
| | | private async void ListViewBeginHeaderRefreshing()
|
| | | {
|
| | | //如果是在线的
|
| | | if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(GatewayResourse.NowSelectGateway) == true)
|
| | | {
|
| | | //检测广播到的这个网关是否拥有住宅ID
|
| | | 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>
|
| | |
| | | {
|
| | | //这里主要只是获取在线状态
|
| | | 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]);
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | /// <param name="device"></param>
|
| | | private void ReceiveDeviceStatu(CommonDevice device)
|
| | | {
|
| | | lock (dicRowInfo)
|
| | | DeviceObjRowInfo rowInfo = null;
|
| | | if (this.dicRowInfo.ContainsKey(device.DeviceAddr) == true)
|
| | | {
|
| | | if (this.Parent == null)
|
| | | rowInfo = this.dicRowInfo[device.DeviceAddr];
|
| | | }
|
| | | if (rowInfo == null || rowInfo.MenuRow == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //刷新设备的在线状态
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
|
| | | if (localDevice != null)
|
| | | {
|
| | | //在线状态一样的话,不需要刷新
|
| | | if (localDevice.IsOnline == device.IsOnline)
|
| | | {
|
| | | return;
|
| | | }
|
| | | DeviceObjRowInfo rowInfo = null;
|
| | | if (this.dicRowInfo.ContainsKey(device.DeviceAddr) == true)
|
| | | {
|
| | | rowInfo = this.dicRowInfo[device.DeviceAddr];
|
| | | }
|
| | | if (rowInfo == null || rowInfo.MenuRow == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //刷新设备的在线状态
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
|
| | | if (localDevice != null)
|
| | | {
|
| | | //在线状态一样的话,不需要刷新
|
| | | if (localDevice.IsOnline == device.IsOnline)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //保存状态
|
| | | localDevice.IsOnline = device.IsOnline;
|
| | | localDevice.ReSave();
|
| | | }
|
| | | //保存状态
|
| | | localDevice.IsOnline = device.IsOnline;
|
| | | localDevice.ReSave();
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (rowInfo != null)
|
| | | {
|
| | | if (rowInfo != null)
|
| | | rowInfo.MenuRow.isOnline = device.IsOnline == 1;
|
| | | if (rowInfo.dicDetailRow != null)
|
| | | {
|
| | | rowInfo.MenuRow.isOnline = device.IsOnline == 1;
|
| | | if (rowInfo.dicDetailRow != null)
|
| | | foreach (var detailRow in rowInfo.dicDetailRow.Values)
|
| | | {
|
| | | foreach (var detailRow in rowInfo.dicDetailRow.Values)
|
| | | {
|
| | | detailRow.isOnline = rowInfo.MenuRow.isOnline;
|
| | | }
|
| | | detailRow.isOnline = rowInfo.MenuRow.isOnline;
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | {
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceListFormSensor", ReceiveComandDiv.A传感器上报, (device) =>
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (this.dicRowInfo.ContainsKey(device.DeviceAddr) == false)
|
| | | {
|