| | |
| | | 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>
|
| | |
| | | /// </summary>
|
| | | private VerticalListRefreshControl listView = null;
|
| | | /// <summary>
|
| | | /// 前一次显示出左滑菜单的RowLayout
|
| | | /// </summary>
|
| | | private RowLayoutControl oldShowRightMuneRow = null;
|
| | | /// <summary>
|
| | | /// 行控件的信息(Keys:Mac地址)
|
| | | /// </summary>
|
| | | private Dictionary<string, DeviceObjRowInfo> dicRowInfo = new Dictionary<string, DeviceObjRowInfo>();
|
| | | /// <summary>
|
| | | /// 重新获取设备的在线状态
|
| | | /// </summary>
|
| | | private bool reGetDeviceOnlineStatu = false;
|
| | | /// <summary>
|
| | | /// 当前正在操作的设备对象Mac地址(设备信息编辑界面用)
|
| | | /// </summary>
|
| | |
| | | btnAddDeviceIcon.InitControl();
|
| | | btnAddDeviceIcon.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | ZbGateway realWay = null;
|
| | | if (GatewayResourse.NowSelectGateway == null || HdlGatewayLogic.Current.GetRealGateway(ref realWay, GatewayResourse.NowSelectGateway) == false)
|
| | | {
|
| | | //网关对象异常,请重新选择网关
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uGatewayIsErrorAndReSelect);
|
| | | this.ShowMassage(ShowMsgType.Error, msg, () =>
|
| | | {
|
| | | var form2 = new GatewayManage.GatewayListForm();
|
| | | form2.AddForm();
|
| | | });
|
| | | return;
|
| | | }
|
| | | GatewayResourse.NowSelectGateway = realWay;
|
| | |
|
| | | var form = new DeviceDirection.AddDeviceTypeListForm();
|
| | | form.AddForm();
|
| | | };
|
| | |
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | |
|
| | | //开启传感器报警监视
|
| | | this.StartCheckDeviceAlarm();
|
| | | //添加接收设备在线上报的监听
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceListFormReceivePushOnline", ReceiveComandDiv.A设备在线上报, (report) =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //接受设备状态
|
| | | this.ReceiveDeviceStatu(report);
|
| | |
|
| | | }, ShowErrorMode.NO);
|
| | | });
|
| | | //开启检测网关在线状态的线程
|
| | | HdlGatewayLogic.Current.StartCheckGatewayOnlineThread(this);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部控件(外部可以调用)
|
| | | /// </summary>
|
| | | /// <param name="i_reGetDeviceOnlineStatu">重新获取设备的在线状态</param>
|
| | | public void InitMiddleFrame(bool i_reGetDeviceOnlineStatu = true)
|
| | | public void InitMiddleFrame()
|
| | | {
|
| | | this.reGetDeviceOnlineStatu = i_reGetDeviceOnlineStatu;
|
| | | //清空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.NowSelectGateway = HdlGatewayLogic.Current.GetLocalGateway(GatewayResourse.AppOldSelectGatewayId);
|
| | | this.gatewayViewRow = new MyGatewayControl(GatewayResourse.NowSelectGateway);
|
| | | HdlGatewayResourse.NowSelectGatewayId = HdlGatewayResourse.AppOldSelectGatewayId;
|
| | | var nowGateway = HdlGatewayLogic.Current.GetLocalGateway(HdlGatewayResourse.AppOldSelectGatewayId);
|
| | | this.gatewayViewRow = new MyGatewayControl(nowGateway);
|
| | | bodyFrameLayout.AddChidren(gatewayViewRow);
|
| | | gatewayViewRow.InitControl();
|
| | |
|
| | |
| | | frame.AddChidren(listView);
|
| | | listView.BeginHeaderRefreshingAction += () =>
|
| | | {
|
| | | //刷新设备的话,主页需要重新刷新
|
| | | UserView.UserPage.Instance.RefreshAllForm = true;
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //下拉刷新
|
| | |
| | | private void InitDeviceListControl()
|
| | | {
|
| | | //获取设备列表
|
| | | string gwID = HdlGatewayLogic.Current.GetGatewayId(GatewayResourse.NowSelectGateway);
|
| | | var listDevice = Common.LocalDevice.Current.GetDeviceByGatewayID(gwID);
|
| | | var listSpecialOta = Common.LocalDevice.Current.GetSpecialOtaDevice(gwID);
|
| | | var listDevice = HdlDeviceCommonLogic.Current.GetDeviceByGatewayID(HdlGatewayResourse.NowSelectGatewayId);
|
| | | var listSpecialOta = HdlDeviceCommonLogic.Current.GetSpecialOtaDevice(HdlGatewayResourse.NowSelectGatewayId);
|
| | | listDevice.AddRange(listSpecialOta);
|
| | |
|
| | | this.dicRowInfo.Clear();
|
| | |
| | | foreach (var macAddress in this.dicRowInfo.Keys)
|
| | | {
|
| | | //获取ota设备
|
| | | var ota = Common.LocalDevice.Current.GetOTADevice(macAddress);
|
| | | var ota = HdlDeviceCommonLogic.Current.GetOTADevice(macAddress);
|
| | | if (ota != null)
|
| | | {
|
| | | listOta.Add(ota);
|
| | |
| | | //添加设备的菜单行
|
| | | this.AddDeviceMenuRow(macAddress);
|
| | | }
|
| | |
|
| | | //开启网关在线监测的线程
|
| | | this.StartGatewayOnlieCheckThread();
|
| | | //检测设备新版本
|
| | | this.CheckDeviceNewVersion(listOta);
|
| | | //如果当前不是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == false)
|
| | | {
|
| | | //开启网关在线监测的线程
|
| | | this.StartGatewayOnlieCheckThread();
|
| | | //检测设备新版本
|
| | | this.CheckDeviceNewVersion(listOta);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | |
| | |
|
| | | //创建一个可以展开和收缩的FrameLayout,相当于菜单栏
|
| | | var frameTable = new FrameListControl(29);
|
| | | frameTable.Height = ControlCommonResourse.ListViewRowHeight + frameTable.rowSpace;
|
| | | frameTable.Height = HdlControlResourse.ListViewRowHeight + frameTable.rowSpace;
|
| | | listView.AddChidren(frameTable);
|
| | | rowInfo.frameTable = frameTable;
|
| | |
|
| | | //控件
|
| | | var rowMenu = new DeviceObjectControl(deviceMac, listView.rowSpace / 2);
|
| | | rowMenu.MainKeys = deviceMac;
|
| | | frameTable.AddChidren(rowMenu);
|
| | | rowMenu.InitControl();
|
| | | rowInfo.MenuRow = rowMenu;
|
| | |
| | | //提示新版本
|
| | | 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 (listdevice.Count > 0 && Common.LocalDevice.Current.DeviceIsCanFixedPosition(listdevice[0]) == true)
|
| | | var listdevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceMac);
|
| | | if (listdevice.Count > 0 && HdlDeviceCommonLogic.Current.DeviceIsCanFixedPosition(listdevice[0]) == true)
|
| | | {
|
| | | //定位
|
| | | var btnPosition = new NormalViewControl(Application.GetRealWidth(184), rowMenu.Height, false);
|
| | | var btnPosition = rowMenu.AddEditorControl(false);
|
| | | btnPosition.TextID = R.MyInternationalizationString.uFixedPosition;
|
| | | btnPosition.TextAlignment = TextAlignment.Center;
|
| | | btnPosition.TextSize = 12;
|
| | | btnPosition.TextColor = UserCenterColor.Current.White;
|
| | | btnPosition.BackgroundColor = 0xff4a4a4a;
|
| | | rowMenu.AddRightView(btnPosition);
|
| | | btnPosition.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //定位
|
| | | Common.LocalDevice.Current.SetFixedPositionCommand(listdevice[0]);
|
| | | HdlDeviceCommonLogic.Current.SetFixedPositionCommand(listdevice[0], true);
|
| | | };
|
| | | }
|
| | |
|
| | |
| | | btnRight.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //回路数大于1才展开
|
| | | if (Common.LocalDevice.Current.GetDevicesCountByMac(deviceMac) > 1)
|
| | | var listMacDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceMac, false);
|
| | | if (listMacDevice.Count > 1)
|
| | | {
|
| | | btnRight.IsSelected = !btnRight.IsSelected;
|
| | | //展开或者折叠明细列表
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if (HdlDeviceCommonLogic.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;
|
| | | }
|
| | |
| | |
|
| | | rowMenu.frameTable.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //隐藏菜单
|
| | | rowMenu.HideMenu();
|
| | | //强制跳转真实设备界面
|
| | | if (HdlUserCenterResourse.HideOption.GotoRealDeviceForm == 1)
|
| | | {
|
| | | var form2 = new DeviceAddSuccessForm();
|
| | | form2.AddForm(deviceMac);
|
| | | return;
|
| | | }
|
| | | var listMacDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceMac, false);
|
| | | if (listMacDevice.Count > 0 && HdlDeviceCommonLogic.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;
|
| | | };
|
| | | //左滑菜单事件
|
| | | rowMenu.OpenMenuAction += () =>
|
| | | {
|
| | | if (this.oldShowRightMuneRow != null && this.oldShowRightMuneRow.MainKeys != rowMenu.MainKeys)
|
| | | {
|
| | | //左滑菜单只能滑一个
|
| | | this.oldShowRightMuneRow.HideMenu();
|
| | | }
|
| | | this.oldShowRightMuneRow = rowMenu;
|
| | | };
|
| | | }
|
| | |
|
| | |
| | | //它原来的高度
|
| | | int oldHeight = rowInfo.frameTable.Height;
|
| | | //变更的高度,默认为列表隐藏
|
| | | int heightValue = ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace;
|
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
|
| | | int heightValue = HdlControlResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace;
|
| | | var listDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceMac);
|
| | | if (isShow == true)
|
| | | {
|
| | | //展开模式时,扩大依据为:它有几个子控件
|
| | | heightValue = (listDevice.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
|
| | | //标题自己就是一个子控件
|
| | | if (rowInfo.frameTable.ChildrenCount == 1)
|
| | | //备注:面板中只显示真实的设备,其他属于绑定的回路不显示
|
| | | //获取这一堆设备时属于什么类型的
|
| | | var deviceEnumInfo = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(listDevice);
|
| | | if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
|
| | | {
|
| | | //获取这一堆设备时属于什么类型的
|
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
|
| | | foreach (CommonDevice info in listDevice)
|
| | | var listTemp = HdlDeviceCommonLogic.Current.GetMutilfunctionPanelByMac(listDevice);
|
| | | //展开模式时,扩大依据为:它有几个子控件
|
| | | heightValue = (listTemp.Count + 1) * (HdlControlResourse.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
|
| | | || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEnvironment)
|
| | | {
|
| | | var listTemp = HdlDeviceCommonLogic.Current.GetPanelMatchEpointByMac(listDevice);
|
| | | //展开模式时,扩大依据为:它有几个子控件
|
| | | heightValue = (listTemp.Count + 1) * (HdlControlResourse.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) * (HdlControlResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
|
| | | //标题自己就是一个子控件
|
| | | if (rowInfo.frameTable.ChildrenCount == 1)
|
| | | {
|
| | | foreach (CommonDevice info in listDevice)
|
| | | {
|
| | | //加载它的列表
|
| | | this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | //行控件
|
| | | var rowDevice = new DeviceRoomControl(device, frame.rowSpace / 2);
|
| | | rowDevice.MainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device);
|
| | | frame.AddChidren(rowDevice);
|
| | | rowDevice.frameTable.LeftOffset = Application.GetRealWidth(173) - ControlCommonResourse.XXLeft;
|
| | | rowDevice.frameTable.LeftOffset = Application.GetRealWidth(173) - HdlControlResourse.XXLeft;
|
| | | rowDevice.InitControl();
|
| | | //底线
|
| | | rowDevice.frameTable.AddBottomLine();
|
| | | //右箭头
|
| | | rowDevice.frameTable.AddRightArrow();
|
| | | //在线状态
|
| | | rowDevice.isOnline = device.IsOnline == 1;
|
| | |
|
| | | rowDevice.IsOnline = rowInfo.MenuRow.IsOnline;
|
| | | //保存控件
|
| | | string maikey = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | string maikey = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device);
|
| | | rowInfo.dicDetailRow[maikey] = rowDevice;
|
| | |
|
| | | //检测设备是否拥有定位的功能
|
| | | if (Common.LocalDevice.Current.DeviceIsCanFixedPosition(device) == true)
|
| | | if (HdlDeviceCommonLogic.Current.DeviceIsCanFixedPosition(device) == true)
|
| | | {
|
| | | //定位
|
| | | var btnPosition = new NormalViewControl(Application.GetRealWidth(184), rowDevice.Height, false);
|
| | | var btnPosition = rowDevice.AddEditorControl(false);
|
| | | btnPosition.TextID = R.MyInternationalizationString.uFixedPosition;
|
| | | btnPosition.TextAlignment = TextAlignment.Center;
|
| | | btnPosition.TextSize = 12;
|
| | | btnPosition.TextColor = UserCenterColor.Current.White;
|
| | | btnPosition.BackgroundColor = 0xff4a4a4a;
|
| | | rowDevice.AddRightView(btnPosition);
|
| | | btnPosition.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //定位
|
| | | Common.LocalDevice.Current.SetFixedPositionCommand(device);
|
| | | HdlDeviceCommonLogic.Current.SetFixedPositionCommand(device);
|
| | | };
|
| | | }
|
| | |
|
| | | rowDevice.frameTable.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //隐藏菜单
|
| | | rowDevice.HideMenu();
|
| | | //界面跳转,记录当前的正在操作的设备的Mac地址
|
| | | this.nowActionDeviceMac = device.DeviceAddr;
|
| | | //显示设备功能配置界面
|
| | | this.ShowDeviceFunctionSettionForm(device, deviceEnumInfo);
|
| | | //如果当前住宅不是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == false)
|
| | | {
|
| | | //显示设备功能配置界面
|
| | | this.ShowDeviceFunctionSettionForm(device, deviceEnumInfo);
|
| | | }
|
| | | };
|
| | | //左滑菜单事件
|
| | | rowDevice.OpenMenuAction += () =>
|
| | | {
|
| | | if (this.oldShowRightMuneRow != null && this.oldShowRightMuneRow.MainKeys != rowDevice.MainKeys)
|
| | | {
|
| | | //左滑菜单只能滑一个
|
| | | this.oldShowRightMuneRow.HideMenu();
|
| | | }
|
| | | this.oldShowRightMuneRow = rowDevice;
|
| | | };
|
| | | }
|
| | |
|
| | |
| | | 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.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);
|
| | |
| | | {
|
| | | //方悦面板的功能配置
|
| | | var form = new DevicePanel.PanelFangyueFunctionSettionForm();
|
| | | form.AddForm(device);
|
| | | form.AddForm(device, deviceEnumInfo);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | {
|
| | | 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)
|
| | | {
|
| | | //就显示一个特效而已
|
| | | System.Threading.Thread.Sleep(2000);
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //隐藏下拉刷新特效
|
| | | listView.EndHeaderRefreshing();
|
| | | });
|
| | | return;
|
| | | }
|
| | | //如果是在线的
|
| | | if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(GatewayResourse.NowSelectGateway) == true)
|
| | | var nowGateway = HdlGatewayLogic.Current.GetLocalGateway(HdlGatewayResourse.NowSelectGatewayId);
|
| | | if (HdlGatewayLogic.Current.CheckGatewayOnlineByMemory(nowGateway) == true)
|
| | | {
|
| | | //检测广播到的这个网关是否拥有住宅ID
|
| | | ZbGateway realWay = null;
|
| | | if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, GatewayResourse.NowSelectGateway) == true)
|
| | | 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();
|
| | | 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(GatewayResourse.NowSelectGateway);
|
| | | int result = HdlDeviceCommonLogic.Current.SetDeviceToMemmoryByGateway(nowGateway.GwId, false);
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | |
| | | if (result != -1)
|
| | | {
|
| | | //重新刷新界面
|
| | | this.InitMiddleFrame(false);
|
| | | this.InitMiddleFrame();
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | /// </summary>
|
| | | private void StartGatewayOnlieCheckThread()
|
| | | {
|
| | | if (GatewayResourse.NowSelectGateway == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | string selectGwId = HdlGatewayLogic.Current.GetGatewayId(GatewayResourse.NowSelectGateway);
|
| | | string selectGwId = HdlGatewayResourse.NowSelectGatewayId;
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | ZbGateway zbGateway = HdlGatewayLogic.Current.GetLocalGateway(selectGwId);
|
| | |
| | | //刷新网关在线状态
|
| | | 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);
|
| | | this.gatewayViewRow.RefreshControl();
|
| | | //开启设备在线线程
|
| | | this.StartDeviceListControlThread(online);
|
| | | bool online = HdlGatewayLogic.Current.CheckGatewayOnlineByMemory(zbGateway);
|
| | | //刷新控件在线状态
|
| | | this.gatewayViewRow?.RefreshOnlineStatu();
|
| | | //根据网关在线状态刷新设备在线状态
|
| | | this.RefreshDeviceOnlineStatuByGatewayOnline(online);
|
| | | }
|
| | | });
|
| | | });
|
| | |
| | | /// </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(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | this.gatewayViewRow?.RefreshControl();
|
| | | //相同的状态,不需要再次刷新
|
| | | if (this.gatewayViewRow.isOnline != online)
|
| | | {
|
| | | //根据网关在线状态刷新设备在线状态
|
| | | this.RefreshDeviceOnlineStatuByGatewayOnline(online);
|
| | | }
|
| | | //刷新控件在线状态
|
| | | this.gatewayViewRow?.RefreshOnlineStatu();
|
| | | });
|
| | | }
|
| | | }
|
| | |
| | | #region ■ 设备在线检测_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 开启设备在线线程
|
| | | /// 根据网关在线状态刷新设备在线状态
|
| | | /// </summary>
|
| | | /// <param name="gatewayOnline">网关的在线状态</param>
|
| | | private void StartDeviceListControlThread(bool gatewayOnline)
|
| | | private void RefreshDeviceOnlineStatuByGatewayOnline(bool gatewayOnline)
|
| | | {
|
| | | if (gatewayOnline == false)
|
| | | {
|
| | | //设置全部设备离线
|
| | | this.SetAllDeviceOffLine();
|
| | | return;
|
| | | }
|
| | | //开启传感器报警监视
|
| | | this.StartCheckDeviceAlarm();
|
| | | //开启设备在线监测
|
| | | this.StartCheckDeviceOnline();
|
| | | else
|
| | | {
|
| | | //刷新设备在线状态
|
| | | this.RefreshDeviceOnlineStatu();
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 开启设备在线监测
|
| | | /// 刷新设备在线状态
|
| | | /// </summary>
|
| | | private void StartCheckDeviceOnline()
|
| | | private void RefreshDeviceOnlineStatu()
|
| | | {
|
| | | //外部调用的话,不再重新获取设备状态
|
| | | if (GatewayResourse.NowSelectGateway == null || this.reGetDeviceOnlineStatu == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | //添加接收设备在线上报的监听
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceListFormReceivePushOnline", ReceiveComandDiv.A设备在线上报, this.ReceiveDeviceStatu);
|
| | |
|
| | | string gwId = HdlGatewayLogic.Current.GetGatewayId(GatewayResourse.NowSelectGateway);
|
| | | string gwId = HdlGatewayResourse.NowSelectGatewayId;
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //这里主要只是获取在线状态
|
| | | var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId);
|
| | | int statu = 0;
|
| | | var list = LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
|
| | | if (statu != -1)
|
| | | if (this.Parent == null) { return; }
|
| | | //获取设备列表
|
| | | var listDevice = HdlDeviceCommonLogic.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 = HdlDeviceCommonLogic.Current.ReadDeviceEpointDeviceInfo(device);
|
| | | if (deviceInfo != null)
|
| | | {
|
| | | //变更在线状态
|
| | | device.IsOnline = deviceInfo.IsOnline;
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //设置设备在线状态
|
| | | this.ReceiveDeviceStatu(device);
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | | System.Threading.Thread.Sleep(50);
|
| | | }
|
| | | }
|
| | | });
|
| | |
| | | return;
|
| | | }
|
| | | //刷新设备的在线状态
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
|
| | | string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device);
|
| | | var localDevice = HdlDeviceCommonLogic.Current.GetDevice(mainkeys);
|
| | | if (localDevice != null)
|
| | | {
|
| | | //在线状态一样的话,不需要刷新
|
| | | if (localDevice.IsOnline == device.IsOnline)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //保存状态
|
| | | localDevice.IsOnline = device.IsOnline;
|
| | | localDevice.ReSave();
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | rowInfo.MenuRow.IsOnline = HdlDeviceCommonLogic.Current.CheckDeviceIsOnline(device);
|
| | | if (rowInfo.dicDetailRow != null)
|
| | | {
|
| | | if (rowInfo != null)
|
| | | foreach (var detailRow in rowInfo.dicDetailRow.Values)
|
| | | {
|
| | | rowInfo.MenuRow.isOnline = device.IsOnline == 1;
|
| | | if (rowInfo.dicDetailRow != null)
|
| | | {
|
| | | foreach (var detailRow in rowInfo.dicDetailRow.Values)
|
| | | {
|
| | | detailRow.isOnline = rowInfo.MenuRow.isOnline;
|
| | | }
|
| | | }
|
| | | detailRow.IsOnline = rowInfo.MenuRow.IsOnline;
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | /// </summary>
|
| | | private void SetAllDeviceOffLine()
|
| | | {
|
| | | lock (dicRowInfo)
|
| | | foreach (var rowInfo in this.dicRowInfo.Values)
|
| | | {
|
| | | foreach (var rowInfo in this.dicRowInfo.Values)
|
| | | //菜单
|
| | | if (rowInfo.MenuRow != null)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | rowInfo.MenuRow.IsOnline = false;
|
| | | }
|
| | | //明细
|
| | | if (rowInfo.dicDetailRow != null)
|
| | | {
|
| | | foreach (var detailRow in rowInfo.dicDetailRow.Values)
|
| | | {
|
| | | if (rowInfo.MenuRow != null)
|
| | | {
|
| | | rowInfo.MenuRow.isOnline = false;
|
| | | }
|
| | | });
|
| | | detailRow.IsOnline = false;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | /// <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.Current.AddFirmwareVersionInfo(FirmwareLevelType.A设备, ota.HwVersion.ToString(), ota.ImgTypeId.ToString());
|
| | |
|
| | | //获取设备最新版本
|
| | | var deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.ZigbeeDevice,
|
| | | var deviceFirmware = HdlFirmwareUpdateLogic.Current.GetFirmwareMostVersionInfo(FirmwareLevelType.A设备,
|
| | | ota.HwVersion.ToString(),
|
| | | ota.ImgTypeId.ToString(),
|
| | | ota.ImgVersion);
|
| | |
| | | }
|
| | |
|
| | | //拥有新版本
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (this.dicRowInfo.ContainsKey(ota.DeviceAddr) == true)
|
| | | {
|
| | |
| | | #region ■ 实现外部调用_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加新的设备到界面桌布中
|
| | | /// 添加新的设备到界面桌布中(外部调用)
|
| | | /// </summary>
|
| | | /// <param name="deviceAddr">设备Mac地址</param>
|
| | | public void AddDeviceToFormTable(string deviceAddr)
|
| | |
| | | //新建一个对象
|
| | | if (this.dicRowInfo.ContainsKey(deviceAddr) == false)
|
| | | {
|
| | | var localDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceAddr);
|
| | | var localDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceAddr);
|
| | | if (localDevice.Count == 0)
|
| | | {
|
| | | //针对单纯只有一个200端点的设备
|
| | | var ota = Common.LocalDevice.Current.GetOTADevice(deviceAddr);
|
| | | var ota = HdlDeviceCommonLogic.Current.GetOTADevice(deviceAddr);
|
| | | if (ota == null)
|
| | | {
|
| | | //入网之后,又把它删了
|
| | |
| | | }
|
| | | var rowNewInfo = new DeviceObjRowInfo();
|
| | | rowNewInfo.DeviceMac = deviceAddr;
|
| | | rowNewInfo.MacName = Common.LocalDevice.Current.GetDeviceMacName(localDevice[0]);
|
| | | rowNewInfo.DeviveTypeName = Common.LocalDevice.Current.GetDeviceObjectText(localDevice);
|
| | | rowNewInfo.MacName = HdlDeviceCommonLogic.Current.GetDeviceMacName(localDevice[0]);
|
| | | rowNewInfo.DeviveTypeName = HdlDeviceCommonLogic.Current.GetDeviceObjectText(localDevice);
|
| | | this.dicRowInfo[deviceAddr] = rowNewInfo;
|
| | |
|
| | | //创建新的行
|
| | | this.AddDeviceMenuRow(deviceAddr);
|
| | |
|
| | | //记录当前的正在操作的设备的Mac地址
|
| | | this.nowActionDeviceMac = deviceAddr;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 刷新指定设备行的信息(外部调用)
|
| | | /// </summary>
|
| | | /// <param name="deviceAddr">设备Mac地址</param>
|
| | | public void RefreshDeviceRow(string deviceAddr)
|
| | | {
|
| | | if (this.dicRowInfo.ContainsKey(deviceAddr) == true)
|
| | | {
|
| | | var rowInfo = this.dicRowInfo[deviceAddr];
|
| | | //检测这个设备是否被删除 2020.01.13变更:追加Ota设备的判断
|
| | | if (HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceAddr).Count == 0
|
| | | && HdlDeviceCommonLogic.Current.GetOTADevice(deviceAddr) == null)
|
| | | {
|
| | | //移除控件
|
| | | rowInfo.dicDetailRow = null;
|
| | | rowInfo.frameTable.RemoveFromParent();
|
| | |
|
| | | this.dicRowInfo.Remove(deviceAddr);
|
| | | }
|
| | | else
|
| | | {
|
| | | //刷新设备信息
|
| | | rowInfo.MenuRow?.RefreshControlInfo(true);
|
| | | if (rowInfo.dicDetailRow != null)
|
| | | {
|
| | | foreach (var contr in rowInfo.dicDetailRow.Values)
|
| | | {
|
| | | contr?.RefreshControlInfo();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | | //获取设备类型的
|
| | | var deviceEnumInfo = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment)
|
| | | {
|
| | | foreach (var outClu in device.OutClusterList)
|
| | | {
|
| | | //去掉简约环境面板类的各种服务端设备,室内机不显示
|
| | | if (outClu.OutCluster == 513)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | }
|
| | | }
|
| | | if (dic.ContainsKey(device.DeviceAddr) == false)
|
| | | {
|
| | | dic[device.DeviceAddr] = new List<CommonDevice>();
|
| | |
| | | {
|
| | | var info = new DeviceObjRowInfo();
|
| | | info.DeviceMac = mac;
|
| | | info.MacName = Common.LocalDevice.Current.GetDeviceMacName(dic[mac][0]);
|
| | | info.DeviveTypeName = Common.LocalDevice.Current.GetDeviceObjectText(dic[mac]);
|
| | | info.MacName = HdlDeviceCommonLogic.Current.GetDeviceMacName(dic[mac][0]);
|
| | | info.DeviveTypeName = HdlDeviceCommonLogic.Current.GetDeviceObjectText(dic[mac]);
|
| | | this.dicRowInfo[mac] = info;
|
| | | }
|
| | | }
|
| | |
| | | /// </summary>
|
| | | public override int FormActionAgainEvent()
|
| | | {
|
| | | if (HdlGatewayResourse.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;
|
| | |
| | | {
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceListFormSensor");
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceListFormReceivePushOnline");
|
| | |
|
| | | GatewayResourse.NowSelectGateway = null;
|
| | |
|
| | | base.CloseFormBefore();
|
| | | }
|
| | |
| | | /// 网关名字控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnName = null;
|
| | | /// <summary>
|
| | | /// 在线状态(初始状态为在线)
|
| | | /// </summary>
|
| | | public bool isOnline = true;
|
| | |
|
| | | /// <summary>
|
| | | /// 自定义网关控件
|
| | |
| | | public MyGatewayControl(ZbGateway i_zbGateway)
|
| | | {
|
| | | this.UseClickStatu = false;
|
| | | this.zbGatewayId = HdlGatewayLogic.Current.GetGatewayId(i_zbGateway);
|
| | | if (i_zbGateway != null)
|
| | | {
|
| | | this.zbGatewayId = i_zbGateway.GwId;
|
| | | }
|
| | | this.BackgroundColor = UserCenterColor.Current.White;
|
| | | this.Y = Application.GetRealHeight(174);
|
| | | this.Height = Application.GetRealHeight(173);
|
| | | }
|
| | |
|
| | |
| | | ZbGateway zbway = HdlGatewayLogic.Current.GetLocalGateway(zbGatewayId);
|
| | | //图标
|
| | | var btnIcon = this.AddLeftIcon(81);
|
| | | HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, zbway);
|
| | | if (zbway != null)
|
| | | {
|
| | | HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, zbway);
|
| | | }
|
| | | else
|
| | | {
|
| | | btnIcon.UnSelectedImagePath = "Gateway/GatewayIcon1.png";
|
| | | }
|
| | |
|
| | | //显示文本
|
| | | btnName = this.AddLeftCaption(HdlGatewayLogic.Current.GetGatewayName(zbway), 700);
|
| | | btnName = this.AddLeftCaption(string.Empty, 700);
|
| | | btnName.Height = Application.GetRealHeight(60);
|
| | | btnName.TextSize = 15;
|
| | | btnName.Y = Application.GetRealHeight(35);
|
| | | if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway) == false)
|
| | | if (zbway != null)
|
| | | {
|
| | | btnName.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnName.Text = HdlGatewayLogic.Current.GetGatewayName(zbway);
|
| | | //在线状态
|
| | | //this.isOnline = HdlGatewayLogic.Current.CheckGatewayOnlineByMemory(zbway);
|
| | | //if (this.isOnline == false)
|
| | | //{
|
| | | // btnName.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | //}
|
| | | }
|
| | | else
|
| | | {
|
| | | //虚拟网关
|
| | | btnName.Text = Language.StringByID(R.MyInternationalizationString.uVirtualGateway);
|
| | | }
|
| | |
|
| | | //当前网关
|
| | |
| | | var btnMament = this.AddMostRightView(Language.StringByID(R.MyInternationalizationString.uGatewayManagement), 300);
|
| | | btnMament.Name = "btnMament";
|
| | |
|
| | | this.ButtonClickEvent += (sernder, e) =>
|
| | | //当前不是虚拟住宅的话
|
| | | if (Common.Config.Instance.Home.IsVirtually == false)
|
| | | {
|
| | | if (string.IsNullOrEmpty(((View)sernder).Name) == false)
|
| | | this.ButtonClickEvent += (sernder, e) =>
|
| | | {
|
| | | //打开网关列表界面
|
| | | var form = new GatewayManage.GatewayListForm();
|
| | | form.AddForm();
|
| | | }
|
| | | };
|
| | | if (string.IsNullOrEmpty(((View)sernder).Name) == false)
|
| | | {
|
| | | //打开网关列表界面
|
| | | var form = new GatewayManage.GatewayListForm();
|
| | | form.AddForm();
|
| | | }
|
| | | };
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | return;
|
| | | }
|
| | | btnName.Text = HdlGatewayLogic.Current.GetGatewayName(zbway);
|
| | | if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway) == false)
|
| | | //刷新控件在线状态
|
| | | this.RefreshOnlineStatu();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 刷新控件在线状态
|
| | | /// </summary>
|
| | | public void RefreshOnlineStatu()
|
| | | {
|
| | | //获取本地网关对象
|
| | | ZbGateway zbway = HdlGatewayLogic.Current.GetLocalGateway(zbGatewayId);
|
| | | if (zbway == null)
|
| | | {
|
| | | btnName.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | return;
|
| | | }
|
| | | else
|
| | | //在线状态
|
| | | bool statu = HdlGatewayLogic.Current.CheckGatewayOnlineByMemory(zbway);
|
| | | if (this.isOnline != statu)
|
| | | {
|
| | | btnName.TextColor = UserCenterColor.Current.TextColor1;
|
| | | this.isOnline = statu;
|
| | | if (this.isOnline == false)
|
| | | {
|
| | | btnName.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | }
|
| | | else
|
| | | {
|
| | | btnName.TextColor = UserCenterColor.Current.TextColor1;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | #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
|
| | | }
|
| | | }
|