wxr
2020-11-20 716d1b3b705e7d37e6edebd7f60b7613ab5aee87
HDL_ON/UI/UI1-Login/LoginPage.cs
@@ -240,8 +240,10 @@
            };
            //跳转国家区号选择界面
            EventHandler<MouseEventArgs> eHandler = (sender, e) => {
                JLCountrycode.CountryCodeView.Current.Show((countryName, code) => {
            EventHandler<MouseEventArgs> eHandler = (sender, e) =>
            {
                JLCountrycode.CountryCodeView.Current.Show((countryName, code) =>
                {
                    if (!string.IsNullOrEmpty(code))
                    {
                        phoneZoneCode = code;
@@ -460,7 +462,7 @@
            LoadEventList();
            account = etAccount.Text.Trim();
            #if DEBUG1211
#if DEBUG1211
            //本地模式
            Button btnLocalMode = new Button()
            {
@@ -476,14 +478,159 @@
            btnLocalMode.MouseUpEventHandler = (sender, e) =>
            {
                MainPage.LocalMode = true;
                MainPage.LoginUser = new UserInfo();
                 UserInfo.Current = new UserInfo();
                MainPage.GoUserPage();
            };
            MainPage.Log("etAccount.TextAlignment : " + etAccount.TextAlignment.ToString());
            #endif
#endif
            #region 隐私政策
            AddServiceAgreementControl(bodyView);
            #endregion
        }
        #region ■ 服务协议___________________________
        bool isAgreePrivacyPolicy = false;
        /// <summary>
        /// 添加服务协议控件
        /// </summary>
        /// <param name="frameBack"></param>
        private void AddServiceAgreementControl(FrameLayout frameLayout)
        {
            isAgreePrivacyPolicy = UserInfo.Current.isAgreePrivacyPolicy;
            var frameRow = new FrameLayout()
            {
                Height = Application.GetRealHeight(28),
                Y = Application.GetRealHeight(628),
            };
            frameLayout.AddChidren(frameRow);
            //同意按钮背景
            var agreeView = new FrameLayout()
            {
                Height = Application.GetRealHeight(28),
                Width = Application.GetRealWidth(28),
                X = Application.GetRealWidth(82),
            };
            frameRow.AddChidren(agreeView);
            //同意图标按钮
            var agreeBtn = new Button()
            {
                Width = Application.GetMinRealAverage(28),
                Height = Application.GetMinRealAverage(28),
                UnSelectedImagePath = "Public/ChooseIcon.png",
                SelectedImagePath = "Public/ChooseOnIcon.png",
                IsSelected = isAgreePrivacyPolicy,
                Gravity = Gravity.Center
            };
            agreeView.AddChidren(agreeBtn);
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
                isAgreePrivacyPolicy = !isAgreePrivacyPolicy;
                agreeBtn.IsSelected = isAgreePrivacyPolicy;
                UserInfo.Current.isAgreePrivacyPolicy = isAgreePrivacyPolicy;
                UserInfo.Current.SaveUserInfo();
            };
            agreeBtn.MouseUpEventHandler = eventHandler;
            agreeView.MouseUpEventHandler = eventHandler;
            //int btnWidth = 0;
            //同意文本
            var agreeTextBtn = new TextButton()
            {
                X = agreeView.Right,
                Width = Application.GetRealWidth(28),
                Height = Application.GetRealHeight(28),
                TextColor = CSS_Color.TextualColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextID = StringId.Agree
            };
            frameRow.AddChidren(agreeTextBtn);
            agreeTextBtn.Width = Utlis.GetRealWidthByTextButton(agreeTextBtn);
            //用户协议按钮
            var userAgreementBtn = new TextButton()
            {
                X = agreeTextBtn.Right,
                Width = Application.GetRealWidth(28),
                Height = Application.GetRealHeight(28),
                TextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                Text = "《" + Language.StringByID(StringId.UserAgreement) + "》"
            };
            frameRow.AddChidren(userAgreementBtn);
            userAgreementBtn.Width = Utlis.GetRealWidthByTextButton(userAgreementBtn);
            //和文本
            var andTextBtn = new TextButton()
            {
                X = userAgreementBtn.Right,
                Width = Application.GetRealWidth(28),
                Height = Application.GetRealHeight(28),
                TextColor = CSS_Color.TextualColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextID = StringId.And
            };
            frameRow.AddChidren(andTextBtn);
            andTextBtn.Width = Utlis.GetRealWidthByTextButton(andTextBtn);
            //隐私政策按钮
            var privacyPolicyBtn = new TextButton()
            {
                X = andTextBtn.Right,
                Width = Application.GetRealWidth(28),
                Height = Application.GetRealHeight(28),
                TextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                Text = "《" + Language.StringByID(StringId.PrivacyPolicy) + "》"
            };
            frameRow.AddChidren(privacyPolicyBtn);
            privacyPolicyBtn.Width = Utlis.GetRealWidthByTextButton(privacyPolicyBtn);
            //打开用户协议
            userAgreementBtn.MouseUpEventHandler = (sender, e) =>
            {
                OpenWebViewPage(false);
            };
            //打开隐私政策
            privacyPolicyBtn.MouseUpEventHandler = (sender, e) =>
            {
                OpenWebViewPage(true);
            };
        }
        /// <summary>
        /// OpenWebViewPage
        /// </summary>
        /// <param name="isOpenPrivacyPolicy">是否隐私政策</param>
        private void OpenWebViewPage(bool isOpenPrivacyPolicy)
        {
            string url = isAgreePrivacyPolicy ? Constant.URL_PrivacyPolicy : Constant.URL_UserAgreement;
            string titleStr = isAgreePrivacyPolicy ? Language.StringByID(StringId.PrivacyPolicy) : Language.StringByID(StringId.UserAgreement);
            new WebViewDialog().LoadPage(titleStr, url);
        }
        /// <summary>
        /// 检测隐私协议
        /// </summary>
        /// <returns></returns>
        private bool CheckPrivacyPolicy()
        {
            if (isAgreePrivacyPolicy == false)
            {
                //请同意《用户协议》和《隐私政策》
                Utlis.ShowTip(Language.StringByID(StringId.PleaseReadAndAgreePrivacyPolicyMsg));
                return false;
            }
            return true;
        }
        #endregion
    }
}