| | |
| | | listView.BeginHeaderRefreshingAction += () =>
|
| | | {
|
| | | //刷新设备的话,主页需要重新刷新
|
| | | UserView.UserPage.Instance.RefreshForm = true;
|
| | | UserView.UserPage.Instance.RefreshAllForm = true;
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | |
| | | btnPosition.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //定位
|
| | | Common.LocalDevice.Current.SetFixedPositionCommand(listdevice[0]);
|
| | | Common.LocalDevice.Current.SetFixedPositionCommand(listdevice[0], true);
|
| | | };
|
| | | }
|
| | |
|
| | |
| | | btnRight.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //回路数大于1才展开
|
| | | if (Common.LocalDevice.Current.GetDevicesCountByMac(deviceMac) > 1)
|
| | | var listMacDevice = LocalDevice.Current.GetDevicesByMac(deviceMac, false);
|
| | | if (listMacDevice.Count > 1)
|
| | | {
|
| | | btnRight.IsSelected = !btnRight.IsSelected;
|
| | | //展开或者折叠明细列表
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if (LocalDevice.Current.IsMiniLight(listMacDevice[0]) == true)
|
| | | {
|
| | | //mini夜灯的功能设置界面
|
| | | var room = HdlRoomLogic.Current.GetRoomByDevice(listMacDevice[0]);
|
| | | var form = new MainPage.DeviceDetailInfoForm();
|
| | | form.AddForm(listMacDevice[0], room);
|
| | | }
|
| | | else
|
| | | {
|
| | | //设备信息界面
|
| | | var form = new DeviceMacInfoEditorForm();
|
| | | form.AddForm(deviceMac);
|
| | | }
|
| | | btnNew.Visible = false;
|
| | | var form = new DeviceMacInfoEditorForm();
|
| | | form.AddForm(deviceMac);
|
| | | //界面跳转,记录当前的正在操作的设备的Mac地址
|
| | | this.nowActionDeviceMac = deviceMac;
|
| | | }
|
| | |
| | | form2.AddForm(deviceMac);
|
| | | return;
|
| | | }
|
| | | var listMacDevice = LocalDevice.Current.GetDevicesByMac(deviceMac, false);
|
| | | if (listMacDevice.Count > 0 && LocalDevice.Current.IsMiniLight(listMacDevice[0]) == true)
|
| | | {
|
| | | //mini夜灯的功能设置界面
|
| | | var room = HdlRoomLogic.Current.GetRoomByDevice(listMacDevice[0]);
|
| | | var form = new MainPage.DeviceDetailInfoForm();
|
| | | form.AddForm(listMacDevice[0], room);
|
| | | }
|
| | | else
|
| | | {
|
| | | //设备信息界面
|
| | | var form = new DeviceMacInfoEditorForm();
|
| | | form.AddForm(deviceMac);
|
| | | }
|
| | |
|
| | | btnNew.Visible = false;
|
| | | var form = new DeviceMacInfoEditorForm();
|
| | | form.AddForm(deviceMac);
|
| | | //界面跳转,记录当前的正在操作的设备的Mac地址
|
| | | this.nowActionDeviceMac = deviceMac;
|
| | | };
|
| | |
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
|
| | | if (isShow == true)
|
| | | {
|
| | | //备注:面板中只显示真实的设备,其他属于绑定的回路不显示
|
| | | //获取这一堆设备时属于什么类型的
|
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
|
| | | if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
|
| | | {
|
| | | var listTemp = Common.LocalDevice.Current.GetMutilfunctionPanelByMac(listDevice);
|
| | | //展开模式时,扩大依据为:它有几个子控件
|
| | | heightValue = (listTemp.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
|
| | | //标题自己就是一个子控件
|
| | | if (rowInfo.frameTable.ChildrenCount == 1)
|
| | | {
|
| | | foreach (CommonDevice info in listTemp)
|
| | | {
|
| | | //加载它的列表
|
| | | this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo);
|
| | | }
|
| | | }
|
| | | }
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir
|
| | | || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment
|
| | | || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEnvironment)
|
| | | {
|
| | | var listTemp = Common.LocalDevice.Current.GetPanelMatchEpointByMac(listDevice);
|
| | | //展开模式时,扩大依据为:它有几个子控件
|
| | | heightValue = (listTemp.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
|
| | | //标题自己就是一个子控件
|
| | |
| | | var form = new DeviceMacInfoEditorForm();
|
| | | form.AddForm(device.DeviceAddr);
|
| | | }
|
| | | else if (deviceEnumInfo.BeloneType == DeviceBeloneType.A晾衣架)
|
| | | {
|
| | | var form = new DeviceMacInfoEditorForm();
|
| | | form.AddForm(device.DeviceAddr);
|
| | | }
|
| | | else if (deviceEnumInfo.BeloneType == DeviceBeloneType.A空气质量)
|
| | | {
|
| | | var form = new DeviceMacInfoEditorForm();
|
| | | form.AddForm(device.DeviceAddr);
|
| | | }
|
| | | else if (deviceEnumInfo.BeloneType == DeviceBeloneType.A窗帘)
|
| | | {
|
| | | var form = new DeviceMacInfoEditorForm();
|
| | |
| | | var form = new DeviceAirConditioner.IndoorUnitSettionForm();
|
| | | form.AddForm((AC)device);
|
| | | }
|
| | | //环境面板
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEnvironment)
|
| | | {
|
| | | var form = new DeviceFunctionSettionForm();
|
| | | form.AddForm(device, true);
|
| | | }
|
| | | //新风面板
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
|
| | | {
|
| | |
| | | //干接点
|
| | | if (device.Type == DeviceType.FreshAir)
|
| | | {
|
| | | var form = new DevicePanel.PanelFangyueFreshAirButtonSettionForm();
|
| | | var form = new DevicePanel.PanelSettionWithSourceForm();
|
| | | form.AddForm(device);
|
| | | }
|
| | | else
|
| | |
| | | var form = new DeviceFunctionSettionForm();
|
| | | form.AddForm(device, true);
|
| | | }
|
| | | }
|
| | | //简约环境面板的按键配置
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment)
|
| | | {
|
| | |
|
| | | if (device.Type == DeviceType.FreshAir || device.Type == DeviceType.Thermostat)
|
| | | {
|
| | | var form = new DevicePanel.PanelSettionWithSourceForm();
|
| | | form.AddForm(device);
|
| | | }
|
| | | else
|
| | | {
|
| | | var form = new DeviceFunctionSettionForm();
|
| | | form.AddForm(device, true);
|
| | | }
|
| | | }
|
| | | //简约多功能面板的按键配置
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
|
| | | {
|
| | | var form = new DeviceFunctionSettionForm();
|
| | | form.AddForm(device, true);
|
| | | }
|
| | | //方悦面板
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueTwo
|
| | |
| | | {
|
| | | lock (dicRowInfo)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (this.listView == null)
|
| | | {
|
| | |
| | | /// <summary>
|
| | | /// 滑动控件下拉刷新
|
| | | /// </summary>
|
| | | private async void ListViewBeginHeaderRefreshing()
|
| | | private void ListViewBeginHeaderRefreshing()
|
| | | {
|
| | | //如果当前住宅是虚拟的
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | |
| | | }
|
| | | //如果是在线的
|
| | | var nowGateway = HdlGatewayLogic.Current.GetLocalGateway(GatewayResourse.NowSelectGatewayId);
|
| | | if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(nowGateway) == true)
|
| | | if (HdlGatewayLogic.Current.CheckGatewayOnlineByMemory(nowGateway) == true)
|
| | | {
|
| | | //检测广播到的这个网关是否拥有住宅ID
|
| | | ZbGateway realWay = null;
|
| | |
| | | {
|
| | | //显示进度条
|
| | | ProgressBar.Show();
|
| | | int result2 = await HdlGatewayLogic.Current.ReBindNewGateway(realWay);
|
| | | int result2 = HdlGatewayLogic.Current.ReBindNewGateway(realWay);
|
| | | //关闭进度条
|
| | | ProgressBar.Close();
|
| | | if (result2 == -1)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //隐藏下拉刷新特效
|
| | | listView.EndHeaderRefreshing();
|
| | | });
|
| | | return;
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | //获取全部设备
|
| | | int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(nowGateway);
|
| | | int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(nowGateway.GwId, false);
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | |
| | | //刷新网关在线状态
|
| | | HdlGatewayLogic.Current.RefreshGatewayOnlineStatu(new List<ZbGateway>() { zbGateway });
|
| | |
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (this.gatewayViewRow != null && this.gatewayViewRow.zbGatewayId == selectGwId)
|
| | | {
|
| | | bool online = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbGateway);
|
| | | bool online = HdlGatewayLogic.Current.CheckGatewayOnlineByMemory(zbGateway);
|
| | | //刷新控件在线状态
|
| | | this.gatewayViewRow?.RefreshOnlineStatu();
|
| | | //根据网关在线状态刷新设备在线状态
|
| | |
| | | }
|
| | | if (gateWay.GwId == this.gatewayViewRow.zbGatewayId)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //相同的状态,不需要再次刷新
|
| | | if (this.gatewayViewRow.isOnline != online)
|
| | |
| | | string gwId = GatewayResourse.NowSelectGatewayId;
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | System.Threading.Thread.Sleep(2000);
|
| | | //这里主要只是获取在线状态
|
| | | var list = LocalDevice.Current.GetDeviceOnlineList(gwId);
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | if (this.Parent == null) { return; }
|
| | | //获取设备列表
|
| | | var listDevice = Common.LocalDevice.Current.GetDeviceByGatewayID(gwId);
|
| | | var listCheck = new List<string>();
|
| | | foreach (var device in listDevice)
|
| | | {
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | if (this.Parent == null) { return; }
|
| | | if (listCheck.Contains(device.DeviceAddr) == false)
|
| | | {
|
| | | //设置设备在线状态
|
| | | this.ReceiveDeviceStatu(list[i]);
|
| | | //只要一个回路即可
|
| | | listCheck.Add(device.DeviceAddr);
|
| | | var deviceInfo = Common.LocalDevice.Current.ReadDeviceEpointDeviceInfo(device);
|
| | | if (deviceInfo != null)
|
| | | {
|
| | | //变更在线状态
|
| | | device.IsOnline = deviceInfo.IsOnline;
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //设置设备在线状态
|
| | | this.ReceiveDeviceStatu(device);
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | | System.Threading.Thread.Sleep(50);
|
| | | }
|
| | |
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
|
| | | if (localDevice != null)
|
| | | {
|
| | | //在线状态一样的话,不需要刷新
|
| | | if (localDevice.IsOnline != device.IsOnline)
|
| | | {
|
| | | //保存状态
|
| | | localDevice.IsOnline = device.IsOnline;
|
| | | localDevice.ReSave();
|
| | | }
|
| | | //保存状态
|
| | | localDevice.IsOnline = device.IsOnline;
|
| | | }
|
| | |
|
| | | rowInfo.MenuRow.IsOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(device);
|
| | |
| | | /// <param name="list">ota设备</param>
|
| | | private void CheckDeviceNewVersion(List<OTADevice> list)
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | await System.Threading.Tasks.Task.Delay(2000);
|
| | | System.Threading.Thread.Sleep(2000);
|
| | | foreach (var ota in list)
|
| | | {
|
| | | if (this.Parent == null)
|
| | |
| | | return;
|
| | | }
|
| | | //添加升级固件信息(成不成功都无所谓)
|
| | | var result = await HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.ZigbeeDevice, ota.HwVersion.ToString(), ota.ImgTypeId.ToString());
|
| | | var result = HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.A设备, ota.HwVersion.ToString(), ota.ImgTypeId.ToString());
|
| | |
|
| | | //获取设备最新版本
|
| | | var deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.ZigbeeDevice,
|
| | | var deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.A设备,
|
| | | ota.HwVersion.ToString(),
|
| | | ota.ImgTypeId.ToString(),
|
| | | ota.ImgVersion);
|
| | |
| | | }
|
| | |
|
| | | //拥有新版本
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (this.dicRowInfo.ContainsKey(ota.DeviceAddr) == true)
|
| | | {
|
| | |
| | | }
|
| | | });
|
| | | }
|
| | | });
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | {
|
| | | if (this.dicRowInfo.ContainsKey(deviceAddr) == true)
|
| | | {
|
| | | var row = this.dicRowInfo[deviceAddr];
|
| | | row.MenuRow?.RefreshControlInfo(true);
|
| | | //明细
|
| | | if (row.dicDetailRow != null)
|
| | | var rowInfo = this.dicRowInfo[deviceAddr];
|
| | | //检测这个设备是否被删除 2020.01.13变更:追加Ota设备的判断
|
| | | if (LocalDevice.Current.GetDevicesByMac(deviceAddr).Count == 0
|
| | | && LocalDevice.Current.GetOTADevice(deviceAddr) == null)
|
| | | {
|
| | | foreach (var detailRow in row.dicDetailRow.Values)
|
| | | //移除控件
|
| | | rowInfo.dicDetailRow = null;
|
| | | rowInfo.frameTable.RemoveFromParent();
|
| | |
|
| | | this.dicRowInfo.Remove(deviceAddr);
|
| | | }
|
| | | else
|
| | | {
|
| | | //刷新设备信息
|
| | | rowInfo.MenuRow?.RefreshControlInfo(true);
|
| | | if (rowInfo.dicDetailRow != null)
|
| | | {
|
| | | detailRow.RefreshControlInfo();
|
| | | foreach (var contr in rowInfo.dicDetailRow.Values)
|
| | | {
|
| | | contr?.RefreshControlInfo();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | if (device == null || device.DeviceAddr == null)
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | | //获取设备类型的
|
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_SimpleEnvironment)
|
| | | {
|
| | | foreach (var outClu in device.OutClusterList)
|
| | | {
|
| | | //去掉简约环境面板类的各种服务端设备,室内机不显示
|
| | | if (outClu.OutCluster == 513)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | }
|
| | | }
|
| | | if (dic.ContainsKey(device.DeviceAddr) == false)
|
| | | {
|
| | |
| | | /// </summary>
|
| | | public override int FormActionAgainEvent()
|
| | | {
|
| | | if (GatewayResourse.AppOldSelectGatewayId != this.gatewayViewRow.zbGatewayId)
|
| | | {
|
| | | //这个网关被整掉了,需要重新初始化界面
|
| | | this.nowActionDeviceMac = null;
|
| | | this.oldShowRightMuneRow = null;
|
| | | //重新选择网关
|
| | | HdlGatewayLogic.Current.RefreshAppOldSelectGatewayId();
|
| | |
|
| | | //初始化界面
|
| | | this.InitMiddleFrame();
|
| | |
|
| | | return 1;
|
| | | }
|
| | |
|
| | | if (this.nowActionDeviceMac != null)
|
| | | {
|
| | | var rowInfo = this.dicRowInfo[nowActionDeviceMac];
|
| | | //检测这个设备是否被删除 2020.01.13变更:追加Ota设备的判断
|
| | | if (Common.LocalDevice.Current.GetDevicesByMac(nowActionDeviceMac).Count == 0
|
| | | && Common.LocalDevice.Current.GetOTADevice(nowActionDeviceMac) == null)
|
| | | {
|
| | | //移除控件
|
| | | rowInfo.dicDetailRow = null;
|
| | | rowInfo.frameTable.RemoveFromParent();
|
| | |
|
| | | this.dicRowInfo.Remove(nowActionDeviceMac);
|
| | | rowInfo = null;
|
| | | }
|
| | | else
|
| | | {
|
| | | //刷新设备信息
|
| | | rowInfo.MenuRow?.RefreshControlInfo(true);
|
| | | if (rowInfo.dicDetailRow != null)
|
| | | {
|
| | | foreach (var contr in rowInfo.dicDetailRow.Values)
|
| | | {
|
| | | contr?.RefreshControlInfo();
|
| | | }
|
| | | }
|
| | | }
|
| | | //刷新指定设备行的信息
|
| | | this.RefreshDeviceRow(this.nowActionDeviceMac);
|
| | | }
|
| | | //清空记录
|
| | | this.nowActionDeviceMac = null;
|
| | |
| | | /// </summary>
|
| | | private NormalViewControl btnName = null;
|
| | | /// <summary>
|
| | | /// 在线状态
|
| | | /// 在线状态(初始状态为在线)
|
| | | /// </summary>
|
| | | public bool isOnline = false;
|
| | | public bool isOnline = true;
|
| | |
|
| | | /// <summary>
|
| | | /// 自定义网关控件
|
| | |
| | | {
|
| | | btnName.Text = HdlGatewayLogic.Current.GetGatewayName(zbway);
|
| | | //在线状态
|
| | | this.isOnline = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway);
|
| | | if (this.isOnline == false)
|
| | | {
|
| | | btnName.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | }
|
| | | //this.isOnline = HdlGatewayLogic.Current.CheckGatewayOnlineByMemory(zbway);
|
| | | //if (this.isOnline == false)
|
| | | //{
|
| | | // btnName.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | //}
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | return;
|
| | | }
|
| | | //在线状态
|
| | | bool statu = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway);
|
| | | bool statu = HdlGatewayLogic.Current.CheckGatewayOnlineByMemory(zbway);
|
| | | if (this.isOnline != statu)
|
| | | {
|
| | | this.isOnline = statu;
|
| | |
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 自定义智能音箱控件_____________________
|
| | | #region ■ 自定义智能音箱控件_________________
|
| | |
|
| | | /// <summary>
|
| | | /// 自定义网关控件
|
| | |
| | | btnName.Height = Application.GetRealHeight(60);
|
| | | btnName.TextSize = 15;
|
| | | btnName.Y = Application.GetRealHeight(57);
|
| | | btnName.Text = "小度小度";
|
| | | btnName.Text = "智能音箱";
|
| | |
|
| | | this.AddRightArrow();
|
| | | this.AddMostRightView("", 300, false).Name = "smartSoundLayout";
|