From f2d122dc78c58925a05d770d716e7fefcbd784ef Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 18 十二月 2020 11:09:48 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into NewFilePath

---
 HDL_ON/UI/BindingResidence/BindingResidencePage.cs |  124 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 117 insertions(+), 7 deletions(-)

diff --git a/HDL_ON/UI/BindingResidence/BindingResidencePage.cs b/HDL_ON/UI/BindingResidence/BindingResidencePage.cs
old mode 100644
new mode 100755
index 94abbbe..92e3bfe
--- 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);
                 });
             };
 
@@ -117,5 +112,120 @@
                 MainPage.GoLoginPage(UserInfo.Current);
             };
         }
+
+        /// <summary>
+        /// 鎵ц缁戝畾浣忓畢
+        /// </summary>
+        private 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();
+                //璺宠浆椤甸潰----
+                MainPage.GoUserPage(false, () =>
+                {
+                    //鏄剧ず娆㈣繋鍥炲鐨勫脊绐楃晫闈�
+                    var form = new WellcomToHomeForm();
+                    form.ShowForm();
+                });
+            }
+            //鍏朵粬鎯呭喌鍏ㄩ儴鎻愮ず澶辨晥
+            else
+            {
+                //鏄剧ず浜岀淮鐮佸凡缁忚繃鏈熺殑寮圭獥
+                this.ShowQrCodeTimeOutView();
+            }
+        }
+
+        /// <summary>
+        /// 鏄剧ず浜岀淮鐮佸凡缁忚繃鏈熺殑寮圭獥
+        /// </summary>
+        private 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