using System;
using System.Collections.Generic;
namespace Shared.SimpleControl.Phone
{
///
/// BasePage
///
public class BasePage : FrameLayout
{
#region TopView
///
/// 顶部导航栏背景View
///
public FrameLayout TopView;
///
/// 返回按钮
///
public Button topBackBtn;
///
/// 标题
///
public Button topTitleBtn;
///
/// 右边菜单按钮
///
public Button topItemButton;
#endregion
///
///
///
public FrameLayout BaseContentView;
///
///
///
public BasePage()
{
BackgroundColor = SkinStyle.Current.MainColor;
}
///
/// 加载页面
///
public virtual void ShowPage()
{
#region ---TopView---
TopView = new FrameLayout()
{
Y = Application.GetRealHeight(36),
Height = Application.GetRealHeight(90),
BackgroundColor = SkinStyle.Current.MainColor,
};
AddChidren(TopView);
topBackBtn = new Button()
{
Height = Application.GetRealHeight(90),
Width = Application.GetRealWidth(85),
UnSelectedImagePath = "Item/Back.png",
SelectedImagePath = "Item/BackSelected.png",
};
TopView.AddChidren(topBackBtn);
topBackBtn.MouseUpEventHandler += (sender, e) => {
(Parent as PageLayout).PageIndex -= 1;
};
topTitleBtn = new Button()
{
Width = Application.GetMinRealAverage(400),
Height = Application.GetMinRealAverage(90),
TextColor = SkinStyle.Current.TextColor1,
Gravity = Gravity.CenterHorizontal,
TextAlignment = TextAlignment.Center,
TextSize = 20,
};
TopView.AddChidren(topTitleBtn);
topItemButton = new Button()
{
Width = Application.GetMinRealAverage(55),
Height = Application.GetMinRealAverage(55),
UnSelectedImagePath = "Item/+.png",
SelectedImagePath = "Item/+.png",
Gravity = Gravity.CenterVertical,
X = Application.GetRealWidth(640 - 80),
};
TopView.AddChidren(topItemButton);
#endregion
#region
BaseContentView = new FrameLayout()
{
Y = TopView.Bottom,
Width = LayoutParams.MatchParent,
Height = Application.GetRealHeight(Application.DesignHeight) - TopView.Bottom,
BackgroundColor = SkinStyle.Current.ViewColor,
};
AddChidren(BaseContentView);
#endregion
}
///
/// 关闭页面
///
public void BackAction()
{
(Parent as PageLayout).PageIndex -= 1;
}
}
}