using System; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI { public partial class FunctionBaseInfoSetPage : FrameLayout { #region 控件列表 FrameLayout bodyView; #endregion #region 局部变量 Function function; #endregion public FunctionBaseInfoSetPage(Function func) { bodyView = this; function = func; } /// /// 加载界面 /// public void LoadPage() { bodyView.BackgroundColor = CSS_Color.BackgroundColor; new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Setting)); #region name view var nameView = new FrameLayout() { Y = Application.GetRealHeight(64), Height = Application.GetRealHeight(50), BackgroundColor = CSS_Color.MainBackgroundColor, }; bodyView.AddChidren(nameView); var btnNameText = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(160), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.Name, }; nameView.AddChidren(btnNameText); var btnNameValues = new Button() { X = Application.GetRealWidth(186), Width = Application.GetRealWidth(137), TextAlignment = TextAlignment.CenterRight, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.TextFontSize, Text = function.name, }; nameView.AddChidren(btnNameValues); var btnEditName = new Button() { X = Application.GetRealWidth(333), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(28), Height = Application.GetMinRealAverage(28), UnSelectedImagePath = "Public/Edit.png", }; nameView.AddChidren(btnEditName); nameView.AddChidren( new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), BackgroundColor = CSS_Color.DividingLineColor, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(1) }); btnEditName.MouseUpEventHandler += (sender, e) => { LoadEditFunctionNameView(); }; #endregion #region 位置管理 var locationMagtView = new FrameLayout() { Y = nameView.Bottom, Height = Application.GetRealHeight(55), BackgroundColor = CSS_Color.MainBackgroundColor, }; bodyView.AddChidren(locationMagtView); var btnLocationMagtText = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(160), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.LocationManagement, }; locationMagtView.AddChidren(btnLocationMagtText); var btnLocationValues = new Button() { X = Application.GetRealWidth(186), Width = Application.GetRealWidth(137), TextAlignment = TextAlignment.CenterRight, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.TextFontSize, Text = function.GetRoomListName(), }; locationMagtView.AddChidren(btnLocationValues); var btnLocationMagtRight = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/RightIcon.png", }; locationMagtView.AddChidren(btnLocationMagtRight); locationMagtView.AddChidren( new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(54), BackgroundColor = CSS_Color.DividingLineColor, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(1) }); btnLocationMagtRight.MouseUpEventHandler += (sender, e) => { SkipChooseRoomPage(); }; #endregion #region 共享 var sharedView = new FrameLayout() { Y = locationMagtView.Bottom, Height = Application.GetRealHeight(55), BackgroundColor = CSS_Color.MainBackgroundColor, }; bodyView.AddChidren(sharedView); var btnSharedText = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(160), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.Shared, }; sharedView.AddChidren(btnSharedText); var btnSharedRight = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/RightIcon.png", }; sharedView.AddChidren(btnSharedRight); sharedView.AddChidren( new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(54), BackgroundColor = CSS_Color.DividingLineColor, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(1) }); #endregion #region 添加到桌面 var addToDesktopView = new FrameLayout() { Y = sharedView.Bottom, Height = Application.GetRealHeight(55), BackgroundColor = CSS_Color.MainBackgroundColor, }; bodyView.AddChidren(addToDesktopView); var btnAddToDesktopText = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(160), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.AddToDesktop, }; addToDesktopView.AddChidren(btnAddToDesktopText); var btnAddToDesktopRight = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/RightIcon.png", }; addToDesktopView.AddChidren(btnAddToDesktopRight); #endregion } void LoadEditFunctionNameView() { Dialog dialog = new Dialog() { BackgroundColor = 0x99000000, }; FrameLayout dialogView = new FrameLayout() { Gravity = Gravity.Center, Width = Application.GetRealWidth(270), Height = Application.GetRealHeight(172), BackgroundColor = CSS.CSS_Color.MainBackgroundColor, BorderColor = 0x00000000, BorderWidth = 0, Radius = (uint)Application.GetMinRealAverage(10), }; dialog.AddChidren(dialogView); Button btnTitle = new Button() { Y = Application.GetRealHeight(10), Height = Application.GetRealHeight(42), TextColor = CSS.CSS_Color.MainColor, TextSize = CSS.CSS_FontSize.SubheadingFontSize, TextAlignment = TextAlignment.Center, IsBold = true, TextID = StringId.ChangeName, }; dialogView.AddChidren(btnTitle); FrameLayout editView = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Y = btnTitle.Bottom + Application.GetRealHeight(6), Width = Application.GetRealWidth(222), Height = Application.GetRealHeight(44), BackgroundColor = CSS.CSS_Color.BackgroundColor, BorderColor = 0x00000000, BorderWidth = 0, Radius = (uint)Application.GetMinRealAverage(4), }; dialogView.AddChidren(editView); EditText etName = new EditText() { X = Application.GetRealWidth(12), Width = Application.GetRealWidth(182), Text = function.name, TextColor = CSS.CSS_Color.FirstLevelTitleColor, TextSize = CSS.CSS_FontSize.TextFontSize, }; editView.AddChidren(etName); Button btnLine = new Button() { Y = Application.GetRealHeight(128), Height = Application.GetRealHeight(1), BackgroundColor = CSS.CSS_Color.DividingLineColor, }; dialogView.AddChidren(btnLine); Button btnCancel = new Button() { Y = btnLine.Bottom, Width = Application.GetRealWidth(134), Height = Application.GetRealHeight(43), TextAlignment = TextAlignment.Center, TextColor = CSS.CSS_Color.TextualColor, TextSize = CSS_FontSize.SubheadingFontSize, SelectedTextColor = CSS_Color.MainBackgroundColor, SelectedBackgroundColor = CSS_Color.MainColor, TextID = StringId.Cancel, }; dialogView.AddChidren(btnCancel); Button btnBottomLine = new Button() { X = btnCancel.Right, Y = btnLine.Bottom, Height = Application.GetRealHeight(43), Width = Application.GetRealWidth(1), BackgroundColor = CSS_Color.DividingLineColor, }; dialogView.AddChidren(btnBottomLine); Button btnConfirm = new Button() { X = btnBottomLine.Right, Y = btnLine.Bottom, Width = Application.GetRealWidth(135), Height = Application.GetRealHeight(43), TextAlignment = TextAlignment.Center, TextColor = CSS.CSS_Color.TextualColor, TextSize = CSS_FontSize.SubheadingFontSize, SelectedTextColor = CSS_Color.MainBackgroundColor, SelectedBackgroundColor = CSS_Color.MainColor, TextID = StringId.Confirm, }; dialogView.AddChidren(btnConfirm); dialog.Show(); btnCancel.MouseDownEventHandler += (sender, e) => { btnCancel.IsSelected = true; }; btnCancel.MouseUpEventHandler += (sender, e) => { btnCancel.IsSelected = false; dialog.Close(); }; btnConfirm.MouseDownEventHandler += (sender, e) => { btnConfirm.IsSelected = true; }; btnConfirm.MouseUpEventHandler += (sender, e) => { btnConfirm.IsSelected = false; function.name = etName.Text.Trim(); DB_ResidenceData.residenceData.SaveResidenceData(); dialog.Close(); }; } } }