using System;
using Shared;
using HDL_ON.UI.CSS;
namespace HDL_ON.UI
{
///
/// 获取支持-常见问题页面
///
public class FAQHelpPage : FrameLayout
{
///
///
///
FrameLayout bodyView;
///
/// 搜索页面
///
FrameLayout searchView;
///
/// 菜单按钮
///
Button btnMenu;
///
/// 电话按钮
///
Button btnTelephone;
///
/// 发送信息按钮
///
Button btnSendMes;
///
/// 菜单按钮是否展开
///
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 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
}
///
/// 是否展开
///
///
void SetMenuButtonState(bool isOpen)
{
btnMenu.IsSelected = isOpen;
btnTelephone.Visible = isOpen;
btnSendMes.Visible = isOpen;
if (isOpen)
{
//展开
}
else
{
//关闭隐藏
}
}
///
/// 打开问题列表页面
///
/// 1:功能问题 2:场景问题 3:APP使用辅助
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;
}
///
/// 打开获取支持电话页面
///
void OpenGetSupportPage()
{
var mPage = new GetSupportPage();
MainPage.BasePageView.AddChidren(mPage);
mPage.LoadPage();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
}
}
}