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 + CommonPage.XLeft) }; scrollView.AddChidren(itemView); for (int i = 0; i < 2; i++) { var icon = new Button() { X=Application.GetRealWidth(CommonPage.XLeft+i*(467+32)), Width=Application.GetMinRealAverage(467), Height=Application.GetMinRealAverage(311), Gravity=Gravity.CenterVertical, UnSelectedImagePath = $"SceneIcon/{k}.jpg", }; itemView.AddChidren(icon); icon.SetViewShadow(true); k++; EventHandler selectIcon = (sender, e) => { //CategoryAddScene.ImagePath = icon.UnSelectedImagePath; //Room.AddRoomScene.ImagePath = icon.UnSelectedImagePath; action?.Invoke(icon.UnSelectedImagePath); action = null; this.RemoveFromParent(); }; icon.MouseUpEventHandler += selectIcon; } } } #endregion } }