using System;
|
using System.Collections.Generic;
|
using System.Text;
|
|
namespace Shared.Phone.UserCenter
|
{
|
/// <summary>
|
/// 做成一个显示场景的控件
|
/// </summary>
|
public class SceneViewRow : StatuRowLayout
|
{
|
/// <summary>
|
/// 场景(由初始化函数的参数指定,有可能为空)
|
/// </summary>
|
public Common.SceneRoomUI sceneRoomUI = null;
|
/// <summary>
|
/// 场景
|
/// </summary>
|
public Common.SceneUI sceneUI = null;
|
/// <summary>
|
/// 图片控件
|
/// </summary>
|
private PicViewControl btnImage = null;
|
/// <summary>
|
/// 场景控件
|
/// </summary>
|
private ViewNormalControl btnSceneName = null;
|
/// <summary>
|
/// 房间控件
|
/// </summary>
|
private ViewNormalControl btnRoom = null;
|
|
/// <summary>
|
/// 行之间的间隔
|
/// </summary>
|
private int rowSpcace = 5;
|
|
/// <summary>
|
/// 做成一个场景的行控件
|
/// </summary>
|
/// <param name="listView">列表控件,可以为空</param>
|
/// <param name="i_SceneRoomUI">场景</param>
|
public SceneViewRow(VerticalScrolViewLayout listView, Common.SceneRoomUI i_SceneRoomUI)
|
{
|
this.sceneRoomUI = i_SceneRoomUI;
|
this.sceneUI = this.sceneRoomUI.sceneUI;
|
this.Height = Application.GetRealHeight(365 + rowSpcace * 2);
|
|
if (listView != null)
|
{
|
listView.AddChidren(this);
|
//初始化内部控件
|
this.InitControl();
|
}
|
}
|
|
/// <summary>
|
/// 做成一个场景的行控件
|
/// </summary>
|
/// <param name="listView">列表控件,可以为空</param>
|
/// <param name="i_SceneUI">场景</param>
|
public SceneViewRow(VerticalScrolViewLayout listView, Common.SceneUI i_SceneUI)
|
{
|
this.sceneUI = i_SceneUI;
|
this.Height = Application.GetRealHeight(365 + rowSpcace * 2);
|
|
if (listView != null)
|
{
|
listView.AddChidren(this);
|
//初始化内部控件
|
this.InitControl();
|
}
|
}
|
|
/// <summary>
|
/// 初始化内部控件
|
/// </summary>
|
public void InitControl()
|
{
|
this.LineColor = UserCenterColor.Current.Transparent;
|
|
//图片
|
btnImage = new PicViewControl(Application.CurrentWidth - ControlCommonResourse.XXLeft * 2, this.Height - Application.GetRealHeight(rowSpcace * 2), false);
|
btnImage.X = ControlCommonResourse.XXLeft;
|
btnImage.UnSelectedImagePath = this.sceneUI.IconPath;
|
btnImage.Radius = Common.CommonPage.BigFormRadius;
|
btnImage.Gravity = Gravity.CenterVertical;
|
this.AddChidren(btnImage, ChidrenBindMode.NotBind);
|
|
var btnBack = new ViewNormalControl(btnImage.Width, this.Height - Application.GetRealHeight(rowSpcace * 2));
|
btnBack.Radius = Common.CommonPage.BigFormRadius;
|
btnBack.X = ControlCommonResourse.XXLeft;
|
btnBack.Gravity = Gravity.CenterVertical;
|
btnBack.BackgroundColor = Common.ZigbeeColor.Current.GXCBlack70Color;
|
this.AddChidren(btnBack, ChidrenBindMode.BindEventOnly);
|
|
//房间
|
btnRoom = new ViewNormalControl(600, true);
|
btnRoom.X = Application.GetRealWidth(30) + ControlCommonResourse.XXLeft;
|
btnRoom.TextSize = 10;
|
btnRoom.TextColor = UserCenterColor.Current.White;
|
this.AddChidren(btnRoom, ChidrenBindMode.BindEventOnly);
|
if (this.sceneRoomUI != null)
|
{
|
btnRoom.Text = this.sceneRoomUI.room.Name;
|
}
|
|
//场景名
|
btnSceneName = new ViewNormalControl(btnImage.Width, false);
|
btnSceneName.TextAlignment = TextAlignment.Center;
|
btnSceneName.Text = sceneUI.Name;
|
btnSceneName.TextSize = 20;
|
btnSceneName.TextColor = UserCenterColor.Current.White;
|
btnSceneName.Gravity = Gravity.CenterVertical;
|
this.AddChidren(btnSceneName, ChidrenBindMode.BindEventOnly);
|
}
|
}
|
}
|