namespace Yw.WinFrmUI
|
{
|
/// <summary>
|
/// 页面
|
/// </summary>
|
public partial class DocumentPage : DevExpress.XtraEditors.XtraUserControl
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public DocumentPage()
|
{
|
InitializeComponent();
|
this.PageTitle = new PageTitle();
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public DocumentPage(PageGuid pguid) : this()
|
{
|
this.PageGuid = pguid;
|
}
|
|
/// <summary>
|
/// 根据字符串判断Document是否存在,
|
/// 第一个参数为PageGuid参数类
|
/// 第二个参数如果页面存在是否激活页面
|
/// 第三个参数 存在则激活并返回TRUE,不存在返回FALSE
|
/// </summary>
|
public event Func<PageGuid, bool, bool> IsExistPageEvent;
|
|
/// <summary>
|
/// 是否存在Page
|
/// </summary>
|
/// <param name="pguid"></param>
|
/// <param name="isActivateDoc"></param>
|
/// <returns></returns>
|
protected bool IsExistPage(PageGuid pguid, bool isActivateDoc)
|
{
|
if (this.IsExistPageEvent != null)
|
{
|
return this.IsExistPageEvent(pguid, isActivateDoc);
|
}
|
return false;
|
}
|
|
/// <summary>
|
/// 查找Page
|
/// </summary>
|
public event Func<PageGuid, bool, DocumentPage> FindPageEvent;
|
|
/// <summary>
|
/// 查找Page
|
/// </summary>
|
/// <param name="sguid"></param>
|
/// <param name="isActivateDoc"></param>
|
/// <returns></returns>
|
protected DocumentPage FindPage(PageGuid sguid, bool isActivateDoc)
|
{
|
if (this.FindPageEvent != null)
|
return this.FindPageEvent(sguid, isActivateDoc);
|
return null;
|
}
|
|
/// <summary>
|
/// 创建Page
|
/// </summary>
|
public event Func<DocumentPage, PageGuid, bool> CreatePageEvent;
|
|
/// <summary>
|
/// 创建Page
|
/// </summary>
|
/// <param name="page"></param>
|
/// <param name="sguid"></param>
|
/// <returns></returns>
|
protected bool CreatePage(DocumentPage page, PageGuid sguid)
|
{
|
if (this.CreatePageEvent != null)
|
return CreatePageEvent(page, sguid);
|
return false;
|
}
|
|
/// <summary>
|
/// 更新数据事件
|
/// 第一个参数为SurfaceGuid
|
/// </summary>
|
public event Action<PageGuid> RefreshPageDataEvent;
|
|
/// <summary>
|
/// 更新数据事件
|
/// </summary>
|
/// <param name="sguid"></param>
|
protected void RefreshPageData(PageGuid sguid)
|
{
|
this.RefreshPageDataEvent?.Invoke(sguid);
|
}
|
|
/// <summary>
|
/// 更新PageTitle事件
|
/// </summary>
|
public event Action<PageGuid, PageTitle> UpdatePageTitleEvent;
|
|
/// <summary>
|
/// 更新PageTitle事件
|
/// </summary>
|
/// <param name="sguid"></param>
|
/// <param name="title"></param>
|
protected void UpdatePageTitle(PageGuid sguid, PageTitle title)
|
{
|
this.UpdatePageTitleEvent?.Invoke(sguid, title);
|
}
|
|
/// <summary>
|
/// 关闭Page事件
|
/// </summary>
|
public event Action<PageGuid> ClosePageEvent;
|
|
/// <summary>
|
/// 关闭page
|
/// </summary>
|
/// <param name="sguid"></param>
|
protected void ClosePage(PageGuid sguid)
|
{
|
this.ClosePageEvent?.Invoke(sguid);
|
}
|
|
/// <summary>
|
/// 头部部分
|
/// </summary>
|
public PageTitle PageTitle { get; set; }
|
|
/// <summary>
|
/// 自身标识
|
/// </summary>
|
public PageGuid PageGuid { get; set; }
|
|
/// <summary>
|
/// 初始化数据
|
/// </summary>
|
public virtual void InitialDataSource()
|
{
|
}
|
|
/// <summary>
|
/// 权限验证
|
/// </summary>
|
public virtual void VerifyAuth()
|
{
|
}
|
|
/// <summary>
|
/// 页面拥有的权限树
|
/// </summary>
|
public PageAuthHaveTree AuthTree { get; set; }
|
|
/// <summary>
|
/// 刷新数据
|
/// </summary>
|
public virtual void RefreshData()
|
{
|
|
}
|
|
/// <summary>
|
/// 关闭时调用
|
/// </summary>
|
public virtual void Close()
|
{
|
}
|
|
/// <summary>
|
/// 是否可以关闭
|
/// </summary>
|
public virtual bool CanClose()
|
{
|
return true;
|
}
|
|
/// <summary>
|
/// 是否允许关闭
|
/// </summary>
|
public virtual bool AllowClose()
|
{
|
return true;
|
}
|
|
/// <summary>
|
/// 注册事件
|
/// </summary>
|
public virtual void RegistEvents()
|
{
|
|
}
|
|
/// <summary>
|
/// 取消注册事件
|
/// </summary>
|
public virtual void UnRegistEvents()
|
{
|
|
}
|
}
|
}
|