using System; using System.Collections.Generic; using System.Text; using ZigBee.Device; namespace Shared.Phone.UserCenter.DeviceShard { /// /// 分享设备的配置列表的画面 /// public class ShardConfigureDeviceListForm : UserCenterCommonForm { /// /// 列表控件 /// private VerticalScrolViewLayout listview = null; /// /// 新上报的设备(注意:这个东西是个地址引用) /// private List listNewDevice = null; /// /// 画面显示(底层会固定调用此方法,借以完成画面创建) /// /// 设备列表 public void ShowForm(List listdevices) { this.listNewDevice = listdevices; //设置标题信息 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uConfigureDevice)); //初始化中部控件 this.InitMiddleFrame(); //添加所有的行 this.AddAllRowLayout(); } /// /// 初始化中部控件 /// private void InitMiddleFrame() { //清空bodyFrame this.ClearBodyFrame(); //输出回路列表 var btnText = new TitleViewControl(); btnText.Y = Application.GetRealHeight(40); btnText.TextColor = UserCenterColor.Current.TextGrayColor; btnText.TextID = R.MyInternationalizationString.uOutputCircuitList; bodyFrameLayout.AddChidren(btnText); listview = new VerticalScrolViewLayout(); listview.Y = btnText.Bottom; listview.Height = bodyFrameLayout.Height - btnText.Bottom; bodyFrameLayout.AddChidren(listview); } /// /// 添加所有的行 /// private void AddAllRowLayout() { foreach (CommonDevice device in this.listNewDevice) { this.AddRowLayout(device); } } /// /// 添加行 /// /// Device. private void AddRowLayout(CommonDevice device) { //设备控件 var deviceRow = new DeviceRoomViewRow(listview, device); //向右图标 deviceRow.AddRightIconControl(); //检测设备是否拥有测试的功能 if (Common.LocalDevice.Current.DeviceIsCanTest(device) == true) { //测试 var btnTest = new RowSecondRightIconView(); btnTest.UnSelectedImagePath = "Item/Test.png"; btnTest.SelectedImagePath = "Item/TestSelected.png"; deviceRow.AddChidren(btnTest, ChidrenBindMode.NotBind); btnTest.MouseUpEventHandler += (sender, e) => { //测试 Common.LocalDevice.Current.SetTestCommand(device); }; } deviceRow.MouseUpEvent += (sender, e) => { var form = new ShardDeviceEpointInfoForm(); this.AddForm(form, device); form.ActionNameChangedEvent += (deviceName, listName) => { //变更房间 Common.Room.CurrentRoom.ChangedRoom(device, listName); //刷新全部信息信息 deviceRow.listRoom = listName; deviceRow.RefreshControlInfo(device); }; }; } } }