| | |
| | | using Shared.Common;
|
| | | using Shared.Phone.UserCenter.SmartSound;
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | |
| | | public class DeviceListMainForm : EditorCommonForm
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 智能音箱
|
| | | /// </summary>
|
| | | private MySmartSoundControl smmartSoundView = null;
|
| | | /// <summary>
|
| | | /// 网关控件
|
| | | /// </summary>
|
| | |
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | smmartSoundView = new MySmartSoundControl();
|
| | | bodyFrameLayout.AddChidren(smmartSoundView);
|
| | | smmartSoundView.InitControl();
|
| | | //当前不是虚拟住宅的话
|
| | | if (Config.Instance.Home.IsVirtually == false)
|
| | | {
|
| | | smmartSoundView.ButtonClickEvent += (sernder, e) =>
|
| | | {
|
| | | var form = new SmartSoundListForm();
|
| | | form.AddForm();
|
| | | };
|
| | | }
|
| | | //初始化网关行控件
|
| | | GatewayResourse.NowSelectGatewayId = GatewayResourse.AppOldSelectGatewayId;
|
| | | var nowGateway = HdlGatewayLogic.Current.GetLocalGateway(GatewayResourse.AppOldSelectGatewayId);
|
| | |
| | | listView.BeginHeaderRefreshingAction += () =>
|
| | | {
|
| | | //刷新设备的话,主页需要重新刷新
|
| | | UserView.UserPage.Instance.RefreshForm = true;
|
| | | UserView.UserPage.Instance.RefreshAllForm = true;
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | |
| | | //提示新版本
|
| | | var btnNew = new InformationTipView(rowMenu.btnIcon);
|
| | | btnNew.Visible = false;
|
| | | rowMenu.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEventOnly);
|
| | | rowMenu.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEvent);
|
| | | rowMenu.AddTag("btnNew", btnNew);
|
| | |
|
| | | //检测设备是否拥有定位的功能
|
| | |
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
|
| | | if (isShow == true)
|
| | | {
|
| | | //展开模式时,扩大依据为:它有几个子控件
|
| | | heightValue = (listDevice.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
|
| | | //标题自己就是一个子控件
|
| | | if (rowInfo.frameTable.ChildrenCount == 1)
|
| | | //备注:面板中只显示真实的设备,其他属于绑定的回路不显示
|
| | | //获取这一堆设备时属于什么类型的
|
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
|
| | | if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
|
| | | {
|
| | | //获取这一堆设备时属于什么类型的
|
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
|
| | | foreach (CommonDevice info in listDevice)
|
| | | var listTemp = Common.LocalDevice.Current.GetMutilfunctionPanelByMac(listDevice);
|
| | | //展开模式时,扩大依据为:它有几个子控件
|
| | | heightValue = (listTemp.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
|
| | | //标题自己就是一个子控件
|
| | | if (rowInfo.frameTable.ChildrenCount == 1)
|
| | | {
|
| | | //加载它的列表
|
| | | this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo);
|
| | | foreach (CommonDevice info in listTemp)
|
| | | {
|
| | | //加载它的列表
|
| | | this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo);
|
| | | }
|
| | | }
|
| | | }
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir
|
| | | || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment)
|
| | | {
|
| | | var listTemp = Common.LocalDevice.Current.GetPanelMatchEpointByMac(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
|
| | | {
|
| | | //展开模式时,扩大依据为:它有几个子控件
|
| | | heightValue = (listDevice.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
|
| | | //标题自己就是一个子控件
|
| | | if (rowInfo.frameTable.ChildrenCount == 1)
|
| | | {
|
| | | foreach (CommonDevice info in listDevice)
|
| | | {
|
| | | //加载它的列表
|
| | | this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | form.AddForm(device, true);
|
| | | }
|
| | | }
|
| | | //简约环境面板的按键配置
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment)
|
| | | {
|
| | |
|
| | | if (device.Type == DeviceType.FreshAir || device.Type == DeviceType.Thermostat)
|
| | | {
|
| | | var form = new DevicePanel.PanelSimpleEnvironmentButtonSettionForm();
|
| | | 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
|
| | | || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFour
|
| | |
| | | {
|
| | | //方悦面板的功能配置
|
| | | var form = new DevicePanel.PanelFangyueFunctionSettionForm();
|
| | | form.AddForm(device);
|
| | | form.AddForm(device, deviceEnumInfo);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, nowGateway) == true)
|
| | | {
|
| | | //重新设置住宅ID(这个应该是不经过APP,直接把网关恢复了出厂设置)
|
| | | if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.getGatewayBaseInfo.HomeId) == true)
|
| | | if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.HomeId) == true)
|
| | | {
|
| | | //显示进度条
|
| | | ProgressBar.Show();
|
| | |
| | | /// </summary>
|
| | | /// <param name="gateWay">网关对象</param>
|
| | | /// <param name="online">在线状态变更后的状态</param>
|
| | | public override void GatewayOnlinePush(ZbGateway gateWay, bool online)
|
| | | /// <param name="hadGwOnline">2020.05.25追加:此住宅是否拥有网关在线</param>
|
| | | public override void GatewayOnlinePush(ZbGateway gateWay, bool online, bool hadGwOnline)
|
| | | {
|
| | | if (this.gatewayViewRow == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (HdlGatewayLogic.Current.GetGatewayId(gateWay) == this.gatewayViewRow.zbGatewayId)
|
| | | if (gateWay.GwId == this.gatewayViewRow.zbGatewayId)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | |
| | | 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(30);
|
| | | }
|
| | |
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
|
| | | if (localDevice != null)
|
| | | {
|
| | | //在线状态一样的话,不需要刷新
|
| | | if (localDevice.IsOnline == device.IsOnline)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //保存状态
|
| | | localDevice.IsOnline = device.IsOnline;
|
| | | localDevice.ReSave();
|
| | | }
|
| | |
|
| | | 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.ZigbeeDevice, ota.HwVersion.ToString(), ota.ImgTypeId.ToString());
|
| | |
|
| | | //获取设备最新版本
|
| | | var deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.ZigbeeDevice,
|
| | |
| | | }
|
| | |
|
| | | //拥有新版本
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (this.dicRowInfo.ContainsKey(ota.DeviceAddr) == true)
|
| | | {
|
| | |
| | | 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)
|
| | | {
|
| | |
| | | this.UseClickStatu = false;
|
| | | if (i_zbGateway != null)
|
| | | {
|
| | | this.zbGatewayId = HdlGatewayLogic.Current.GetGatewayId(i_zbGateway);
|
| | | this.zbGatewayId = i_zbGateway.GwId;
|
| | | }
|
| | | this.BackgroundColor = UserCenterColor.Current.White;
|
| | | this.Y = Application.GetRealHeight(174);
|
| | | this.Height = Application.GetRealHeight(173);
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 自定义智能音箱控件_________________
|
| | |
|
| | | /// <summary>
|
| | | /// 自定义网关控件
|
| | | /// </summary>
|
| | | private class MySmartSoundControl : FrameRowControl
|
| | | {
|
| | |
|
| | | /// <summary>
|
| | | /// 网关名字控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnName = null;
|
| | |
|
| | | /// <summary>
|
| | | /// 自定音箱关控件
|
| | | /// </summary>
|
| | | public MySmartSoundControl()
|
| | | {
|
| | | this.UseClickStatu = false;
|
| | | this.BackgroundColor = UserCenterColor.Current.White;
|
| | | this.Height = Application.GetRealHeight(173);
|
| | |
|
| | | //this.InitControl();
|
| | | }
|
| | |
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化控件
|
| | | /// </summary>
|
| | | public void InitControl()
|
| | | {
|
| | | //图标
|
| | | var btnIcon = this.AddLeftIcon(81);
|
| | | btnIcon.UnSelectedImagePath = "SmartSound/SoundIcon.png";
|
| | |
|
| | | //显示文本
|
| | | btnName = this.AddLeftCaption(string.Empty, 700);
|
| | | btnName.Height = Application.GetRealHeight(60);
|
| | | btnName.TextSize = 15;
|
| | | btnName.Y = Application.GetRealHeight(57);
|
| | | btnName.Text = "小度小度";
|
| | |
|
| | | this.AddRightArrow();
|
| | | this.AddMostRightView("", 300, false).Name = "smartSoundLayout";
|
| | | this.AddBottomLine();
|
| | | }
|
| | | }
|
| | | #endregion
|
| | | }
|
| | | }
|