wxr
2020-12-18 f2d122dc78c58925a05d770d716e7fefcbd784ef
HDL_ON/UI/BindingResidence/BindingResidencePage.cs
old mode 100644 new mode 100755
@@ -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);
                });
            };
        }
    }
}