using System;
|
using HDL_ON.Entity;
|
using HDL_ON.UI.CSS;
|
using Shared;
|
|
namespace HDL_ON.UI
|
{
|
public partial class TopViewDiv
|
{
|
/// <summary>
|
/// 父窗体
|
/// </summary>
|
FrameLayout baseView;
|
/// <summary>
|
/// 父窗体Dialog
|
/// </summary>
|
Dialog baseDialog;
|
/// <summary>
|
/// 内容区域
|
/// </summary>
|
FrameLayout contentView;
|
|
|
/// <summary>
|
/// 后退按钮
|
/// </summary>
|
Button btnBack;
|
|
/// <summary>
|
/// 标题名称
|
/// </summary>
|
string title;
|
|
/// <summary>
|
/// 后退时触发对事件
|
/// </summary>
|
Action backAction;
|
|
public TopViewDiv(FrameLayout frame, string str)
|
{
|
baseView = frame;
|
title = str;
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="dialog">显示的dialog</param>
|
/// <param name="frame">dialog的父窗体</param>
|
/// <param name="str">标题文本</param>
|
public TopViewDiv(Dialog dialog, FrameLayout frame, string str)
|
{
|
baseDialog = dialog;
|
baseView = frame;
|
title = str;
|
}
|
|
|
/// <summary>
|
/// 向framelayout添加顶部区域
|
/// </summary>
|
/// <param name="frame"></param>
|
/// <param name="tilte"></param>
|
public void LoadTopView()
|
{
|
contentView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(64),
|
BackgroundColor = CSS_Color.TopViewColor,
|
};
|
baseView.AddChidren(contentView);
|
|
btnBack = new Button()
|
{
|
X = Application.GetRealWidth(10),
|
Y = Application.GetRealHeight(29),
|
Width = Application.GetRealWidth(40),
|
Height = Application.GetRealHeight(28),
|
UnSelectedImagePath = "Public/BackIcon.png",
|
};
|
baseView.AddChidren(btnBack);
|
|
Button btnTilte = new Button()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(150),
|
Height = Application.GetRealHeight(25),
|
TextAlignment = TextAlignment.Center,
|
TextSize = CSS_FontSize.HeadlineFontSize,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
Text = title
|
};
|
baseView.AddChidren(btnTilte);
|
|
|
LoadEventList();
|
}
|
/// <summary>
|
/// 拥有一个回调事件
|
/// </summary>
|
/// <param name="action"></param>
|
public void LoadTopView(Action action)
|
{
|
backAction = action;
|
|
LoadTopView();
|
}
|
|
/// <summary>
|
/// 向framelayout添加顶部区域,拥有配置图标按钮
|
/// </summary>
|
/// <param name="frame"></param>
|
/// <param name="tilte"></param>
|
public void LoadTopView(Function function, Action action)
|
{
|
backAction = action;
|
|
LoadTopView();
|
|
var btnSetting = new Button()
|
{
|
X = Application.GetRealWidth(337),
|
Y = Application.GetRealHeight(29),
|
Width = Application.GetMinRealAverage(28),
|
Height = Application.GetMinRealAverage(28),
|
UnSelectedImagePath = "Public/FuncInfoSetIcon.png",
|
};
|
contentView.AddChidren(btnSetting);
|
|
btnSetting.MouseUpEventHandler += (sender, e) =>
|
{
|
LoadEvent_SkipFunctionSetting(function);
|
};
|
}
|
/// <summary>
|
/// 房间标题区域
|
/// </summary>
|
/// <param name="room"></param>
|
/// <param name="skipAction"></param>
|
public void LoadTopView(Room room,Action skipAction)
|
{
|
//backAction = action;
|
|
LoadTopView();
|
|
var btnSetting = new Button()
|
{
|
X = Application.GetRealWidth(337),
|
Y = Application.GetRealHeight(29),
|
Width = Application.GetMinRealAverage(28),
|
Height = Application.GetMinRealAverage(28),
|
UnSelectedImagePath = "Public/FuncInfoSetIcon.png",
|
};
|
contentView.AddChidren(btnSetting);
|
|
btnSetting.MouseUpEventHandler += (sender, e) =>
|
{
|
skipAction();
|
};
|
}
|
|
/// <summary>
|
/// 向framelayout添加顶部区域,拥有添加图标的按钮
|
/// </summary>
|
/// <param name="frame"></param>
|
/// <param name="tilte"></param>
|
public void LoadTopView(string type, Action<string, string> callBack)
|
{
|
LoadTopView();
|
|
var btnAddIcon = new Button()
|
{
|
X = Application.GetRealWidth(337),
|
Y = Application.GetRealHeight(29),
|
Width = Application.GetMinRealAverage(28),
|
Height = Application.GetMinRealAverage(28),
|
UnSelectedImagePath = "Public/AddIcon.png",
|
};
|
contentView.AddChidren(btnAddIcon);
|
|
btnAddIcon.MouseUpEventHandler += (sender, e) =>
|
{
|
LoadEvent_AddEvent(type, callBack);
|
};
|
}
|
|
/// <summary>
|
/// 向framelayout添加顶部区域,拥有添加图标的按钮,返回有回调事件
|
/// </summary>
|
/// <param name="type"></param>
|
/// <param name="callBack"></param>
|
/// <param name="action"></param>
|
public void LoadTopView(string type, Action<string, string> callBack,Action action)
|
{
|
LoadTopView(type, callBack);
|
|
backAction = action;
|
}
|
}
|
}
|