wei
2021-08-27 eda3fb873e59544ff36301b51e05aef64f87b0f9
HDL_ON/UI/UI2/4-PersonalCenter/AboutOn/ComplaintsPage.cs
New file
@@ -0,0 +1,183 @@
using System;
using Shared;
using HDL_ON.UI.CSS;
using Xamarin.Essentials;
namespace HDL_ON.UI
{
    /// <summary>
    /// 投诉页面
    /// </summary>
    public class ComplaintsPage : FrameLayout
    {
        /// <summary>
        ///
        /// </summary>
        FrameLayout bodyView;
        /// <summary>
        ///
        /// </summary>
        public ComplaintsPage()
        {
            bodyView = this;
            BackgroundColor = CSS_Color.MainBackgroundColor;
        }
        /// <summary>
        ///
        /// </summary>
        public void LoadPage()
        {
            new TopViewDiv(bodyView, Language.StringByID(StringId.Complaints)).LoadTopView();
            #region 投诉联系
            FrameLayout phoneRow = new FrameLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealWidth(50),
            };
            bodyView.AddChidren(phoneRow);
            Button btnPhoneTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(48),
                TextID = StringId.Telephone,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            phoneRow.AddChidren(btnPhoneTitle);
            if(Language.CurrentLanguage == "English")
            {
                btnPhoneTitle.Text = "Tel.:";
            }
            Button btnPhoneText = new Button()
            {
                X = btnPhoneTitle.Right,
                Width = Application.GetRealWidth(266),
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.TextFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Text = "400 855 8535",
            };
            phoneRow.AddChidren(btnPhoneText);
            /// <summary>
            /// 前进图标
            /// </summary>
            var btnImage = new Button()
            {
                X = Application.GetRealWidth(343),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetRealWidth(16),
                Height = Application.GetRealWidth(16),
                UnSelectedImagePath = "Public/Right.png",
            };
            phoneRow.AddChidren(btnImage);
            phoneRow.AddChidren(new Button() { X = Application.GetRealWidth(16), Y = Application.GetRealWidth(49), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
                PhoneDialer.Open(Constant.SUPPORT_TELEPHONENUMBER);
            };
            phoneRow.MouseUpEventHandler = eventHandler;
            btnPhoneText.MouseUpEventHandler = eventHandler;
            btnImage.MouseUpEventHandler = eventHandler;
            #endregion
            #region 联系邮箱
            FrameLayout emailRow = new FrameLayout()
            {
                Y = phoneRow.Bottom,
                Height = Application.GetRealWidth(54),
            };
            bodyView.AddChidren(emailRow);
            Button btnEmailTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(48),
                TextID = StringId.Email_,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            emailRow.AddChidren(btnEmailTitle);
            Button btnEmailText = new Button()
            {
                X = btnEmailTitle.Right,
                Y = Application.GetRealWidth(8),
                Height = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(266),
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.TextFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Text = Constant.SUPPORT_EMAIL,
            };
            emailRow.AddChidren(btnEmailText);
            Button btnEmailTipText = new Button()
            {
                X = btnEmailTitle.Right,
                Y = btnEmailText.Bottom + Application.GetRealWidth(4),
                Height = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(266),
                TextAlignment = TextAlignment.TopLeft,
                TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
                TextColor = CSS_Color.PromptingColor1,
                TextID = StringId.WillGivePriorityToTheTreatmen,
            };
            emailRow.AddChidren(btnEmailTipText);
            if (Language.CurrentLanguage == "English")
            {
                btnEmailTitle.Width = Application.GetRealWidth(80);
                emailRow.Height = Application.GetRealWidth(65);
                btnEmailTipText.IsMoreLines = true;
            }
            /// <summary>
            /// 前进图标
            /// </summary>
            var btnImage2 = new Button()
            {
                X = Application.GetRealWidth(343),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetRealWidth(16),
                Height = Application.GetRealWidth(16),
                UnSelectedImagePath = "Public/Right.png",
            };
            emailRow.AddChidren(btnImage2);
            emailRow.AddChidren(new Button() { X = Application.GetRealWidth(16), Y = emailRow.Height - Application.GetRealHeight(1), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
            EventHandler<MouseEventArgs> eventHandler2 = (sender, e) =>
            {
                CopyToClipboard(Constant.SUPPORT_EMAIL);
            };
            emailRow.MouseUpEventHandler = eventHandler2;
            btnEmailText.MouseUpEventHandler = eventHandler2;
            btnImage2.MouseUpEventHandler = eventHandler2;
            #endregion
        }
        /// <summary>
        /// 复制到剪切板
        /// </summary>
        /// <param name="text"></param>
        void CopyToClipboard(string text)
        {
            Clipboard.SetTextAsync(text);
            Utlis.ShowTip(text + "\n" + Language.StringByID(StringId.CopySuccess));
        }
    }
}