From 0bdc0a135dbe31761b53f432ed34f347f0a4e36b Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 05 三月 2020 10:49:41 +0800 Subject: [PATCH] 20200304 --- HDL_ON/UI/UI0-Public/PublicAssmebly.cs | 363 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 363 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI0-Public/PublicAssmebly.cs b/HDL_ON/UI/UI0-Public/PublicAssmebly.cs index 629dd05..b05407d 100644 --- a/HDL_ON/UI/UI0-Public/PublicAssmebly.cs +++ b/HDL_ON/UI/UI0-Public/PublicAssmebly.cs @@ -151,5 +151,368 @@ }; } + + /// <summary> + /// 鍚慺ramelayout娣诲姞椤堕儴鍖哄煙,鎷ユ湁鍔熻兘閰嶇疆鎸夐挳 + /// </summary> + /// <param name="frame"></param> + /// <param name="tilte"></param> + public void LoadTopView(FrameLayout frame, string tilte, string type,Action<string,string> callBack) + { + FrameLayout view = new FrameLayout() + { + Height = Application.GetRealHeight(64), + BackgroundColor = CSS_Color.TopViewColor, + }; + frame.AddChidren(view); + + Button btnBack = new Button() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(29), + Width = Application.GetRealWidth(40), + Height = Application.GetRealHeight(28), + UnSelectedImagePath = "Public/BackIcon.png", + }; + frame.AddChidren(btnBack); + btnBack.MouseUpEventHandler += (sender, e) => + { + frame.RemoveFromParent(); + }; + + Button btnTilte = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(30), + Width = Application.GetRealWidth(150), + Height = Application.GetRealHeight(25), + TextAlignment = TextAlignment.Center, + TextSize = CSS_FontSize.HeadlineFontSize, + TextColor = CSS_Color.FirstLevelTitleColor, + Text = tilte + }; + frame.AddChidren(btnTilte); + + var btnAddIcon = new Button() + { + X = Application.GetRealWidth(337), + Y = Application.GetRealHeight(29), + Width = Application.GetMinRealAverage(28), + Height = Application.GetMinRealAverage(28), + UnSelectedImagePath = "Public/AddIcon.png", + }; + frame.AddChidren(btnAddIcon); + + btnAddIcon.MouseUpEventHandler += (sender, e) => { + switch (type) + { + case "floors": + Action<string> callBackAction = (floorName) => + { + if (DB_ResidenceData.residenceData.floors.Contains(floorName)) + { + return; + } + else + { + DB_ResidenceData.residenceData.floors.Add(floorName); + DB_ResidenceData.residenceData.SaveResidenceData(); + callBack("add", floorName); + } + }; + LoadDialog_EditParater(StringId.AddFloors, DB_ResidenceData.residenceData.floors.Count + 1 + " F", callBackAction); + break; + case "rooms": + callBack("", ""); + break; + } + + }; + } + + + /// <summary> + /// 鍔犺浇淇敼鍙傛暟鐨勫皬寮圭獥 + /// </summary> + /// <param name="callBackAction">鍥炶皟鍑芥暟</param> + public void LoadDialog_EditParater(int titleId, string editParater, Action<string> callBackAction) + { + Dialog dialog = new Dialog() + { + BackgroundColor = 0x99000000, + }; + + FrameLayout contentView = 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(contentView); + + 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 = titleId, + }; + contentView.AddChidren(btnTitle); + + FrameLayout editView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Y = btnTitle.Bottom + Application.GetRealHeight(6), + Width = Application.GetRealWidth(222), + Height = Application.GetRealHeight(40), + BackgroundColor = CSS.CSS_Color.BackgroundColor, + BorderColor = 0x00000000, + BorderWidth = 0, + Radius = (uint)Application.GetMinRealAverage(4), + }; + contentView.AddChidren(editView); + + EditText etParater = new EditText() + { + X = Application.GetRealWidth(12), + Width = Application.GetRealWidth(182), + Text = editParater, + TextColor = CSS.CSS_Color.FirstLevelTitleColor, + TextSize = CSS.CSS_FontSize.TextFontSize, + }; + editView.AddChidren(etParater); + + Button btnLine = new Button() + { + Y = Application.GetRealHeight(128), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS.CSS_Color.DividingLineColor, + }; + contentView.AddChidren(btnLine); + + Button btnCancel = new Button() + { + Y = btnLine.Bottom, + Width = Application.GetRealWidth(134), + Height = Application.GetRealHeight(43), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.SubheadingFontSize, + SelectedTextColor = CSS_Color.MainBackgroundColor, + SelectedBackgroundColor = CSS_Color.MainColor, + TextID = StringId.Cancel, + }; + contentView.AddChidren(btnCancel); + + Button btnBottomLine = new Button() + { + X = btnCancel.Right, + Y = btnLine.Bottom, + Height = Application.GetRealHeight(43), + Width = Application.GetRealWidth(1), + BackgroundColor = CSS_Color.DividingLineColor, + }; + contentView.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, + }; + contentView.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; + if ((titleId == StringId.EditFloorName && etParater.Text.Trim() != editParater) || titleId == StringId.AddFloors) + { + if (DB_ResidenceData.residenceData.floors.Contains(etParater.Text.Trim())) + { + contentView.Height = Application.GetRealHeight(183); + btnLine.Y = Application.GetRealHeight(139); + btnBottomLine.Y = btnLine.Bottom; + btnCancel.Y = btnLine.Bottom; + btnConfirm.Y = btnLine.Bottom; + + + var btnTip = new Button() + { + X = editView.X, + Y = editView.Bottom, + Width = Application.GetRealWidth(182), + Height = Application.GetRealHeight(30), + TextID = StringId.AddFloorFailed_FloorAlreadyExist, + TextColor = CSS_Color.WarningColor, + TextSize = CSS_FontSize.TextFontSize, + }; + contentView.AddChidren(btnTip); + return; + } + + callBackAction(etParater.Text.Trim()); + } + + if(titleId == StringId.RoomName) + { + if(editParater != etParater.Text.Trim()) + { + callBackAction(etParater.Text.Trim()); + } + } + dialog.Close(); + }; + + } + + /// <summary> + /// 鍔犺浇鎻愮ず寮圭獥 + /// </summary> + /// <param name="titleId"></param> + /// <param name="msgId"></param> + /// <param name="callBackAction"></param> + public void TipMsg(int titleId, int msgId, Action callBackAction) + { + Dialog dialog = new Dialog() + { + BackgroundColor = 0x99000000, + }; + + FrameLayout contentView = new FrameLayout() + { + Gravity = Gravity.Center, + Width = Application.GetRealWidth(270), + Height = Application.GetRealHeight(140), + BackgroundColor = CSS.CSS_Color.MainBackgroundColor, + BorderColor = 0x00000000, + BorderWidth = 0, + Radius = (uint)Application.GetMinRealAverage(10), + }; + dialog.AddChidren(contentView); + + Button btnTitle = new Button() + { + Y = Application.GetRealHeight(16), + Height = Application.GetRealHeight(30), + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.Center, + IsBold = true, + TextID = titleId, + }; + contentView.AddChidren(btnTitle); + + Button btnMsg = new Button() + { + Gravity = Gravity.CenterHorizontal, + Height = Application.GetRealHeight(25), + Y = btnTitle.Bottom, + Width = Application.GetRealHeight(200), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextID = msgId, + }; + contentView.AddChidren(btnMsg); + + Button btnLine = new Button() + { + Y = Application.GetRealHeight(96), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS.CSS_Color.DividingLineColor, + }; + contentView.AddChidren(btnLine); + + Button btnCancel = new Button() + { + Y = btnLine.Bottom, + Width = Application.GetRealWidth(134), + Height = Application.GetRealHeight(43), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.SubheadingFontSize, + SelectedTextColor = CSS_Color.MainBackgroundColor, + SelectedBackgroundColor = CSS_Color.MainColor, + TextID = StringId.Cancel, + }; + contentView.AddChidren(btnCancel); + + Button btnBottomLine = new Button() + { + X = btnCancel.Right, + Y = btnLine.Bottom, + Height = Application.GetRealHeight(43), + Width = Application.GetRealWidth(1), + BackgroundColor = CSS_Color.DividingLineColor, + }; + contentView.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_Color.TextualColor, + TextSize = CSS_FontSize.SubheadingFontSize, + SelectedTextColor = CSS_Color.MainBackgroundColor, + SelectedBackgroundColor = CSS_Color.MainColor, + TextID = StringId.Confirm, + }; + contentView.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; + callBackAction(); + dialog.Close(); + }; + + } + + + } } \ No newline at end of file -- Gitblit v1.8.0