From adc150efb13a0506f45a3c344c3ee2ef2dba8e90 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 01 七月 2021 15:19:13 +0800
Subject: [PATCH] 合并嘉乐lc代码

---
 HDL_ON/UI/BindingResidence/BindingResidencePage.cs |  129 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 119 insertions(+), 10 deletions(-)

diff --git a/HDL_ON/UI/BindingResidence/BindingResidencePage.cs b/HDL_ON/UI/BindingResidence/BindingResidencePage.cs
index 94abbbe..bf2f329 100644
--- a/HDL_ON/UI/BindingResidence/BindingResidencePage.cs
+++ b/HDL_ON/UI/BindingResidence/BindingResidencePage.cs
@@ -91,15 +91,10 @@
 
             btnAddNewResidence.MouseUpEventHandler = (sender, e) =>
             {
-                Action<string> action = (str) => {
-                    Application.RunOnMainThread(() => {
-                    var pm = new DAL.Server.HttpServerRequest();
-                        pm.BindingResidence(str);
-                    });
-                };
                 Scan.OpenScan((scanString) =>
                 {
-                    action(scanString);
+                    //鎵ц缁戝畾浣忓畢
+                    this.DoBindResidence(scanString);
                 });
             };
 
@@ -108,13 +103,127 @@
                 //鎴戠殑浜岀淮鐮�
                 var page = new MyQRCodePage();
                 AddChidren(page);
-                page.LoadPage();
-                //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                page.LoadPage(true);
             };
 
             btnLogout.MouseUpEventHandler = (sender, e) =>
             {
-                MainPage.GoLoginPage(UserInfo.Current);
+                HDLCommon.Current.Logout();
+            };
+        }
+
+        /// <summary>
+        /// 鎵ц缁戝畾浣忓畢
+        /// </summary>
+        public void DoBindResidence(string scanString)
+        {
+            var pm = new DAL.Server.HttpServerRequest();
+            var result = pm.BindingResidence(scanString);
+            if (result == null) { return; }
+
+            if (result.Code == DAL.Server.StateCode.SUCCESS)
+            {
+                //璋冪敤On鍘熸潵鐨勬柟娉�,鍒锋柊浣忓畢鍒楄〃鍙婂叾缂撳瓨
+                pm.GetHomePager(HomeTypeEnum.ALL,scanString);
+                //璺宠浆椤甸潰----
+                MainPage.GoUserPage(true, false, () =>
+                {
+                    //鏄剧ず娆㈣繋鍥炲鐨勫脊绐楃晫闈�
+                    var form = new WellcomToHomeForm();
+                    form.ShowForm();
+                });
+            }
+            //鍏朵粬鎯呭喌鍏ㄩ儴鎻愮ず澶辨晥
+            else
+            {
+                //鏄剧ず浜岀淮鐮佸凡缁忚繃鏈熺殑寮圭獥
+                this.ShowQrCodeTimeOutView();
+            }
+        }
+
+        /// <summary>
+        /// 鏄剧ず浜岀淮鐮佸凡缁忚繃鏈熺殑寮圭獥
+        /// </summary>
+        public void ShowQrCodeTimeOutView()
+        {
+            //鏁翠釜鐣岄潰鐨勭伆鑹茶儗鏅�
+            var frameBack = new Dialog();
+            frameBack.Show();
+
+            //涓棿鐧借壊鍖哄煙
+            var frameWite = new FrameLayout();
+            frameWite.Y = Application.GetRealHeight(223);
+            frameWite.Height = Application.GetRealHeight(245);
+            frameWite.Width = Application.GetRealWidth(288);
+            frameWite.BackgroundColor = CSS.CSS_Color.MainBackgroundColor;
+            frameWite.Radius = (uint)Application.GetRealWidth(12);
+            frameWite.Gravity = Gravity.CenterHorizontal;
+            frameBack.AddChidren(frameWite);
+
+            //Icon鍥炬爣
+            var picIcon = new Button();
+            picIcon.Y = Application.GetRealHeight(152);
+            picIcon.Height = Application.GetRealWidth(160);
+            picIcon.Width = Application.GetRealWidth(160);
+            picIcon.Gravity = Gravity.CenterHorizontal;
+            picIcon.UnSelectedImagePath = "ErrorIcon.png";
+            frameBack.AddChidren(picIcon);
+
+            //浜岀淮鐮佸け鏁堬紝璇烽噸璇�
+            var btnText = new Button();
+            btnText.Y = Application.GetRealHeight(98);
+            btnText.Height = Application.GetRealHeight(24);
+            btnText.TextSize = 16;
+            btnText.TextAlignment = TextAlignment.Center;
+            btnText.TextColor = CSS.CSS_Color.FirstLevelTitleColor;
+            btnText.TextID = StringId.QRCodeIsInvalid;
+            frameWite.AddChidren(btnText);
+
+            //鍙栨秷
+            var btnCancel = new Button();
+            btnCancel.X = Application.GetRealWidth(30);
+            btnCancel.Y = btnText.Bottom + Application.GetRealHeight(48);
+            btnCancel.Height = Application.GetRealHeight(44);
+            btnCancel.Width = Application.GetRealWidth(108);
+            btnCancel.TextSize = 16;
+            btnCancel.IsBold = true;
+            btnCancel.TextAlignment = TextAlignment.Center;
+            btnCancel.TextColor = CSS.CSS_Color.MainColor;
+            btnCancel.BackgroundColor = CSS.CSS_Color.MainBackgroundColor;
+            btnCancel.Radius = (uint)Application.GetRealHeight(22);
+            btnCancel.TextID = StringId.Cancel;
+            btnCancel.BorderWidth = 1;
+            btnCancel.BorderColor = CSS.CSS_Color.MainColor;
+            frameWite.AddChidren(btnCancel);
+
+            btnCancel.MouseUpEventHandler += (sender, e) =>
+            {
+                frameBack.Close();
+            };
+
+            //閲嶈瘯
+            var btnRedo = new Button();
+            btnRedo.Y = btnText.Bottom + Application.GetRealHeight(48);
+            btnRedo.Height = Application.GetRealHeight(44);
+            btnRedo.Width = Application.GetRealWidth(108);
+            btnRedo.TextSize = 16;
+            btnRedo.IsBold = true;
+            btnRedo.TextAlignment = TextAlignment.Center;
+            btnRedo.TextColor = CSS.CSS_Color.MainBackgroundColor;
+            btnRedo.BackgroundColor = CSS.CSS_Color.MainColor;
+            btnRedo.Radius = (uint)Application.GetRealHeight(22);
+            btnRedo.TextID = StringId.Retry;
+            frameWite.AddChidren(btnRedo);
+            btnRedo.X = frameWite.Width - btnRedo.Width - Application.GetRealWidth(30);
+
+            btnRedo.MouseUpEventHandler += (sender, e) =>
+            {
+                Scan.OpenScan((scanString) =>
+                {
+                    frameBack.Close();
+                    //鎵ц缁戝畾浣忓畢
+                    this.DoBindResidence(scanString);
+                });
             };
         }
     }

--
Gitblit v1.8.0