using System;
using Shared.Common;
using Shared.Phone.Device.CommonForm;
namespace Shared.Phone.Device.Category
{
public class CategorySceneSelectImgByLocal:FrameLayout
{
///
/// bodyFrameLayout
///
private FrameLayout bodyFrameLayout;
public Action action;
public CategorySceneSelectImgByLocal()
{
BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
}
public override void RemoveFromParent()
{
base.RemoveFromParent();
}
public void Show()
{
AddTop();
AddBodyView();
}
#region Add____________________________________
///
/// AddTop
///
public void AddTop()
{
var top = new TopFrameLayout();
AddChidren(top);
top.InitTopview();
top.SetTopTitle(R.MyInternationalizationString.SelectScenePic);
top.backButton.MouseUpEventHandler += (sender, e) =>
{
RemoveFromParent();
};
}
///
/// AddBodyView
///
public void AddBodyView()
{
bodyFrameLayout = new FrameLayout()
{
Y = Application.GetRealHeight(184),
Height = Application.GetRealHeight(1737),
BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor
};
AddChidren(bodyFrameLayout);
//FunctionIconButton
var scrollView = new VerticalScrolViewLayout()
{
Height = Application.GetRealHeight(1737),
BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor
};
bodyFrameLayout.AddChidren(scrollView);
int k = 0;
for (int j = 0; j < 5; j++)
{
var itemView = new FrameLayout()
{
Height = Application.GetRealHeight(311 + 58)
};
scrollView.AddChidren(itemView);
for (int i = 0; i < 2; i++)
{
var icon = new ImageView()
{
X=Application.GetRealWidth(58+i*(467+32)),
Y=Application.GetRealHeight(58),
Width=Application.GetRealWidth(467),
Height=Application.GetRealHeight(311),
ImagePath = $"SceneIcon/{k}.jpg",
Radius =(uint)Application.GetRealHeight(17)
};
itemView.AddChidren(icon);
icon.SetViewShadow(true);
k++;
EventHandler selectIcon = (sender, e) =>
{
action?.Invoke(icon.ImagePath);
action = null;
this.RemoveFromParent();
};
icon.MouseUpEventHandler += selectIcon;
}
}
}
#endregion
}
}