using System;
|
using Shared;
|
using Shared.SimpleControl.R;
|
using Shared.SimpleControl;
|
using System.Collections.Generic;
|
|
namespace SmartHome.UI.SimpleControl.Phone
|
{
|
public class LocalSceneListPage : FrameLayout
|
{
|
public void Show (Action action, List<YiPanelScene> localscenelist,YIPanel yipanel)
|
{
|
AddChidren (new Button {
|
Height = Application.GetRealHeight (36),
|
BackgroundColor = SkinStyle.Current.MusicTopFrameLayout,
|
});
|
|
var topFrameLayout = new FrameLayout {
|
Height = Application.GetRealHeight (100),
|
Y = Application.GetRealHeight (36),
|
BackgroundColor = SkinStyle.Current.MusicTopFrameLayout,
|
};
|
AddChidren (topFrameLayout);
|
|
var LocallistName = new Button {
|
//Text = "本地场景",
|
TextID=MyInternationalizationString.SceneList,
|
TextSize = 17,
|
TextColor = SkinStyle.Current.MusicTextColor,
|
};
|
topFrameLayout.AddChidren (LocallistName);
|
|
var hdl = new Button {
|
Width = Application.GetRealWidth (154),
|
Height = Application.GetRealHeight (90),
|
X = Application.GetRealWidth (486),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = MainPage.LogoString,
|
};
|
//topFrameLayout.AddChidren (hdl);
|
|
var back = new Button {
|
Width = Application.GetRealWidth (82),
|
Height = Application.GetRealHeight (89),
|
X = Application.GetRealWidth (10),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/HomepageBack.png",
|
};
|
topFrameLayout.AddChidren (back);
|
back.MouseDownEventHandler += (sender, e) => {
|
RemoveFromParent ();
|
scenechannelnumber (yipanel);
|
action ();
|
};
|
|
var middle = new VerticalScrolViewLayout ();
|
middle.Y = topFrameLayout.Bottom;
|
middle.Height = Application.GetRealHeight (1136 - 136);
|
middle.BackgroundColor = SkinStyle.Current.MusicVerticalScrolViewLayout;
|
AddChidren (middle);
|
|
foreach (var scene in localscenelist) {
|
var sceneRowLayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
BackgroundColor = 0xff323232,
|
};
|
middle.AddChidren (sceneRowLayout);
|
|
var btnscene = new Button {
|
Width = Application.GetRealWidth (200),
|
Text = scene.Name,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
};
|
sceneRowLayout.AddChidren (btnscene);
|
|
var btnCheck = new Button {
|
Width = Application.GetRealWidth (60),
|
Height = Application.GetRealHeight (59),
|
Gravity = Gravity.CenterVertical,
|
X = Application.GetRealWidth (550),
|
SelectedImagePath = "Light/CheckOn.png",
|
UnSelectedImagePath = "Light/Check.png",
|
};
|
sceneRowLayout.AddChidren (btnCheck);
|
|
if (yipanel.yIPanelSceneList.Find ((s) =>scene.Name==s.Name) != null) {
|
btnCheck.IsSelected = true;
|
}
|
|
EventHandler<MouseEventArgs> deviicetypeclick = (sender, e) => {
|
btnCheck.IsSelected = !btnCheck.IsSelected;
|
if (btnCheck.IsSelected) {
|
if (null == yipanel.yIPanelSceneList.Find ((s) =>scene.Name == s.Name)) {
|
yipanel.yIPanelSceneList.Add (scene);
|
}
|
} else {
|
yipanel.yIPanelSceneList.RemoveAll ((s) => scene.Name == s.Name);
|
}
|
};
|
sceneRowLayout.MouseUpEventHandler += deviicetypeclick;
|
btnscene.MouseUpEventHandler += deviicetypeclick;
|
btnCheck.MouseUpEventHandler += deviicetypeclick;
|
|
}
|
|
|
}
|
|
void scenechannelnumber (YIPanel yipanel)
|
{
|
|
foreach (var scene in yipanel.yIPanelSceneList) {
|
if (scene.Channelnumber == 0) {
|
for (int i = 1; i < 32; i++) {
|
var number =yipanel.yIPanelSceneList.Find ((s) => { return (s.Channelnumber != 0 && s.Channelnumber == (byte)i); });
|
if (number == null) {
|
scene.Channelnumber = (byte)i;
|
scene.LargeClass = 4;
|
break;
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|