using System; using System.Collections.Generic; using System.Text; using ZigBee.Device; namespace Shared.Phone.UserCenter { /// /// 做成一个显示设备+房间的RowLayout /// public class DeviceRoomViewRow : StatuRowLayout { /// /// 设备 /// public CommonDevice device = null; /// /// 房间名字列表 /// public List listRoom = null; /// /// 图标控件 /// public RowLeftIconView btnIcon = null; /// /// 设备控件 /// public RowTopBlackView btnDevie = null; /// /// 房间控件 /// public RowBottomGrayView btnRoom = null; /// /// 做成一个显示设备+房间的RowLayout /// /// /// /// public DeviceRoomViewRow(VerticalScrolViewLayout listView, CommonDevice i_device, List i_listRoom = null) { this.device = i_device; this.listRoom = i_listRoom; listView.AddChidren(this); //初始化内部控件 this.InitControl(); } /// /// 做成一个显示设备+房间的RowLayout,加入父容器后,调用InitControl()执行初始化 /// /// /// public DeviceRoomViewRow(CommonDevice i_device, List i_listRoom = null) { this.device = i_device; this.listRoom = i_listRoom; } /// /// 初始化内部控件 /// 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); } /// /// 刷新全部显示信息 /// /// 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; } } }