using System;
|
using System.Collections.Generic;
|
using ZigBee.Device;
|
|
namespace Shared.Phone.UserCenter.Direction
|
{
|
/// <summary>
|
/// 网关添加可能的设备类型的一览画面,
|
/// 它从[DeviceManagementMainForm]画面打开
|
/// </summary>
|
public class AddDeviceTypeListForm : UserCenterCommonForm
|
{
|
/// <summary>
|
/// 列表控件
|
/// </summary>
|
private VerticalScrolViewLayout listView = null;
|
|
/// <summary>
|
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
/// </summary>
|
public void ShowForm()
|
{
|
//设定标题
|
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDeviceType));
|
|
//初始化中部控件
|
this.InitMiddleFrame();
|
}
|
|
/// <summary>
|
/// 初始化中部控件
|
/// </summary>
|
private void InitMiddleFrame()
|
{
|
listView = new VerticalScrolViewLayout();
|
listView.Height = bodyFrameLayout.Height;
|
bodyFrameLayout.AddChidren(listView);
|
|
string objectText = string.Empty;
|
string unSelectPic = string.Empty;
|
string selectPic = string.Empty;
|
|
//智能空气开关
|
objectText = Language.StringByID(R.MyInternationalizationString.uAirSwitch);
|
unSelectPic = "Device/CloudContrAirSwitch.png";
|
selectPic = "Device/CloudContrAirSwitchSelected.png";
|
this.AddMenuRow(objectText, unSelectPic, selectPic, DeviceConcreteType.CloudContr_AirSwitch);
|
|
//窗帘电机
|
objectText = Language.StringByID(R.MyInternationalizationString.uCurtainMotor);
|
unSelectPic = "Device/AutoOpenCurtain.png";
|
selectPic = "Device/AutoOpenCurtainSelected.png";
|
this.AddMenuRow(objectText, unSelectPic, selectPic, DeviceConcreteType.AutoOpen_Curtain);
|
|
//2按键触摸面板
|
objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDefultName202);
|
var arry = objectText.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries);
|
objectText = arry[0].Trim();
|
unSelectPic = "Device/TwoButtonPanel.png";
|
selectPic = "Device/TwoButtonPanelSelected.png";
|
this.AddMenuRow(objectText, unSelectPic, selectPic, DeviceConcreteType.Two_ButtonPanel);
|
|
//3按键触摸面板
|
objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDefultName201);
|
arry = objectText.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries);
|
objectText = arry[0].Trim();
|
unSelectPic = "Device/ThreeButtonPanel.png";
|
selectPic = "Device/ThreeButtonPanelSelected.png";
|
this.AddMenuRow(objectText, unSelectPic, selectPic, DeviceConcreteType.Three_ButtonPanel);
|
|
//4按键触摸面板
|
objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDefultName200);
|
arry = objectText.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries);
|
objectText = arry[0].Trim();
|
unSelectPic = "Device/FourButtonPanel.png";
|
selectPic = "Device/FourButtonPanelSelected.png";
|
this.AddMenuRow(objectText, unSelectPic, selectPic, DeviceConcreteType.Four_ButtonPanel);
|
|
//红外传感器
|
objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDefultName1303);
|
unSelectPic = "Device/InfraredSensor.png";
|
selectPic = "Device/InfraredSensorSelected.png";
|
this.AddMenuRow(objectText, unSelectPic, selectPic, DeviceConcreteType.Pir_Sensor);
|
|
////第三方设备
|
//objectText = Language.StringByID(R.MyInternationalizationString.uThirdPartyDevice);
|
//unSelectPic = "Device/Relay.png";
|
//selectPic = "Device/RelaySelected.png";
|
//deviceType = DeviceType.UnKown;
|
//this.AddMenuRow(objectText, unSelectPic, selectPic, deviceType);
|
}
|
|
/// <summary>
|
/// 添加菜单栏
|
/// </summary>
|
/// <param name="objectText">显示文本</param>
|
/// <param name="unSelectPic">图片:非点亮</param>
|
/// <param name="selectPic">图片:点亮</param>
|
/// <param name="deviceType">设备具体类型</param>
|
private void AddMenuRow(string objectText, string unSelectPic, string selectPic, DeviceConcreteType deviceType)
|
{
|
var rowLayout = new StatuRowLayout(listView);
|
|
//图标
|
var btnIcon = new RowLeftIconView();
|
btnIcon.UnSelectedImagePath = unSelectPic;
|
btnIcon.SelectedImagePath = selectPic;
|
rowLayout.AddChidren(btnIcon);
|
|
//设备
|
var btnObject = new RowCenterView();
|
btnObject.Text = objectText;
|
rowLayout.AddChidren(btnObject);
|
|
//添加向右的图标
|
rowLayout.AddRightIconControl();
|
|
rowLayout.MouseUpEvent += (sender, e) =>
|
{
|
//第三方设备:直接进入配置设备阶段,因为也不知道它咋入网
|
if (deviceType == DeviceConcreteType.UnKownDevice)
|
{
|
var form = new Device.SearchDeviceForm();
|
this.AddForm(form);
|
}
|
else
|
{
|
//让设备入网的指示图画面
|
var form = new Direction.AddDeviceDirectionForm();
|
this.AddForm(form, deviceType);
|
}
|
};
|
}
|
}
|
}
|