New file |
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | | using ZigBee.Device;
|
| | |
|
| | | namespace Shared.Phone.UserCenter.GatewayManage
|
| | | {
|
| | | /// <summary>
|
| | | /// 网关通用信息
|
| | | /// </summary>
|
| | | public class GatewayGeneralInformationForm : EditorCommonForm
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | /// <param name="i_gateway">网关</param>
|
| | | public void ShowForm(ZbGateway i_gateway)
|
| | | {
|
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uGeneralInformation));
|
| | |
|
| | | //初始化中部信息
|
| | | this.InitMiddleFrame(i_gateway);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部信息
|
| | | /// </summary>
|
| | | /// <param name="i_gateway">网关</param>
|
| | | private void InitMiddleFrame(ZbGateway i_gateway)
|
| | | {
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | var listView = new VerticalListControl(23);
|
| | | listView.BackgroundColor = UserCenterColor.Current.White;
|
| | | listView.Height = bodyFrameLayout.Height;
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | |
|
| | | //设备名称
|
| | | var rowName = new FrameRowControl(listView.rowSpace / 2);
|
| | | rowName.UseClickStatu = false;
|
| | | listView.AddChidren(rowName);
|
| | | rowName.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uDeviceName), 300);
|
| | | rowName.AddMostRightView(HdlGatewayLogic.Current.GetGatewayName(i_gateway), 600);
|
| | | rowName.AddBottomLine();
|
| | |
|
| | | //设备型号
|
| | | var rowType = new FrameRowControl(listView.rowSpace / 2);
|
| | | rowType.UseClickStatu = false;
|
| | | listView.AddChidren(rowType);
|
| | | rowType.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uModelIdentifier), 300);
|
| | | var btnType = rowType.AddMostRightView("", 700);
|
| | | HdlGatewayLogic.Current.SetGatewayImageText(btnType, i_gateway);
|
| | | rowType.AddBottomLine();
|
| | |
|
| | | //序列号
|
| | | var rowSerial = new FrameRowControl(listView.rowSpace / 2);
|
| | | rowSerial.UseClickStatu = false;
|
| | | listView.AddChidren(rowSerial);
|
| | | rowSerial.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uSerialNumber), 300);
|
| | | rowSerial.AddMostRightView(string.IsNullOrEmpty(i_gateway.GwSerialNum) == false ? i_gateway.GwSerialNum : "000000000000", 600);
|
| | | rowSerial.AddBottomLine();
|
| | |
|
| | | //网关ID
|
| | | var rowGatewayID = new FrameRowControl(listView.rowSpace / 2);
|
| | | rowGatewayID.UseClickStatu = false;
|
| | | listView.AddChidren(rowGatewayID);
|
| | | rowGatewayID.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uGatewayID), 300);
|
| | | rowGatewayID.AddMostRightView(i_gateway.GwId, 600);
|
| | | rowGatewayID.AddBottomLine();
|
| | |
|
| | | //网关IP
|
| | | var rowGatewayIP = new FrameRowControl(listView.rowSpace / 2);
|
| | | rowGatewayIP.UseClickStatu = false;
|
| | | listView.AddChidren(rowGatewayIP);
|
| | | rowGatewayIP.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uGatewayIP), 300);
|
| | | rowGatewayIP.AddMostRightView(i_gateway.GwIP, 600);
|
| | | rowGatewayIP.AddBottomLine();
|
| | |
|
| | | //协议器MAC
|
| | | var rowMac = new FrameRowControl(listView.rowSpace / 2);
|
| | | rowMac.UseClickStatu = false;
|
| | | listView.AddChidren(rowMac);
|
| | | rowMac.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uCoordinatorMac), 300);
|
| | | var btnMac = rowMac.AddMostRightView("", 600);
|
| | | rowMac.AddBottomLine();
|
| | |
|
| | | //协议器信道
|
| | | var rowChannel = new FrameRowControl(listView.rowSpace / 2);
|
| | | rowChannel.UseClickStatu = false;
|
| | | listView.AddChidren(rowChannel);
|
| | | rowChannel.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uCoordinatorChannel), 300);
|
| | | var btnChannel = rowChannel.AddMostRightView("", 600);
|
| | | rowChannel.AddBottomLine();
|
| | |
|
| | | //协议器PanID
|
| | | var rowPanid = new FrameRowControl(listView.rowSpace / 2);
|
| | | rowPanid.UseClickStatu = false;
|
| | | listView.AddChidren(rowPanid);
|
| | | rowPanid.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uCoordinatorPanid), 300);
|
| | | var btnPanId = rowPanid.AddMostRightView("", 600);
|
| | | rowPanid.AddBottomLine();
|
| | |
|
| | | //制造商
|
| | | var rowProtuct = new FrameRowControl(listView.rowSpace / 2);
|
| | | rowProtuct.UseClickStatu = false;
|
| | | listView.AddChidren(rowProtuct);
|
| | | rowProtuct.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uManufacturerName), 300);
|
| | | rowProtuct.AddMostRightView("HDL", 600);
|
| | |
|
| | | listView.AdjustRealHeight(Application.GetRealHeight(23));
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //获取网关数据
|
| | | this.GetGatewayData(i_gateway, btnMac, btnChannel, btnPanId);
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 获取数据___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 获取网关数据
|
| | | /// </summary>
|
| | | /// <param name="gateway">网关对象</param>
|
| | | /// <param name="btnMac">协调器MAC</param>
|
| | | /// <param name="btnChannel">协调器信道</param>
|
| | | /// <param name="btnPanid">协调器PanId</param>
|
| | | private void GetGatewayData(ZbGateway gateway, NormalViewControl btnMac, NormalViewControl btnChannel, NormalViewControl btnPanid)
|
| | | {
|
| | | //打开进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | //协调器MAC
|
| | | string strMac = HdlGatewayLogic.Current.GetGatewayCoordinatorMac(gateway);
|
| | | if (strMac == null)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar(ShowReLoadMode.YES);
|
| | | return;
|
| | | }
|
| | | //协调器信道
|
| | | int intChannel = HdlGatewayLogic.Current.GetGatewayChannelId(gateway);
|
| | | if (intChannel == -1)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar(ShowReLoadMode.YES);
|
| | | return;
|
| | | }
|
| | | //协调器PanId
|
| | | int intPanId = HdlGatewayLogic.Current.GetGatewayPanId(gateway);
|
| | | if (intPanId == -1)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar(ShowReLoadMode.YES);
|
| | | return;
|
| | | }
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | btnMac.Text = strMac;
|
| | | btnChannel.Text = intChannel.ToString();
|
| | | btnPanid.Text = intPanId.ToString();
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|