using System; using Shared.Common; namespace Shared.Phone.Device.Room { /// /// Add devie detail from add function. /// public class AddDevieDetailFromAddFunction:FrameLayout { /// /// Initializes a new instance of the class. /// public AddDevieDetailFromAddFunction() { BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; Tag = "categoryAddScene"; } /// /// Removes from parent. /// public override void RemoveFromParent() { AddRoomContent.instance?.RefreshBodyView(); base.RemoveFromParent(); } /// /// Show the specified device and room. /// /// Device. /// Room. public void Show(DeviceUI device, Shared.Common.Room room) { #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 back = new Device.CommonForm.BackButton() { }; topView.AddChidren(back); back.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; if (device == null || device.CommonDevice == null) { return; } var title = new Button() { TextAlignment = TextAlignment.Center, Text=DeviceUI.GetDeviceTypeName(device.CommonDevice.Type), TextSize = 20, TextColor = ZigbeeColor.Current.GXCTextBlackColor, Width = Application.GetRealWidth(1080 - 500), Gravity = Gravity.CenterHorizontal }; topView.AddChidren(title); #endregion #region midFL var midFL = new FrameLayout() { Height = Application.GetRealHeight(1920 - 220), Y = topView.Bottom, BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, }; this.AddChidren(midFL); var deviceIMG = new Button() { Y = Application.GetRealHeight(30), Width = Application.GetMinRealAverage(320), Height = Application.GetMinRealAverage(320), UnSelectedImagePath = device.IconPath, SelectedImagePath = device.IconPath, Gravity = Gravity.CenterHorizontal }; midFL.AddChidren(deviceIMG); var deviceTypeName = new Button() { Y = deviceIMG.Bottom, Width = Application.GetRealWidth(900), Height = Application.GetRealHeight(100), TextColor = ZigbeeColor.Current.GXCTextBlackColor, Text=DeviceUI.GetDeviceTypeName(device.CommonDevice.Type), Gravity = Gravity.CenterHorizontal }; midFL.AddChidren(deviceTypeName); var deviceNameFL = new FrameLayout() { Y = deviceTypeName.Bottom, Height = Application.GetRealHeight(170), }; midFL.AddChidren(deviceNameFL); var deviceNameTip = new Button() { X=Application.GetRealWidth(50), Height = Application.GetRealHeight(70), Width = Application.GetRealWidth(500), TextAlignment = TextAlignment.CenterLeft, TextSize = 12, TextColor = ZigbeeColor.Current.GXCButtonTipColor, TextID = R.MyInternationalizationString.DeviceName, }; deviceNameFL.AddChidren(deviceNameTip); var deviceName = new Button() { X = Application.GetRealWidth(50), Y =deviceNameTip.Bottom, Height = Application.GetRealHeight(100)-1, Width = Application.GetRealWidth(900), TextAlignment = TextAlignment.CenterLeft, TextSize = 20, TextColor = ZigbeeColor.Current.GXCTextBlackColor, Text=device.CommonDevice.DeviceEpointName, }; deviceNameFL.AddChidren(deviceName); var deviceNameLine = new Button() { Y = deviceName.Bottom, Height = 1, BackgroundColor = ZigbeeColor.Current.GXCLineColor }; deviceNameFL.AddChidren(deviceNameLine); var zoneFL = new FrameLayout() { Y = deviceNameFL.Bottom, Height = Application.GetRealHeight(170), }; midFL.AddChidren(zoneFL); var zoneTip = new Button() { X = Application.GetRealWidth(50), Height = Application.GetRealHeight(70), Width = Application.GetRealWidth(500), TextAlignment = TextAlignment.CenterLeft, TextSize = 12, TextColor = ZigbeeColor.Current.GXCButtonTipColor, TextID = R.MyInternationalizationString.BelongZone, }; zoneFL.AddChidren(zoneTip); var zone = new Button() { X = Application.GetRealWidth(50), Y = deviceNameTip.Bottom, Height = Application.GetRealHeight(100) - 1, Width = Application.GetRealWidth(900), TextAlignment = TextAlignment.CenterLeft, TextSize = 20, TextColor = ZigbeeColor.Current.GXCTextBlackColor, Text = room.Name, }; zoneFL.AddChidren(zone); //var zoneRight = new Button() //{ // X = Application.GetRealWidth(1080 - 150), // Width = Application.GetMinRealAverage(110), // Height = Application.GetMinRealAverage(110), // UnSelectedImagePath = "Item/Next.png", // Gravity = Gravity.CenterVertical //}; //zoneFL.AddChidren(zoneRight); var zoneLine = new Button() { Y = zone.Bottom, Height = 1, BackgroundColor = ZigbeeColor.Current.GXCLineColor }; zoneFL.AddChidren(zoneLine); var modelFL = new FrameLayout() { Y = zoneFL.Bottom, Height = Application.GetRealHeight(170), }; midFL.AddChidren(modelFL); var modelTip = new Button() { X = Application.GetRealWidth(50), Height = Application.GetRealHeight(70), Width = Application.GetRealWidth(300), TextAlignment = TextAlignment.CenterLeft, TextSize = 12, TextColor = ZigbeeColor.Current.GXCButtonTipColor, TextID = R.MyInternationalizationString.BelongModel, }; modelFL.AddChidren(modelTip); var model = new Button() { X = Application.GetRealWidth(50), Y = deviceNameTip.Bottom, Height = Application.GetRealHeight(100) - 1, Width = Application.GetRealWidth(900), TextAlignment = TextAlignment.CenterLeft, TextSize = 20, TextColor = ZigbeeColor.Current.GXCTextBlackColor, Text = device.CommonDevice.DeviceName }; modelFL.AddChidren(model); var modelLine = new Button() { Y = model.Bottom, Height = 1, BackgroundColor = ZigbeeColor.Current.GXCLineColor }; modelFL.AddChidren(modelLine); var sharedFL = new FrameLayout() { Y = modelFL.Bottom, Height = Application.GetRealHeight(170), }; //midFL.AddChidren(sharedFL); var sharedBtn = new Button() { X = Application.GetRealWidth(50), Y = Application.GetRealHeight(70), Height = Application.GetRealHeight(100) - 1, Width = Application.GetRealWidth(500), TextAlignment = TextAlignment.CenterLeft, TextSize = 20, TextColor = ZigbeeColor.Current.GXCTextBlackColor, TextID=R.MyInternationalizationString.Shared }; sharedFL.AddChidren(sharedBtn); var sharedRight = new Button() { X = Application.GetRealWidth(1080 - 150), Width = Application.GetMinRealAverage(110), Height = Application.GetMinRealAverage(110), UnSelectedImagePath = "Item/Next.png", Gravity = Gravity.CenterVertical }; sharedFL.AddChidren(sharedRight); var sharedNum = new Button() { X = Application.GetRealWidth(1080 - 150 - 110), Width = Application.GetRealWidth(110), Height = Application.GetRealHeight(110), TextAlignment = TextAlignment.CenterRight, TextSize = 12, TextColor = ZigbeeColor.Current.GXCButtonTipColor, Text ="1人", Gravity=Gravity.CenterVertical }; sharedFL.AddChidren(sharedNum); var sharedLine = new Button() { Y = sharedBtn.Bottom, Height = 1, BackgroundColor = ZigbeeColor.Current.GXCLineColor }; sharedFL.AddChidren(sharedLine); var confirmBtn = new Device.CommonForm.CompleteButton(1,2,3) { TextID = R.MyInternationalizationString.ConfirmAdd, }; AddChidren(confirmBtn); confirmBtn.MouseUpEventHandler += (sender, e) => { room.AddDevice(device.FileName); var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.AddDeviceSuccess), Language.StringByID(R.MyInternationalizationString.Close)); alert.Show(); alert.ResultEventHandler += (alertSend, alertE) => { //回到功能、场景界面 UserView.HomePage.Instance.RemoveViewByTag("categoryAddScene"); }; }; #endregion } } }