using System;
namespace Shared.Phone.UserCenter.GatewayAdd
{
///
/// 添加网关的选择画面
///
public class NewGateWayMenuSelectForm : EditorCommonForm
{
///
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
///
public void ShowForm()
{
//设置头部信息
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddGateway));
//初始化中部信息
this.InitMiddleFrame();
}
///
/// 初始化中部信息
///
private void InitMiddleFrame()
{
//清空bodyFrame
this.ClearBodyFrame();
var listView = new VerticalListControl(29);
listView.Height = Application.GetRealHeight(340);
listView.BackgroundColor = UserCenterColor.Current.White;
bodyFrameLayout.AddChidren(listView);
//有线网关
var row1 = new FrameRowControl(listView.rowSpace / 2);
listView.AddChidren(row1);
var btnIcon1 = row1.AddLeftIcon(81);
btnIcon1.UnSelectedImagePath = "Gateway/WiredGateway.png";
var btntext1 = row1.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uWiredGateway), 500);
btntext1.TextSize = 15;
row1.AddRightArrow();
row1.AddBottomLine();
row1.ButtonClickEvent += (sender, e) =>
{
//检测住宅经纬度
if (this.CheckResidencePoint() == false)
{
return;
}
var form = new WiredGatewayDirectionForm();
form.AddForm();
};
//无线网关
var row2 = new FrameRowControl(listView.rowSpace / 2);
listView.AddChidren(row2);
var btnIcon2 = row2.AddLeftIcon(81);
btnIcon2.UnSelectedImagePath = "Gateway/WirelessGateway.png";
var btntext2 = row2.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uWirelessGateway), 500);
btntext2.TextSize = 15;
row2.AddRightArrow();
row2.ButtonClickEvent += (sender, e) =>
{
//检测住宅经纬度
if (this.CheckResidencePoint() == false)
{
return;
}
var menuContr = new BottomMenuSelectForm();
menuContr.AddForm(2);
//UDP模式(推荐)
menuContr.AddMenu(Language.StringByID(R.MyInternationalizationString.uUdpModeRecommend), () =>
{
var form = new WirelessUdpDirectionForm();
form.AddForm();
});
//AP模式
menuContr.AddMenu(Language.StringByID(R.MyInternationalizationString.uApMode), () =>
{
var form = new WirelessApDirection1Form();
form.AddForm();
});
};
}
///
/// 检测住宅经纬度
///
///
private bool CheckResidencePoint()
{
if (Common.Config.Instance.Home.Latitude == 0 && Common.Config.Instance.Home.Longitude == 0)
{
//请前往住宅管理{0}设置住宅的地理位置
string msg = Language.StringByID(R.MyInternationalizationString.uGotoResidenceAndSetLocation).Replace("{0}", "\r\n");
this.ShowMassage(ShowMsgType.Confirm, msg, () =>
{
var form = new Residence.ResidenceManagementForm();
form.AddForm(false);
}, Language.StringByID(R.MyInternationalizationString.uGotoSettion));
return false;
}
return true;
}
}
}