using System;
|
using System.Collections.Generic;
|
|
namespace Shared.SimpleControl.Phone
|
{
|
public class SecuritySensorListPage : FrameLayout
|
{
|
static SecuritySensorListPage curView;
|
public SecuritySensorListPage ()
|
{
|
}
|
|
|
public void ShowPage()
|
{
|
this.RemoveAll ();
|
#region 标题
|
var topView = new FrameLayout () {
|
Y = Application.GetRealHeight (36),
|
Height = Application.GetRealHeight (90),
|
};
|
AddChidren (topView);
|
|
var title = new Button () {
|
TextAlignment = TextAlignment.Center,
|
//TextID = R.MyInternationalizationString.Environmental,
|
Text = "房间列表",
|
TextSize = 19,
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
topView.AddChidren (title);
|
|
var logo = new Button () {
|
Width = Application.GetRealWidth (154),
|
Height = Application.GetRealHeight (90),
|
X = Application.GetRealWidth (486),
|
UnSelectedImagePath = MainPage.LogoString,
|
};
|
topView.AddChidren (logo);
|
var back = new Button () {
|
Height = Application.GetRealHeight (90),
|
Width = Application.GetRealWidth (85),
|
UnSelectedImagePath = "Item/Back.png",
|
SelectedImagePath = "Item/BackSelected.png",
|
};
|
topView.AddChidren (back);
|
back.MouseUpEventHandler += (sender, e) => {
|
(Parent as PageLayout).PageIndex -= 1;
|
curView = null;
|
};
|
#endregion
|
|
|
VerticalScrolViewLayout roomListView = new VerticalScrolViewLayout () {
|
Height = Application.GetRealHeight (Application.DesignHeight-90),
|
};
|
AddChidren (roomListView);
|
FrameLayout bottomView = new FrameLayout () {
|
Height = Application.GetRealHeight (90),
|
};
|
AddChidren (bottomView);
|
Button btnHideNullRoom = new Button () {
|
Width = LayoutParams.MatchParent,
|
Height = LayoutParams.MatchParent,
|
TextID = UserConfig.Instance.HideInvalidRoomScene == true ? R.MyInternationalizationString.ShowAllRoomList : R.MyInternationalizationString.HideNullRoomScene,
|
TextAlignment = TextAlignment.Center,
|
IsSelected = UserConfig.Instance.HideInvalidRoomScene,
|
TextColor = SkinStyle.Current.TextColor1,
|
SelectedTextColor = SkinStyle.Current.TextColor1,
|
BackgroundColor = SkinStyle.Current.MainColor,
|
SelectedBackgroundColor = SkinStyle.Current.MainColor,
|
};
|
bottomView.AddChidren (btnHideNullRoom);
|
btnHideNullRoom.MouseUpEventHandler += (sender, e) => {
|
btnHideNullRoom.IsSelected = !btnHideNullRoom.IsSelected;
|
UserConfig.Instance.HideInvalidRoomScene = btnHideNullRoom.IsSelected;
|
UserConfig.Instance.SaveUserConfig ();
|
InitRoom (btnHideNullRoom.IsSelected, roomListView);
|
btnHideNullRoom.TextID = UserConfig.Instance.HideInvalidRoomScene == true ? R.MyInternationalizationString.ShowAllRoomList : R.MyInternationalizationString.HideNullRoomScene;
|
};
|
InitRoom (btnHideNullRoom.IsSelected, roomListView);
|
|
}
|
|
|
void InitRoom (bool hideNull, VerticalScrolViewLayout roomListView)
|
{
|
roomListView.RemoveAll ();
|
foreach (var room in Room.Lists) {
|
if (string.IsNullOrEmpty (room.Name)) {
|
continue;
|
}
|
if (hideNull && room.SceneFilePathList.Count == 0)
|
continue;
|
var roomView = new FrameLayout () {
|
Height = Application.GetRealHeight (110),
|
BackgroundColor = SkinStyle.Current.ViewColor,
|
Tag = room.Name
|
};
|
roomListView.AddChidren (roomView);
|
var btnPoint = new Button () {
|
Width = Application.GetRealWidth (10),
|
Height = Application.GetRealHeight (10),
|
X = Application.GetRealWidth (30),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "Item/Point.png",
|
SelectedImagePath = "Item/Point.png",
|
};
|
roomView.AddChidren (btnPoint);
|
|
var btnRoomName = new Button () {
|
Text = room.Name,
|
X = btnPoint.Right + Application.GetRealWidth (20),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
roomView.AddChidren (btnRoomName);
|
|
var btnNumber = new EditText () {
|
Width = Application.GetRealWidth (50),
|
Height = Application.GetRealHeight (35),
|
X = Application.GetRealWidth (570),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "Item/LightingCount.png",
|
SelectedImagePath = "Item/LightingCount.png",
|
Enable = false,
|
Text = room.SceneFilePathList.Count.ToString (),
|
TextAlignment = TextAlignment.Center,
|
Tag = room.Name
|
};
|
roomView.AddChidren (btnNumber);
|
|
btnRoomName.MouseUpEventHandler += (sender, e) => {
|
var userScenePage = new SecuritySensorPage ();
|
UserMiddle.DevicePageView.AddChidren (userScenePage);
|
userScenePage.ShowPage ();
|
UserMiddle.DevicePageView.PageIndex = 2;
|
};
|
|
}
|
}
|
}
|
}
|