using System; using Shared.Common; namespace Shared.Phone.Device.Room { public class AddRoomSelectPicByLocal:FrameLayout { public Action action; public AddRoomSelectPicByLocal() { BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; } public override void RemoveFromParent() { base.RemoveFromParent(); } public void Show() { ShowPic(); } void ShowPic() { #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.SelectPic, TextSize = 20, TextColor = ZigbeeColor.Current.GXCTextBlackColor, Width = Application.GetRealWidth(500), Gravity = Gravity.CenterHorizontal }; topView.AddChidren(title); var back = new Device.CommonForm.BackButton() { };
 topView.AddChidren(back); back.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; #endregion #region midFL var midFl = new VerticalScrolViewLayout() { Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height), Y = topView.Bottom, BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, }; this.AddChidren(midFl); for (int i = 0; i < 25; i++) { var RoomRowView = new FrameLayout() { Height = Application.GetRealHeight(600), Width = Application.GetRealWidth(CommonPage.AppRealWidth - CommonPage.XLeft * 2), Gravity=Gravity.CenterHorizontal, BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, Radius = CommonPage.BigFormRadius, }; midFl.AddChidren(RoomRowView); var backGroundBtn = new Button() { Y = Application.GetRealHeight(50), Width = Application.GetMinRealAverage(CommonPage.AppRealWidth - CommonPage.XLeft * 2), Height = Application.GetMinRealAverage(550), UnSelectedImagePath = "Room/r" + (i).ToString() + ".png", Radius = CommonPage.BigFormRadius, Gravity=Gravity.CenterHorizontal }; RoomRowView.AddChidren(backGroundBtn); backGroundBtn.MouseUpEventHandler += (sender, e) => { if (AddRoom.room.BackgroundImageType == 1 || AddRoom.room.BackgroundImageType == 2) { AddRoom.OldBackgroundImagePath = AddRoom.room.BackgroundImage; } //AddRoom.room.BackgroundImage = backGroundBtn.UnSelectedImagePath; action?.Invoke(backGroundBtn.UnSelectedImagePath); this.RemoveFromParent(); }; } #endregion } } }