using System;
|
using Shared.Common;
|
|
namespace Shared.Phone.Device.CommonForm
|
{
|
public class DeviceIconSelectedIMGByLocal:FrameLayout
|
{
|
public Action<string,string > action;
|
public DeviceIconSelectedIMGByLocal()
|
{
|
BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
|
}
|
public void Show()
|
{
|
#region topview
|
var topBGView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(CommonPage.Navigation_Height),
|
BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor
|
};
|
AddChidren(topBGView);
|
var topView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(CommonPage.NavigationTitle_Y),
|
Height = Application.GetRealHeight(CommonPage.Navigation_Height - CommonPage.NavigationTitle_Y),
|
BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor,
|
};
|
AddChidren(topView);
|
|
var title = new Button()
|
{
|
TextAlignment = TextAlignment.Center,
|
TextID = R.MyInternationalizationString.ChangeDeviceInfo,
|
TextSize = 20,
|
TextColor = ZigbeeColor.Current.GXCTextBlackColor,
|
Width = Application.GetRealWidth(CommonPage.AppRealWidth - 500),
|
Gravity = Gravity.CenterHorizontal
|
};
|
topView.AddChidren(title);
|
|
var back = new BackButton { };
|
topView.AddChidren(back);
|
back.MouseUpEventHandler += (sender, e) =>
|
{
|
this.RemoveFromParent();
|
};
|
#endregion
|
#region 选择图片
|
var scrollView = new VerticalScrolViewLayout()
|
{
|
Y=topBGView.Bottom,
|
Height=Application.GetRealHeight(CommonPage.AppRealHeight-CommonPage.Navigation_Height),
|
Width=Application.GetRealWidth(CommonPage.AppRealWidth-CommonPage.XLeft*2),
|
Gravity=Gravity.CenterHorizontal
|
};
|
AddChidren(scrollView);
|
int xWidth = (int)((CommonPage.AppRealWidth - CommonPage.XLeft * 2 - 100) / 3.0);
|
|
int k= 0;
|
for (int j = 0; j < 8; j++)
|
{
|
var itemView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(xWidth + 50)
|
};
|
scrollView.AddChidren(itemView);
|
for (int i = 1; i <= 3; i++)
|
{
|
var icon = new Device.CommonForm.SelectedStatuButton
|
{
|
X = Application.GetRealWidth((xWidth + 50) * (i-1)),
|
Y = Application.GetRealHeight(50),
|
Width = Application.GetMinRealAverage(xWidth),
|
Height = Application.GetMinRealAverage(xWidth),
|
UnSelectedImagePath = $"DeviceIcon/{k}.png",
|
SelectedImagePath = $"DeviceIcon/{k}Selected.png"
|
};
|
k++;
|
itemView.AddChidren(icon);
|
icon.MouseUpEventHandler += (sender, e) =>
|
{
|
action(icon.UnSelectedImagePath,icon.SelectedImagePath);
|
RemoveFromParent();
|
};
|
}
|
}
|
#endregion
|
}
|
}
|
}
|