using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using ZigBee.Device;
|
|
namespace Shared.Phone.UserCenter.HideOption
|
{
|
/// <summary>
|
/// 隐匿功能的网关列表界面
|
/// </summary>
|
public class HideOptionGatewayListForm : EditorCommonForm
|
{
|
#region ■ 变量声明___________________________
|
|
/// <summary>
|
/// 列表控件
|
/// </summary>
|
private VerticalListControl listview = null;
|
|
#endregion
|
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
/// </summary>
|
/// <param name="i_GatewayDiv">网关区分,1:本地网关 2:缓存中的网关 3:广播搜到的网关</param>
|
public void ShowForm(int i_GatewayDiv)
|
{
|
if (i_GatewayDiv == 1)
|
{
|
//设置标题信息
|
base.SetTitleText("本地网关");
|
}
|
else if (i_GatewayDiv == 2)
|
{
|
//设置标题信息
|
base.SetTitleText("缓存中的网关");
|
}
|
else
|
{
|
//设置标题信息
|
base.SetTitleText("广播搜到的网关");
|
}
|
|
//初始化中部控件
|
this.InitMiddleFrame(i_GatewayDiv);
|
}
|
|
/// <summary>
|
/// 初始化中部控件
|
/// </summary>
|
private void InitMiddleFrame(int i_GatewayDiv)
|
{
|
//清空bodyFrame
|
this.ClearBodyFrame();
|
|
listview = new VerticalListControl(29);
|
listview.Height = bodyFrameLayout.Height;
|
listview.BackgroundColor = UserCenterColor.Current.White;
|
bodyFrameLayout.AddChidren(listview);
|
|
HdlThreadLogic.Current.RunMainInThread(() =>
|
{
|
//设定中部信息
|
this.SetMiddleFrameInfo(i_GatewayDiv);
|
});
|
}
|
|
/// <summary>
|
/// 设定中部信息
|
/// </summary>
|
private void SetMiddleFrameInfo(int i_GatewayDiv)
|
{
|
List<ZbGateway> listway = null;
|
if (i_GatewayDiv == 1)
|
{
|
//获取本地全部网关对象
|
listway = HdlGatewayLogic.Current.GetAllLocalGateway();
|
}
|
else if (i_GatewayDiv == 2)
|
{
|
listway = ZbGateway.GateWayList;
|
}
|
else
|
{
|
listway = new List<ZbGateway>();
|
foreach (var way in UserCenterResourse.DicReceiveGatewayTest.Values)
|
{
|
listway.Add(way);
|
}
|
}
|
for (int i = 0; i < listway.Count; i++)
|
{
|
//添加行
|
this.AddRowLayout(listway[i], i != listway.Count - 1);
|
}
|
|
//调整列表控件的高度
|
this.listview.AdjustRealHeight(Application.GetRealHeight(23));
|
}
|
|
#endregion
|
|
#region ■ 添加网关行_________________________
|
|
/// <summary>
|
/// 添加行
|
/// </summary>
|
/// <param name="i_gateway">i_gateway</param>
|
/// <param name="addLine">是否添加底线</param>
|
private void AddRowLayout(ZbGateway i_gateway, bool addLine)
|
{
|
//网关控件
|
var gatewayRow = new GatewayRowControl(i_gateway, listview.rowSpace / 2);
|
listview.AddChidren(gatewayRow);
|
gatewayRow.InitControl(81);
|
if (addLine == true)
|
{
|
gatewayRow.frameTable.AddBottomLine();
|
}
|
|
var btnLink = new NormalViewControl(Application.GetRealWidth(700), gatewayRow.btnIp.Height, false);
|
btnLink.TextSize = 12;
|
btnLink.X = gatewayRow.btnIp.Right;
|
btnLink.Y = gatewayRow.btnIp.Y;
|
btnLink.Text = "本地连接:" + i_gateway.localIsConnected.ToString();
|
gatewayRow.frameTable.AddChidren(btnLink);
|
|
//定位
|
var btnPosition = gatewayRow.AddEditorControl(false);
|
btnPosition.TextID = R.MyInternationalizationString.uFixedPosition;
|
btnPosition.ButtonClickEvent += (sender, e) =>
|
{
|
//发送定位命令
|
HdlGatewayLogic.Current.SetFixedPositionCommand(i_gateway);
|
};
|
gatewayRow.frameTable.ButtonClickEvent += (sender, e) =>
|
{
|
var form = new GatewayManage.GatewayInfoEditorForm();
|
form.AddForm(i_gateway);
|
};
|
}
|
|
#endregion
|
}
|
}
|