| | |
| | | /// 列表控件 |
| | | /// </summary> |
| | | private VerticalListControl listView = null; |
| | | /// <summary>
|
| | | /// 当前网关对象
|
| | | /// <summary> |
| | | /// 当前网关对象 |
| | | /// </summary> |
| | | private ZbGateway zbGateway = null; |
| | | |
| | |
| | | public void ShowForm() |
| | | { |
| | | //设定标题 |
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDeviceType));
|
| | |
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | |
|
| | | this.zbGateway = HdlGatewayLogic.Current.GetLocalGateway(GatewayResourse.AppOldSelectGatewayId); |
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDeviceType)); |
| | | |
| | | //初始化中部控件 |
| | | this.InitMiddleFrame(); |
| | | |
| | | this.zbGateway = HdlGatewayLogic.Current.GetLocalGateway(HdlGatewayResourse.AppOldSelectGatewayId); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | //方悦双开四控面板 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName5); |
| | | unSelectPic = "Device/ButtonPanelFangyueFour.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "PanelFangyueFourButtonDirectionForm");
|
| | |
|
| | | //方悦四开八控面板
|
| | | this.AddMenuRow(objectText, unSelectPic, "PanelFangyueFourButtonDirectionForm"); |
| | | |
| | | //方悦四开八控面板 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName6); |
| | | unSelectPic = "Device/ButtonPanelFangyueEight.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "PanelFangyueEightButtonDirectionForm");
|
| | |
|
| | | this.AddMenuRow(objectText, unSelectPic, "PanelFangyueEightButtonDirectionForm"); |
| | | |
| | | //方悦新风小模块,图片和3路继电器小模块相同 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName7); |
| | | unSelectPic = "Device/RelayThreeLoad.png"; |
| | |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName29); |
| | | unSelectPic = "Device/ButtonPanelSimpleEnvironment.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "PanelSimpleEnvironmentDirectionForm"); |
| | | //方悦环境面板
|
| | | //方悦环境面板 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName9); |
| | | unSelectPic = "Device/ButtonPanelFangyueEnvironment.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "PanelFangyueEnvironmentDirectionForm");
|
| | |
|
| | | //窗帘面板
|
| | | this.AddMenuRow(objectText, unSelectPic, "PanelFangyueEnvironmentDirectionForm"); |
| | | |
| | | //窗帘面板 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName10); |
| | | unSelectPic = "Device/ButtonPanelCurtain.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "PanelCurtainDirectionForm"); |
| | |
| | | |
| | | //Zigbee智能开合帘电机 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName13); |
| | | unSelectPic = "Device/CurtainAutoOpen.png";
|
| | | this.AddMenuRow(objectText, unSelectPic, "CurtainAutoOpenDirectionForm");
|
| | |
|
| | | //Zigbee智能管状电机
|
| | | unSelectPic = "Device/CurtainAutoOpen.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "CurtainAutoOpenDirectionForm"); |
| | | |
| | | //Zigbee智能管状电机 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName14); |
| | | unSelectPic = "Device/CurtainSiphonate.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "CurtainSiphonateDirectionForm");
|
| | |
|
| | | //空调
|
| | | this.AddMenuRow(objectText, unSelectPic, "CurtainSiphonateDirectionForm"); |
| | | |
| | | //空调 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName15); |
| | | unSelectPic = "Device/AirConditionerZbGateway.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "AirConditionerZbGatewayDirectionForm"); |
| | |
| | | //智能门锁 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName16); |
| | | unSelectPic = "Device/IntelligentLocksH06C.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "IntelligentLocksH06cDirectionForm");
|
| | |
|
| | | //PIR传感器
|
| | | this.AddMenuRow(objectText, unSelectPic, "IntelligentLocksH06cDirectionForm"); |
| | | |
| | | //PIR传感器 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName17); |
| | | unSelectPic = "Device/SensorPir.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "SensorPirDirectionForm");
|
| | |
|
| | | //红外传感器
|
| | | this.AddMenuRow(objectText, unSelectPic, "SensorPirDirectionForm"); |
| | | |
| | | //红外传感器 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName18); |
| | | unSelectPic = "Device/SensorInfrared.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "SensorInfraredDirectionForm");
|
| | |
|
| | | //燃气传感器
|
| | | this.AddMenuRow(objectText, unSelectPic, "SensorInfraredDirectionForm"); |
| | | |
| | | //燃气传感器 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName19); |
| | | unSelectPic = "Device/SensorCarbonMonoxide.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "SensorCarbonMonoxideDirectionForm");
|
| | |
|
| | | //吸顶燃气传感器
|
| | | this.AddMenuRow(objectText, unSelectPic, "SensorCarbonMonoxideDirectionForm"); |
| | | |
| | | //吸顶燃气传感器 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName26); |
| | | unSelectPic = "Device/SensorCarbonMonoxide.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "SensorCeilingGasDirectionForm");
|
| | |
|
| | | //烟雾传感器
|
| | | this.AddMenuRow(objectText, unSelectPic, "SensorCeilingGasDirectionForm"); |
| | | |
| | | //烟雾传感器 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName20); |
| | | unSelectPic = "Device/SensorFire.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "SensorFireDirectionForm");
|
| | |
|
| | | //水浸传感器
|
| | | this.AddMenuRow(objectText, unSelectPic, "SensorFireDirectionForm"); |
| | | |
| | | //水浸传感器 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName21); |
| | | unSelectPic = "Device/SensorWater.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "SensorWaterDirectionForm");
|
| | |
|
| | | //门窗传感器
|
| | | this.AddMenuRow(objectText, unSelectPic, "SensorWaterDirectionForm"); |
| | | |
| | | //门窗传感器 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName22); |
| | | unSelectPic = "Device/SensorDoorWindow.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "SensorDoorWindowDirectionForm");
|
| | |
|
| | | //温湿度传感器
|
| | | this.AddMenuRow(objectText, unSelectPic, "SensorDoorWindowDirectionForm"); |
| | | |
| | | //温湿度传感器 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName23); |
| | | unSelectPic = "Device/SensorTemperatureHumidity.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "SensorTemperatureHumidityForm");
|
| | |
|
| | | //球型移动传感器
|
| | | this.AddMenuRow(objectText, unSelectPic, "SensorTemperatureHumidityForm"); |
| | | |
| | | //球型移动传感器 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName30); |
| | | unSelectPic = "Device/SensorSphericalMotion.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "SensorSphericalMotionDirectionForm");
|
| | | this.AddMenuRow(objectText, unSelectPic, "SensorSphericalMotionDirectionForm"); |
| | | |
| | | //PM2.5空气质量传感器 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName27); |
| | | unSelectPic = "Device/SensorPMTwoPointFive.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "SensorPMTwoPointFiveForm"); |
| | |
|
| | | //中继器
|
| | | |
| | | //中继器 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName24); |
| | | unSelectPic = "Device/RepeaterZigbee.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "RepeaterZigbeeDirectionForm");
|
| | |
|
| | | //空气开关
|
| | | this.AddMenuRow(objectText, unSelectPic, "RepeaterZigbeeDirectionForm"); |
| | | |
| | | //空气开关 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName25); |
| | | unSelectPic = "Device/AirSwitchCloudContr.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "AirSwitchCloudContrDirectionForm"); |
| | |
| | | unSelectPic = "Device/ThirdPartyDevice.png"; |
| | | var rowThrid = this.AddMenuRow(objectText, unSelectPic, string.Empty, false); |
| | | rowThrid.ButtonClickEvent += (sender, e) => |
| | | {
|
| | | rowThrid.CanClick = false;
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //检测网关
|
| | | var errorMsg = this.CheckGateway();
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | rowThrid.CanClick = true;
|
| | | if (errorMsg != null)
|
| | | {
|
| | | this.ShowMassage(ShowMsgType.Tip, errorMsg);
|
| | | }
|
| | | else
|
| | | {
|
| | | var form = new Device.DeviceSearchForm();
|
| | | form.AddForm(string.Empty);
|
| | | }
|
| | | });
|
| | | { |
| | | rowThrid.CanClick = false; |
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | | //检测网关 |
| | | var errorMsg = this.CheckGateway(); |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | rowThrid.CanClick = true; |
| | | if (errorMsg != null) |
| | | { |
| | | this.ShowMassage(ShowMsgType.Tip, errorMsg); |
| | | } |
| | | else |
| | | { |
| | | var form = new Device.DeviceSearchForm(); |
| | | form.AddForm(string.Empty); |
| | | } |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | //调整列表控件的高度 |
| | | listView.AdjustRealHeight(Application.GetRealHeight(23)); |
| | | }
|
| | |
|
| | | #endregion |
| | |
|
| | | #region ■ 检测网关___________________________ |
| | | |
| | | /// <summary>
|
| | | /// 检测网关(返回错误信息,null代表没问题)
|
| | | /// </summary> |
| | | private string CheckGateway()
|
| | | {
|
| | | if (zbGateway != null && zbGateway.LinuxImageType == 11)
|
| | | {
|
| | | //mini夜灯只能限制加入16和设备
|
| | | this.ShowProgressBar();
|
| | |
|
| | | int statu = 0;
|
| | | //重新获取设备列表
|
| | | var listDevice = Common.LocalDevice.Current.GetDeviceListFromGateway(zbGateway.GwId, ref statu, true, ShowErrorMode.NO);
|
| | | if (statu != 1)
|
| | | {
|
| | | //如果
|
| | | listDevice = Common.LocalDevice.Current.GetDeviceByGatewayID(zbGateway.GwId);
|
| | | }
|
| | | //检测mini网关的设备数
|
| | | var listMac = new HashSet<string>();
|
| | | foreach (var device in listDevice)
|
| | | {
|
| | | if (listMac.Contains(device.DeviceAddr) == false)
|
| | | {
|
| | | listMac.Add(device.DeviceAddr);
|
| | | }
|
| | | }
|
| | | this.CloseProgressBar();
|
| | |
|
| | | bool canAdd = listMac.Count < 16;
|
| | | if (canAdd == false)
|
| | | {
|
| | | //Mini网关最大只能添加16个设备
|
| | | return Language.StringByID(R.MyInternationalizationString.uMiniGatewayMaxDeviceCountMsg);
|
| | | }
|
| | | }
|
| | |
|
| | | return null;
|
| | | } |
| | | |
| | | #endregion |
| | |
|
| | | |
| | | #region ■ 检测网关___________________________ |
| | | |
| | | /// <summary> |
| | | /// 检测网关(返回错误信息,null代表没问题) |
| | | /// </summary> |
| | | private string CheckGateway() |
| | | { |
| | | if (zbGateway != null && zbGateway.LinuxImageType == 11) |
| | | { |
| | | //mini夜灯只能限制加入16和设备 |
| | | this.ShowProgressBar(); |
| | | |
| | | int statu = 0; |
| | | //重新获取设备列表 |
| | | var listDevice = HdlDeviceCommonLogic.Current.GetDeviceListFromGateway(zbGateway.GwId, ref statu, true, ShowErrorMode.NO); |
| | | if (statu != 1) |
| | | { |
| | | //如果 |
| | | listDevice = HdlDeviceCommonLogic.Current.GetDeviceByGatewayID(zbGateway.GwId); |
| | | } |
| | | //检测mini网关的设备数 |
| | | var listMac = new HashSet<string>(); |
| | | foreach (var device in listDevice) |
| | | { |
| | | if (listMac.Contains(device.DeviceAddr) == false) |
| | | { |
| | | listMac.Add(device.DeviceAddr); |
| | | } |
| | | } |
| | | this.CloseProgressBar(); |
| | | |
| | | bool canAdd = listMac.Count < 16; |
| | | if (canAdd == false) |
| | | { |
| | | //Mini网关最大只能添加16个设备 |
| | | return Language.StringByID(R.MyInternationalizationString.uMiniGatewayMaxDeviceCountMsg); |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 添加菜单栏_________________________ |
| | |
|
| | | |
| | | /// <summary> |
| | | /// 添加菜单栏 |
| | | /// </summary> |
| | |
| | | if (formName != string.Empty) |
| | | { |
| | | rowLayout.ButtonClickEvent += (sender, e) => |
| | | {
|
| | | rowLayout.CanClick = false;
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //检测网关
|
| | | var errorMsg = this.CheckGateway();
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | rowLayout.CanClick = true;
|
| | | if (errorMsg != null)
|
| | | {
|
| | | this.ShowMassage(ShowMsgType.Tip, errorMsg);
|
| | | }
|
| | | else
|
| | | {
|
| | | //反射目标界面
|
| | | this.LoadFormByFullName("Shared.Phone.UserCenter.DeviceDirection." + formName);
|
| | | }
|
| | | });
|
| | | { |
| | | rowLayout.CanClick = false; |
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | | //检测网关 |
| | | var errorMsg = this.CheckGateway(); |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | rowLayout.CanClick = true; |
| | | if (errorMsg != null) |
| | | { |
| | | this.ShowMassage(ShowMsgType.Tip, errorMsg); |
| | | } |
| | | else |
| | | { |
| | | //反射目标界面 |
| | | this.LoadFormByFullName("Shared.Phone.UserCenter.DeviceDirection." + formName); |
| | | } |
| | | }); |
| | | }); |
| | | }; |
| | | } |