using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using ZigBee.Device;
|
|
namespace Shared.Phone.UserCenter
|
{
|
/// <summary>
|
/// 做成一个显示设备+房间的RowLayout
|
/// </summary>
|
public class DeviceRoomViewRow : StatuRowLayout
|
{
|
/// <summary>
|
/// 设备
|
/// </summary>
|
public CommonDevice device = null;
|
/// <summary>
|
/// 房间名字列表
|
/// </summary>
|
public List<string> listRoom = null;
|
/// <summary>
|
/// 图标控件
|
/// </summary>
|
public RowLeftIconView btnIcon = null;
|
/// <summary>
|
/// 设备控件
|
/// </summary>
|
public RowTopBlackView btnDevie = null;
|
/// <summary>
|
/// 房间控件
|
/// </summary>
|
public RowBottomGrayView btnRoom = null;
|
|
|
/// <summary>
|
/// 做成一个显示设备+房间的RowLayout
|
/// </summary>
|
/// <param name="listView"></param>
|
/// <param name="i_device"></param>
|
/// <param name="i_listRoom"></param>
|
public DeviceRoomViewRow(VerticalScrolViewLayout listView, CommonDevice i_device, List<string> i_listRoom = null)
|
{
|
this.device = i_device;
|
this.listRoom = i_listRoom;
|
|
listView.AddChidren(this);
|
//初始化内部控件
|
this.InitControl();
|
}
|
|
/// <summary>
|
/// 做成一个显示设备+房间的RowLayout,加入父容器后,调用InitControl()执行初始化
|
/// </summary>
|
/// <param name="i_device"></param>
|
/// <param name="i_listRoom"></param>
|
public DeviceRoomViewRow(CommonDevice i_device, List<string> i_listRoom = null)
|
{
|
this.device = i_device;
|
this.listRoom = i_listRoom;
|
}
|
|
/// <summary>
|
/// 初始化内部控件
|
/// </summary>
|
public void InitControl()
|
{
|
//图标
|
btnIcon = new RowLeftIconView();
|
Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, device);
|
|
if (btnIcon.UnSelectedImagePath != null
|
&& btnIcon.UnSelectedImagePath.Contains(DeviceType.OnOffSwitch.ToString()) == true)
|
{
|
//将控件适配为【点号】控件
|
btnIcon.ChangedControlInPointMode();
|
btnIcon.UnSelectedImagePath = "Device/OnOffSwitch.png";
|
btnIcon.SelectedImagePath = "Device/OnOffSwitchSelected.png";
|
}
|
this.AddChidren(btnIcon);
|
|
//设备
|
btnDevie = new RowTopBlackView();
|
btnDevie.Text = Common.LocalDevice.Current.GetDeviceEpointName(device);
|
this.AddChidren(btnDevie);
|
|
//房间
|
btnRoom = new RowBottomGrayView();
|
if (this.listRoom != null)
|
{
|
btnRoom.Text = Common.Room.CurrentRoom.GetRoomName(this.listRoom);
|
}
|
else
|
{
|
btnRoom.Text = Common.Room.CurrentRoom.GetRoomNameByDevice(device);
|
}
|
this.AddChidren(btnRoom);
|
}
|
|
/// <summary>
|
/// 刷新全部显示信息
|
/// </summary>
|
/// <param name="i_device"></param>
|
public void RefreshControlInfo(CommonDevice i_device)
|
{
|
this.device = i_device;
|
btnDevie.Text = Common.LocalDevice.Current.GetDeviceEpointName(device);
|
btnRoom.Text = Common.Room.CurrentRoom.GetRoomNameByDevice(device);
|
|
var btnCom = new ButtonCommon();
|
Common.LocalDevice.Current.SetDeviceIconToControl(btnCom, device);
|
if (btnIcon.PointMode == true && btnCom.UnSelectedImagePath != null
|
&& btnCom.UnSelectedImagePath.Contains(DeviceType.OnOffSwitch.ToString()) == false)
|
{
|
//变更为原来的大小
|
btnIcon.ChangedControlInNormalMode();
|
}
|
btnIcon.UnSelectedImagePath = btnCom.UnSelectedImagePath;
|
btnIcon.SelectedImagePath = btnCom.SelectedImagePath;
|
}
|
}
|
}
|