using System; using Shared.Common; namespace Shared.Phone.Device.Category { public class CategorySceneSelectRoomList:FrameLayout { public Action SelectedRoomAction; public CategorySceneSelectRoomList() { BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor; } public override void RemoveFromParent() { base.RemoveFromParent(); } 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() { TextID = R.MyInternationalizationString.SelectRoom, TextSize = 20, TextColor = ZigbeeColor.Current.GXCTextBlackColor, Width = Application.GetRealWidth(CommonPage.AppRealWidth - 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 roomBodyView = new VerticalScrolViewLayout() { Y=topView.Bottom, Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; AddChidren(roomBodyView); foreach (var roomFilePath in Config.Instance.Home.RoomFilePathList) { var room = Shared.Common.Room.GetRoomByFilePath(roomFilePath); if (room == null) { continue; } var roomRowView = new RowLayout() { Height = Application.GetRealHeight(600), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, LineColor = ZigbeeColor.Current.GXCBackgroundColor }; roomBodyView.AddChidren(roomRowView); var backGroundBtn = new Button() { Y = Application.GetRealHeight(50), Width = Application.GetRealWidth(CommonPage.AppRealWidth - CommonPage.XLeft * 2), Height = Application.GetRealHeight(550), Gravity=Gravity.CenterHorizontal, UnSelectedImagePath = room.BackgroundImage, Radius = CommonPage.BigFormRadius, }; roomRowView.AddChidren(backGroundBtn); var hardBlackBG = new FrameLayout() { Y = Application.GetRealHeight(50), Width = Application.GetRealWidth(CommonPage.AppRealWidth - CommonPage.XLeft * 2), Height = Application.GetRealHeight(550), Gravity = Gravity.CenterHorizontal, Radius = CommonPage.BigFormRadius, BackgroundColor = ZigbeeColor.Current.GXCBlack70Color }; roomRowView.AddChidren(hardBlackBG); var btnRoomName = new Button() { Width = Application.GetRealWidth(500), Height = Application.GetRealHeight(200), Text = room.Name, TextAlignment = TextAlignment.Center, TextSize = 25, TextColor = ZigbeeColor.Current.GXCTextWhiteColor, Gravity = Gravity.Center }; roomRowView.AddChidren(btnRoomName); EventHandler selectZoneEventHandler = (sender, e) => { SelectedRoomAction?.Invoke(room); this.RemoveFromParent(); }; hardBlackBG.MouseUpEventHandler += selectZoneEventHandler; btnRoomName.MouseUpEventHandler += selectZoneEventHandler; } #endregion } } }