From 002a3f2e9d2f9579c01f88af12bd8a320003569f Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 31 三月 2020 08:57:19 +0800
Subject: [PATCH] 20200331

---
 HDL_ON/UI/UI0-Public/PublicAssmebly.cs |  577 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 570 insertions(+), 7 deletions(-)

diff --git a/HDL_ON/UI/UI0-Public/PublicAssmebly.cs b/HDL_ON/UI/UI0-Public/PublicAssmebly.cs
index 753b43b..03b1c68 100644
--- a/HDL_ON/UI/UI0-Public/PublicAssmebly.cs
+++ b/HDL_ON/UI/UI0-Public/PublicAssmebly.cs
@@ -1,11 +1,18 @@
 锘縰sing System;
+using HDL_ON.Entity;
 using HDL_ON.UI.CSS;
 using Shared;
 
 namespace HDL_ON.UI
 {
-    public class PublicAssmebly
+    public partial class PublicAssmebly
     {
+        /*
+        /// <summary>
+        /// 鍚慺ramelayout娣诲姞椤堕儴鍖哄煙
+        /// </summary>
+        /// <param name="frame"></param>
+        /// <param name="tilte"></param>
         public void LoadTopView(FrameLayout frame, string tilte)
         {
             FrameLayout view = new FrameLayout()
@@ -18,9 +25,9 @@
             Button btnBack = new Button()
             {
                 X = Application.GetRealWidth(10),
-                Y = Application.GetRealHeight(30),
-                Width = Application.GetRealWidth(24),
-                Height = Application.GetRealHeight(24),
+                Y = Application.GetRealHeight(29),
+                Width = Application.GetRealWidth(40),
+                Height = Application.GetRealHeight(28),
                 UnSelectedImagePath = "Public/BackIcon.png",
             };
             frame.AddChidren(btnBack);
@@ -31,10 +38,10 @@
 
             Button btnTilte = new Button()
             {
-                X = Application.GetRealWidth(10),
+                Gravity = Gravity.CenterHorizontal,
                 Y = Application.GetRealHeight(30),
                 Width = Application.GetRealWidth(150),
-                Height = Application.GetRealHeight(34),
+                Height = Application.GetRealHeight(25),
                 TextAlignment = TextAlignment.Center,
                 TextSize = CSS_FontSize.HeadlineFontSize,
                 TextColor = CSS_Color.FirstLevelTitleColor,
@@ -43,6 +50,57 @@
             frame.AddChidren(btnTilte);
         }
 
+        /// <summary>
+        /// 鍚慺ramelayout娣诲姞椤堕儴鍖哄煙
+        /// </summary>
+        /// <param name="frame"></param>
+        /// <param name="tilte"></param>
+        public void LoadTopView(FrameLayout frame, string tilte ,Action action)
+        {
+            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) =>
+            {
+                action();
+                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);
+        }
+
+
+
+        /// <summary>
+        /// 鍚慸ialog娣诲姞椤堕儴鍖哄煙
+        /// </summary>
+        /// <param name="dialog"></param>
+        /// <param name="frame"></param>
+        /// <param name="tilte"></param>
         public void LoadTopView(Dialog dialog, FrameLayout frame, string tilte)
         {
             FrameLayout view = new FrameLayout()
@@ -57,7 +115,7 @@
                 X = Application.GetRealWidth(10),
                 Y = Application.GetRealHeight(29),
                 Width = Application.GetRealWidth(40),
-                Height = Application.GetRealHeight(25),//24
+                Height = Application.GetRealHeight(28),
                 UnSelectedImagePath = "Public/BackIcon.png",
             };
             frame.AddChidren(btnBack);
@@ -80,6 +138,511 @@
             frame.AddChidren(btnTilte);
         }
 
+        /// <summary>
+        /// 鍚慺ramelayout娣诲姞椤堕儴鍖哄煙,鎷ユ湁鍔熻兘閰嶇疆鎸夐挳
+        /// </summary>
+        /// <param name="frame"></param>
+        /// <param name="tilte"></param>
+        public void LoadTopView(FrameLayout frame, string tilte,Function function)
+        {
+            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 btnSetting = new Button()
+            {
+                X = Application.GetRealWidth(337),
+                Y = Application.GetRealHeight(29),
+                Width = Application.GetMinRealAverage(28),
+                Height = Application.GetMinRealAverage(28),
+                UnSelectedImagePath = "Public/FuncInfoSetIcon.png",
+            };
+            frame.AddChidren(btnSetting);
+
+            btnSetting.MouseUpEventHandler += (sender, e) => {
+                var infoView = new FunctionBaseInfoSetPage(function);
+                MainPage.BasePageView.AddChidren(infoView);
+                infoView.LoadPage();
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+            };
+        }
+
+
+        /// <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 = CSS_Color.DialogTransparentColor1,
+            };
+
+            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 || titleId == StringId.ChangeName)
+                {
+                    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 = CSS_Color.DialogTransparentColor1,
+            };
+
+            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();
+            };
+
+        }
+
+
+        /// <summary>
+        /// 鍔犺浇鎻愮ず寮圭獥
+        /// </summary>
+        /// <param name="titleId"></param>
+        /// <param name="msgId"></param>
+        public void TipMsg(int titleId, int msgId)
+        {
+            Dialog dialog = new Dialog()
+            {
+                BackgroundColor = CSS_Color.DialogTransparentColor1,
+            };
+
+            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 btnConfirm = new Button()
+            {
+                Y = btnLine.Bottom,
+                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();
+
+            btnConfirm.MouseDownEventHandler += (sender, e) =>
+            {
+                btnConfirm.IsSelected = true;
+            };
+            btnConfirm.MouseUpEventHandler += (sender, e) =>
+            {
+                btnConfirm.IsSelected = false;
+                dialog.Close();
+            };
+
+        }
+
 
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0