| | |
| | | /// 列表控件 |
| | | /// </summary> |
| | | private VerticalListControl listView = null; |
| | | /// <summary>
|
| | | /// 当前网关对象
|
| | | /// </summary> |
| | | private ZbGateway zbGateway = null; |
| | | /// <summary>
|
| | | /// mini网关是否能够添加设备
|
| | | /// </summary> |
| | | private bool MiniGatewayCanAddDevice = true; |
| | | |
| | | #endregion |
| | | |
| | |
| | | public void ShowForm() |
| | | { |
| | | //设定标题 |
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDeviceType)); |
| | | |
| | | //初始化中部控件 |
| | | this.InitMiddleFrame(); |
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDeviceType));
|
| | |
|
| | | this.zbGateway = HdlGatewayLogic.Current.GetLocalGateway(GatewayResourse.AppOldSelectGatewayId); |
| | | if (zbGateway != null && zbGateway.LinuxImageType == 11)
|
| | | {
|
| | | //初始化Mini网关的界面
|
| | | this.InitControlByMiniGateway();
|
| | | } |
| | | else
|
| | | {
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | //2按键触摸面板 |
| | | var objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName1); |
| | | var unSelectPic = "Device/ButtonPanelTwo.png"; |
| | | var arry = objectText.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries); |
| | | objectText = arry[0].Trim(); |
| | | this.AddMenuRow(objectText, unSelectPic, "PanelTwoButtonDirectionForm"); |
| | | |
| | | //3按键触摸面板 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName2); |
| | | arry = objectText.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries); |
| | | objectText = arry[0].Trim(); |
| | | unSelectPic = "Device/ButtonPanelThree.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "PanelThreeButtonDirectionForm"); |
| | | |
| | | //4按键触摸面板 |
| | | objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName3); |
| | | arry = objectText.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries); |
| | | objectText = arry[0].Trim(); |
| | | unSelectPic = "Device/ButtonPanelFour.png"; |
| | | this.AddMenuRow(objectText, unSelectPic, "PanelFourButtonDirectionForm"); |
| | | |
| | |
| | | unSelectPic = "Device/ThirdPartyDevice.png"; |
| | | var rowThrid = this.AddMenuRow(objectText, unSelectPic, string.Empty, false); |
| | | rowThrid.ButtonClickEvent += (sender, e) => |
| | | { |
| | | {
|
| | | if (this.MiniGatewayCanAddDevice == false)
|
| | | {
|
| | | //Mini网关最大只能添加16个设备
|
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uMiniGatewayMaxDeviceCountMsg));
|
| | | return;
|
| | | } |
| | | var form = new Device.DeviceSearchForm(); |
| | | form.AddForm(string.Empty); |
| | | }; |
| | | |
| | | //调整列表控件的高度 |
| | | listView.AdjustRealHeight(Application.GetRealHeight(23)); |
| | | }
|
| | |
|
| | | #endregion |
| | |
|
| | | #region ■ mini网关___________________________ |
| | | |
| | | /// <summary>
|
| | | /// 初始化Mini网关的界面
|
| | | /// </summary> |
| | | private void InitControlByMiniGateway()
|
| | | {
|
| | | //mini夜灯只能限制加入16和设备
|
| | | this.ShowProgressBar();
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | int statu = 0;
|
| | | //重新获取设备列表
|
| | | var listDevice = Common.LocalDevice.Current.GetDeviceListFromGateway(zbGateway, ref statu, true, ShowErrorMode.NO);
|
| | | this.CloseProgressBar();
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (statu != 1)
|
| | | {
|
| | | listDevice = Common.LocalDevice.Current.GetDeviceByGatewayID(zbGateway.GwId);
|
| | | }
|
| | | //检测mini网关的设备数
|
| | | this.CheckMiniGatewayDeviceCount(listDevice);
|
| | | //初始化界面
|
| | | this.InitMiddleFrame();
|
| | | });
|
| | | });
|
| | | } |
| | | |
| | | /// <summary>
|
| | | /// 检测mini网关的设备数
|
| | | /// </summary>
|
| | | /// <param name="listDevice"></param> |
| | | private void CheckMiniGatewayDeviceCount(List<CommonDevice> listDevice)
|
| | | {
|
| | | var listMac = new HashSet<string>();
|
| | | foreach (var device in listDevice)
|
| | | {
|
| | | if (listMac.Contains(device.DeviceAddr) == false)
|
| | | {
|
| | | listMac.Add(device.DeviceAddr);
|
| | | }
|
| | | }
|
| | | MiniGatewayCanAddDevice = listMac.Count < 16;
|
| | | } |
| | | |
| | | #endregion |
| | | |
| | |
|
| | | #region ■ 添加菜单栏_________________________ |
| | | |
| | |
|
| | | /// <summary> |
| | | /// 添加菜单栏 |
| | | /// </summary> |
| | |
| | | { |
| | | rowLayout.ButtonClickEvent += (sender, e) => |
| | | { |
| | | if (this.MiniGatewayCanAddDevice == false)
|
| | | {
|
| | | //Mini网关最大只能添加16个设备
|
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uMiniGatewayMaxDeviceCountMsg));
|
| | | return;
|
| | | } |
| | | //反射目标界面 |
| | | this.LoadFormByFullName("Shared.Phone.UserCenter.DeviceDirection." + formName); |
| | | }; |