using System;
using System.Collections.Generic;
using ZigBee.Device;
namespace Shared.Phone.UserCenter.Device
{
///
/// 网关成功添加设备的显示画面
///
public class AddDeviceSuccessForm : UserCenterCommonForm
{
///
/// 新上报的设备(注意:这个东西是个地址引用)
///
private List listNewDevice = null;
///
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
///
/// 设备列表
public void ShowForm(List listdevices)
{
this.listNewDevice = listdevices;
//设置标题信息
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice));
//初始化中部控件
this.InitMiddleFrame();
}
///
/// 初始化中部控件
///
private void InitMiddleFrame()
{
//进度条一样的东西,没什么逻辑
var line = new ProgressLine();
bodyFrameLayout.AddChidren(line);
line.SetValue(100);
//模块添加成功!
var btnSuccess = new MsgViewControl(1000, 100, true);
btnSuccess.TextID = R.MyInternationalizationString.uAddDeviceSuccess;
btnSuccess.Gravity = Gravity.CenterHorizontal;
btnSuccess.Y = Application.GetRealHeight(120);
bodyFrameLayout.AddChidren(btnSuccess);
//设备图片
var btnpictrue = new PicViewControl(510, 320);
btnpictrue.Gravity = Gravity.CenterHorizontal;
btnpictrue.Y = btnSuccess.Bottom + Application.GetRealHeight(50);
Common.LocalDevice.Current.SetRealDeviceIconToControl(btnpictrue, listNewDevice);
bodyFrameLayout.AddChidren(btnpictrue);
//完成
var btnFinish = new BottomClickButton();
btnFinish.TextID = R.MyInternationalizationString.uFinish;
bodyFrameLayout.AddChidren(btnFinish);
btnFinish.MouseUpEventHandler += (sender, e) =>
{
//关闭自身
this.CloseForm();
};
//更多配置
var btnJump = new ViewNormalControl(800, true);
btnJump.Gravity = Gravity.CenterHorizontal;
btnJump.Text = Language.StringByID(R.MyInternationalizationString.uMoreSettion) + " >>";
btnJump.TextColor = UserCenterColor.Current.TextGrayColor;
btnJump.Y = btnFinish.Y - Application.GetRealHeight(170);
btnJump.TextAlignment = TextAlignment.Center;
bodyFrameLayout.AddChidren(btnJump);
btnJump.MouseUpEventHandler += (sender, e) =>
{
var form = new ConfigureDeviceListForm();
this.AddFromAndRemoveNowForm(form, listNewDevice);
};
}
}
}