xm
2021-12-01 6d73bf6e816570291865674bef8bce8972e4de3f
HDL_ON/UI/UI2/4-PersonalCenter/GetSupport/FAQHelpPage.cs
New file
@@ -0,0 +1,287 @@
using System;
using Shared;
using HDL_ON.UI.CSS;
namespace HDL_ON.UI
{
    /// <summary>
    /// 获取支持-常见问题页面
    /// </summary>
    public class FAQHelpPage : FrameLayout
    {
        /// <summary>
        ///
        /// </summary>
        FrameLayout bodyView;
        /// <summary>
        /// 搜索页面
        /// </summary>
        FrameLayout searchView;
        /// <summary>
        /// 菜单按钮
        /// </summary>
        Button btnMenu;
        /// <summary>
        /// 电话按钮
        /// </summary>
        Button btnTelephone;
        /// <summary>
        /// 发送信息按钮
        /// </summary>
        Button btnSendMes;
        /// <summary>
        /// 菜单按钮是否展开
        /// </summary>
        bool isbtnMenuOpen;
        public FAQHelpPage()
        {
            bodyView = this;
        }
        public void LoadPage()
        {
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            new TopViewDiv(bodyView, Language.StringByID(StringId.GetSupport)).LoadTopView();
            //搜索按钮
            searchView = new FrameLayout()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealHeight(76),
                Height = Application.GetRealHeight(28),
                Width = Application.GetRealWidth(343),
                Radius = (uint)Application.GetRealHeight(6),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            bodyView.AddChidren(searchView);
            ImageView searchImage = new ImageView()
            {
                Width = Application.GetRealWidth(20),
                Height = Application.GetRealWidth(20),
                Gravity = Gravity.Center,
                ImagePath = "PersonalCenter/Support/Search.png"
            };
            searchView.AddChidren(searchImage);
            #region Help
            var helpView = new FrameLayout()
            {
                Y = Application.GetRealHeight(112),
                Height = Application.GetRealHeight(208),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            bodyView.AddChidren(helpView);
            var helpTip = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealHeight(10),
                Height = Application.GetRealHeight(28),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                Width = Application.GetRealWidth(200),
                TextID = StringId.WhatCanWeDoForYou
            };
            helpView.AddChidren(helpTip);
            #region 功能问题
            var functionView = new ListIconCellView()
            {
                Y = Application.GetRealHeight(58),
            };
            helpView.AddChidren(functionView);
            functionView.BtnTilte.TextID = StringId.FunctionalQuestion;
            functionView.BtnIcon.UnSelectedImagePath = "PersonalCenter/Support/Function.png";
            Action functionAction = () =>
            {
                OpenQuestionListPage(1);
            };
            functionView.GoAction = functionAction;
            #endregion
            #region 场景问题
            var sceneView = new ListIconCellView()
            {
                Y = functionView.Bottom,
            };
            helpView.AddChidren(sceneView);
            sceneView.BtnTilte.TextID = StringId.SceneQuestion;
            sceneView.BtnIcon.UnSelectedImagePath = "PersonalCenter/Support/Scene.png";
            Action sceneAction = () =>
            {
                OpenQuestionListPage(2);
            };
            sceneView.GoAction = functionAction;
            #endregion
            #region APP使用问题
            var appUseView = new ListIconCellView()
            {
                Y = sceneView.Bottom,
            };
            helpView.AddChidren(appUseView);
            appUseView.BtnTilte.TextID = StringId.AppUsageAssistance;
            appUseView.BtnIcon.UnSelectedImagePath = "PersonalCenter/Support/Help.png";
            appUseView.LineView.RemoveFromParent();
            Action appUseAction = () =>
            {
                OpenQuestionListPage(3);
            };
            appUseView.GoAction = appUseAction;
            #endregion
            #endregion
            #region question View
            int qY = Application.GetRealHeight(328);
            var questionView = new FrameLayout()
            {
                Y = qY,
                Height = bodyView.Height - qY,
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            bodyView.AddChidren(questionView);
            var questionTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealHeight(10),
                Height = Application.GetRealHeight(28),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                Width = Application.GetRealWidth(300),
                Text = Language.StringByID(StringId.CommonQuestion) + ":"
            };
            questionView.AddChidren(questionTitle);
            #endregion
            #region 功能按钮
            btnMenu = new Button()
            {
                Y = Application.GetRealHeight(542),
                X = Application.GetRealWidth(302),
                Width = Application.GetRealWidth(58),
                Height = Application.GetRealWidth(58),
                UnSelectedImagePath = "PersonalCenter/Support/Menu.png",
                SelectedImagePath = "PersonalCenter/Support/Close.png",
            };
            bodyView.AddChidren(btnMenu);
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
                isbtnMenuOpen = !isbtnMenuOpen;
                SetMenuButtonState(isbtnMenuOpen);
            };
            btnMenu.MouseUpEventHandler = eventHandler;
            btnTelephone = new Button()
            {
                Y = Application.GetRealHeight(494),
                X = Application.GetRealWidth(274),
                Width = Application.GetRealWidth(58),
                Height = Application.GetRealWidth(58),
                UnSelectedImagePath = "PersonalCenter/Support/Telephone.png",
                Visible = false,
            };
            bodyView.AddChidren(btnTelephone);
            btnTelephone.MouseUpEventHandler = (sender, e) =>
            {
                OpenGetSupportPage();
            };
            btnSendMes = new Button()
            {
                Y = Application.GetRealHeight(590),
                X = Application.GetRealWidth(274),
                Width = Application.GetRealWidth(58),
                Height = Application.GetRealWidth(58),
                UnSelectedImagePath = "PersonalCenter/Support/SendMessage.png",
                Visible = false,
            };
            bodyView.AddChidren(btnSendMes);
            btnSendMes.MouseUpEventHandler = (sender, e) =>
            {
                OpenGetSupportPage();
            };
            #endregion
        }
        /// <summary>
        /// 是否展开
        /// </summary>
        /// <param name="isOpen"></param>
        void SetMenuButtonState(bool isOpen)
        {
            btnMenu.IsSelected = isOpen;
            btnTelephone.Visible = isOpen;
            btnSendMes.Visible = isOpen;
            if (isOpen)
            {
                //展开
            }
            else
            {
                //关闭隐藏
            }
        }
        /// <summary>
        /// 打开问题列表页面
        /// </summary>
        /// <param name="questionType">1:功能问题 2:场景问题 3:APP使用辅助</param>
        void OpenQuestionListPage(int questionType)
        {
            int titleId = 0;
            if (questionType == 1)
            {
                titleId = StringId.FunctionalQuestion;
            }
            else if (questionType == 2)
            {
                titleId = StringId.SceneQuestion;
            }
            else if (questionType == 3)
            {
                titleId = StringId.AppUsageAssistance;
            }
            var mPage = new QuestionListPage();
            MainPage.BasePageView.AddChidren(mPage);
            mPage.LoadPage(titleId);
            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
        }
        /// <summary>
        /// 打开获取支持电话页面
        /// </summary>
        void OpenGetSupportPage()
        {
            var mPage = new GetSupportPage();
            MainPage.BasePageView.AddChidren(mPage);
            mPage.LoadPage();
            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
        }
    }
}