New file |
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | | using ZigBee.Device;
|
| | |
|
| | | namespace Shared.Phone.UserCenter.GatewayAdd
|
| | | {
|
| | | /// <summary>
|
| | | /// 搜索得到的有线网关的列表界面
|
| | | /// </summary>
|
| | | public class WiredGatewayListForm : EditorCommonForm
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 搜索到的网关列表
|
| | | /// </summary>
|
| | | private List<ZbGateway> listZbGateway = null;
|
| | | /// <summary>
|
| | | /// 搜索到的网关类别 0:第一次绑定 1:已经绑定 2:需要换绑
|
| | | /// </summary>
|
| | | private Dictionary<string, int> dicZbGatewayDiv = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | /// <param name="i_listZbGateway">搜索到的网关列表</param>
|
| | | /// <param name="i_dicZbGatewayDiv">搜索到的网关类别 0:第一次绑定 1:已经绑定 2:需要换绑</param>
|
| | | public void ShowForm(List<ZbGateway> i_listZbGateway, Dictionary<string, int> i_dicZbGatewayDiv)
|
| | | {
|
| | | this.listZbGateway = i_listZbGateway;
|
| | | this.dicZbGatewayDiv = i_dicZbGatewayDiv;
|
| | |
|
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddGateway));
|
| | |
|
| | | //初始化中部信息
|
| | | this.InitMiddleFrame();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部信息
|
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | {
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | var frameBack = new FrameLayout();
|
| | | frameBack.Height = Application.GetRealHeight(23);
|
| | | frameBack.BackgroundColor = UserCenterColor.Current.White;
|
| | | bodyFrameLayout.AddChidren(frameBack);
|
| | |
|
| | | var listView = new VerticalListControl(12);
|
| | | listView.Y = frameBack.Bottom;
|
| | | listView.BackgroundColor = UserCenterColor.Current.White;
|
| | | listView.Height = bodyFrameLayout.Height - frameBack.Height;
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | |
|
| | | HdlThreadLogic.Current.RunMainInThread(() =>
|
| | | {
|
| | | //添加网关行
|
| | | for (int i = 0; i < listZbGateway.Count; i++)
|
| | | {
|
| | | this.AddGatewayRow(listView, listZbGateway[i], i != listZbGateway.Count - 1);
|
| | | }
|
| | | listView.AdjustRealHeight(Application.GetRealHeight(23));
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 添加网关行_________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加网关行
|
| | | /// </summary>
|
| | | /// <param name="listView"></param>
|
| | | /// <param name="gateway"></param>
|
| | | /// <param name="addLine"></param>
|
| | | private void AddGatewayRow(VerticalListControl listView, ZbGateway gateway, bool addLine)
|
| | | {
|
| | | string gwid = HdlGatewayLogic.Current.GetGatewayId(gateway);
|
| | | if (this.dicZbGatewayDiv[gwid] != 2)
|
| | | {
|
| | | //如果本地没有,那么应该是在之后的编辑界面删除了
|
| | | if (HdlGatewayLogic.Current.IsGatewayExist(gwid) == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | var frameRow = new RowLayoutControl(listView.rowSpace / 2);
|
| | | listView.AddChidren(frameRow);
|
| | | //图标
|
| | | var btnIcon = frameRow.frameTable.AddLeftIcon(81);
|
| | | HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, gateway);
|
| | | //网关名
|
| | | var wayName = HdlGatewayLogic.Current.GetGatewayName(gateway);
|
| | | if (wayName == string.Empty)
|
| | | {
|
| | | //无法识别的网关设备
|
| | | wayName = Language.StringByID(R.MyInternationalizationString.uUnDistinguishTheGatewayDevice);
|
| | | }
|
| | | if (dicZbGatewayDiv[gwid] == 0)
|
| | | {
|
| | | //xxx(新)
|
| | | wayName += Language.StringByID(R.MyInternationalizationString.uNewTip1);
|
| | | }
|
| | | var btnName = frameRow.frameTable.AddLeftCaption(wayName, 700);
|
| | | btnName.TextSize = 15;
|
| | | //右箭头
|
| | | frameRow.frameTable.AddRightArrow();
|
| | | if (addLine == true)
|
| | | {
|
| | | //底线
|
| | | frameRow.frameTable.AddBottomLine();
|
| | | }
|
| | | frameRow.frameTable.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new GatewayProductInfoForm();
|
| | | form.AddForm(gateway);
|
| | | };
|
| | |
|
| | | if (dicZbGatewayDiv[gwid] == 2)
|
| | | {
|
| | | //换绑
|
| | | var btnBind = new NormalViewControl(Application.GetRealWidth(184), frameRow.Height, false);
|
| | | btnBind.BackgroundColor = 0xfffb744a;
|
| | | btnBind.TextAlignment = TextAlignment.Center;
|
| | | btnBind.TextColor = UserCenterColor.Current.White;
|
| | | btnBind.TextSize = 12;
|
| | | btnBind.TextID = R.MyInternationalizationString.uReBindAgain;
|
| | | frameRow.AddRightView(btnBind);
|
| | | btnBind.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //确认绑定旧网关?
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uRebindGatewayMsg);
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, () =>
|
| | | {
|
| | | var form = new WiredGatewayRebindForm();
|
| | | form.AddForm(gateway, dicZbGatewayDiv);
|
| | | });
|
| | | };
|
| | | }
|
| | | //定位
|
| | | var btnPosition = new NormalViewControl(Application.GetRealWidth(184), frameRow.Height, false);
|
| | | btnPosition.BackgroundColor = 0xff4a4a4a;
|
| | | btnPosition.TextAlignment = TextAlignment.Center;
|
| | | btnPosition.TextColor = UserCenterColor.Current.White;
|
| | | btnPosition.TextSize = 12;
|
| | | btnPosition.TextID = R.MyInternationalizationString.uFixedPosition;
|
| | | frameRow.AddRightView(btnPosition);
|
| | | btnPosition.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //发送定位命令
|
| | | HdlGatewayLogic.Current.SetFixedPositionCommand(gateway);
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 界面重新激活事件___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 自身的上层界面关闭后,它自身处于最上层时,触发的事件
|
| | | /// </summary>
|
| | | public override int FormActionAgainEvent()
|
| | | {
|
| | | //初始化中部信息
|
| | | this.InitMiddleFrame();
|
| | | return 1;
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|