using System;
|
using SmartHome;
|
using Shared;
|
using Newtonsoft.Json.Linq;
|
using Shared.SimpleControl;
|
using System.Collections.Generic;
|
using Shared.SimpleControl.R;
|
|
namespace SuperGateWay
|
{
|
public class DeviceTypePage : FrameLayout
|
{
|
|
public DeviceTypePage ()
|
{
|
Tag = "Logic";
|
}
|
public void Show (List<DeviceType> deviceTypelist,string name, GateWay gateWay)
|
{
|
this.BackgroundColor = 0xFF1F1F1F;
|
this.AddChidren (new Button {
|
Height = Application.GetRealHeight (30),
|
});
|
|
var topFrameLayout = new FrameLayout {
|
Height = Application.GetRealHeight (100),
|
Y = Application.GetRealHeight (30),
|
};
|
AddChidren (topFrameLayout);
|
|
var titleName = new Button {
|
//Text = "添加设备",
|
// TextID = MyInternationalizationString.adddevice,
|
Text = Language.StringByID (MyInternationalizationString.selects) + name,
|
TextSize = 17,
|
};
|
topFrameLayout.AddChidren (titleName);
|
|
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 ();
|
};
|
|
var tetleframeLayout = new FrameLayout {
|
Y = topFrameLayout.Bottom,
|
Height = Application.GetRealHeight (100),
|
};
|
// AddChidren (tetleframeLayout);
|
|
var tetlebtn = new Button {
|
//TextID = MyInternationalizationString.selects,
|
Text = Language.StringByID (MyInternationalizationString.selects) + name,
|
TextSize = 16,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
};
|
tetleframeLayout.AddChidren (tetlebtn);
|
|
var middle = new VerticalScrolViewLayout ();
|
middle.Y = topFrameLayout.Bottom;
|
middle.Height = Application.GetRealHeight (Application.DesignHeight - 130);
|
middle.BackgroundColor = 0xff323232;
|
this.AddChidren (middle);
|
|
|
foreach (var common in gateWay.Commons) {
|
|
if (deviceTypelist.Count != 0 && !deviceTypelist.Contains (common.Type)) {
|
continue;
|
}
|
var row = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
BackgroundColor = 0xff323232,
|
};
|
middle.AddChidren (row);
|
|
var devicename = new Button {
|
Gravity = Gravity.CenterVertical,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
//SelectedBackgroundColor = 0xFFE9652D,
|
Text = common.Name,
|
};
|
row.AddChidren (devicename);
|
|
var btndeviceback = new Button {
|
Width = Application.GetRealWidth (87),
|
Height = Application.GetRealHeight (100),
|
UnSelectedImagePath = "MusicIcon/Next.png",
|
SelectedImagePath = "MusicIcon/NextSelecte.png",
|
X = Application.GetRealWidth (550),
|
};
|
row.AddChidren (btndeviceback);
|
|
EventHandler<MouseEventArgs> devicclick = (sen, e) => {
|
var deviceStatePage = new DeviceStatePage ();
|
MainPage.MainFrameLayout.AddChidren (deviceStatePage);
|
deviceStatePage.Show (common, gateWay);
|
};
|
row.MouseUpEventHandler += devicclick;
|
devicename.MouseUpEventHandler += devicclick;
|
btndeviceback.MouseUpEventHandler += devicclick;
|
|
}
|
|
}
|
|
|
}
|
}
|