using System;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.Stan;
using Shared;
namespace HDL_ON.UI
{
public class AddQingpingSensorEnvirTipPage : EditorCommonForm
{
#region ■ 变量声明___________________________
///
/// 添加设备完成之后的回调事件
///
public Action AddDeviceEvent = null;
IntegratedBrandDevice integratedDevice = null;
#endregion
#region ■ 初始化_____________________________
///
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
///
public void ShowForm(IntegratedBrandDevice device)
{
integratedDevice = device;
if (Language.CurrentLanguage == "Chinese")
{
//设置头部信息
base.SetTitleText(Language.StringByID(StringId.Add) + device.productName);
}
else
{
base.SetTitleText(Language.StringByID(StringId.Add) + " " + device.productName);
}
//这个界面的背景需要白色
bodyFrameLayout.BackgroundColor = UI.CSS.CSS_Color.MainBackgroundColor;
//初始化中部信息
this.InitMiddleFrame();
}
///
/// 初始化中部信息
///
private void InitMiddleFrame()
{
//图片
var btnPic = new PicViewControl(132, 132);
btnPic.Y = Application.GetRealHeight(69);
btnPic.Gravity = Gravity.CenterHorizontal;
if(integratedDevice.spk == SPK.SensorEnvironment3)
{
btnPic.UnSelectedImagePath = "PersonalCenter/AddDevice/EnvirSensorQingpingLitebg.png";
}else if (integratedDevice.spk == SPK.SensorEnvironment2)
{
btnPic.UnSelectedImagePath = "PersonalCenter/AddDevice/EnvirSensorQingpingCGS1bg.png";
}
bodyFrameLayout.AddChidren(btnPic);
//请输入设备机上的sn码
var textView = new FrameLayout()
{
Y = Application.GetRealHeight(309 - 64),
Gravity = Gravity.CenterHorizontal,
Width = Application.GetRealWidth(319),
Height = Application.GetRealHeight(144),
};
bodyFrameLayout.AddChidren(textView);
Button btnTipTitle = new Button()
{
TextAlignment = TextAlignment.Center,
TextColor = CSS.CSS_Color.FirstLevelTitleColor,
TextSize = CSS.CSS_FontSize.TextFontSize,
Text = "请下载“青萍+”APP为设备配置网络",
IsBold = true,
IsMoreLines = true,
Height = Application.GetRealHeight(30),
};
textView.AddChidren(btnTipTitle);
if(Language.CurrentLanguage != "Chinese")
{
btnTipTitle.Text = "Please download the 'Qingping +' app to configure the network for the device";
}
Button btnTipMsg = new Button()
{
Y = btnTipTitle.Bottom,
TextAlignment = TextAlignment.TopCenter,
TextColor = CSS.CSS_Color.PromptingColor1,
TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel,
Text = @"网络配置完成后,点击该设备查看数据页面,{0}点击右上角设置功能{0}找到“WIFI - MAC”并复制改MAC码",
IsMoreLines = true,
Height = Application.GetRealHeight(80),
};
textView.AddChidren(btnTipMsg);
if (Language.CurrentLanguage != "Chinese")
{
btnTipMsg.Text = @"After the network configuration is completed, click the device to view the data page,{0}Click the setting function in the upper right corner{0}Find ‘wifi-mac' and copy the modified MAC code";
}
btnTipMsg.Text = btnTipMsg.Text.Replace("{0}", "\r\n");
//下一步
var btnNext = this.AddBottomClickButton(Language.StringByID(StringId.Next));
btnNext.ButtonClickEvent += (sender, e) =>
{
var form2 = new AddSensorEnvironmentPage();
form2.AddForm(integratedDevice);
form2.AddDeviceEvent = AddDeviceEvent;
};
}
#endregion
#region ■ 关闭界面___________________________
///
/// 关闭界面
///
public override void CloseFormBefore()
{
this.AddDeviceEvent = null;
base.CloseFormBefore();
}
#endregion
}
}