using System;
using System.Collections.Generic;
namespace IStation.WinFrmUI
{
public partial class DocumentPage : DevExpress.XtraEditors.XtraUserControl
{
public DocumentPage()
{
this.PageTitle = new PageTitle();
}
public DocumentPage(SurfaceGuid surfaceGuid)
{
this.PageTitle = new PageTitle();
this.SurfaceGuid = surfaceGuid;
}
///
/// 加载菜单事件
///
public event Action> LoadPageMenuEvent;
protected void LoadPageMenu(SurfaceGuid sguid, List menus)
{
this.LoadPageMenuEvent?.Invoke(sguid, menus);
}
///
/// 根据字符串判断Document是否存在,
/// 第一个参数为SurfaceGuid参数类
/// 第二个参数如果页面存在是否激活页面
/// 第三个参数 存在则激活并返回TRUE,不存在返回FALSE
///
public event Func IsExistPageEvent;
protected bool IsExistPage(SurfaceGuid sguid, bool isActivateDoc)
{
if (this.IsExistPageEvent != null)
return this.IsExistPageEvent(sguid, isActivateDoc);
return false;
}
///
/// 查找Page
///
public event Func FindPageEvent;
protected DocumentPage FindPage(SurfaceGuid sguid, bool isActivateDoc)
{
if (this.FindPageEvent != null)
return this.FindPageEvent(sguid, isActivateDoc);
return null;
}
///
/// 创建Page
///
public event Func CreatePageEvent;
protected bool CreatePage(DocumentPage page, SurfaceGuid sguid)
{
if (this.CreatePageEvent != null)
return CreatePageEvent(page, sguid);
return false;
}
///
/// 更新数据事件
/// 第一个参数为SurfaceGuid
///
public event Action RefreshPageDataEvent;
protected void RefreshPageData(SurfaceGuid sguid)
{
this.RefreshPageDataEvent?.Invoke(sguid);
}
///
/// 更新PageTitle事件
///
public event Action UpdatePageTitleEvent;
protected void UpdatePageTitle(SurfaceGuid sguid, PageTitle title)
{
this.UpdatePageTitleEvent?.Invoke(sguid, title);
}
///
/// 关闭Page事件
///
public event Action ClosePageEvent;
protected void ClosePage(SurfaceGuid sguid)
{
this.ClosePageEvent?.Invoke(sguid);
}
///
/// 重置所有页面事件
///
public event Action ResetAllPagesEvent;
protected void ResetAllPages()
{
this.ResetAllPagesEvent?.Invoke();
}
///
/// 在脚部提示的命令名
///
protected string strPageBottomCapture = null;
public string GetPageBottomCapture()
{
if (!string.IsNullOrEmpty(strPageBottomCapture))
return strPageBottomCapture;
if (PageTitle != null)
return PageTitle.Caption;
return "";
}
///
/// 软件操作提示
///
protected string _pageOperateInfo = "";
public virtual string GetPageOperateInfo()
{
return _pageOperateInfo;
}
///
/// 头部部分
///
public PageTitle PageTitle { get; set; }
///
/// 自身标识
///
public SurfaceGuid SurfaceGuid { get; set; }
///
/// 初始化数据
///
public virtual void InitialDataSource()
{
}
///
/// 刷新数据
///
public virtual void RefreshDataSource()
{
}
///
/// 关闭时调用
///
public virtual void Close()
{
}
///
/// 是否可以关闭
///
public virtual bool CanClose()
{
return true;
}
///
/// 注册事件
///
public virtual void RegistEvents()
{
}
///
/// 取消注册事件
///
public virtual void UnRegistEvents()
{
}
///
/// 操作提示
///
public event Action OnShowCmdOperateInfo = null;
public virtual void ShowCmdOperateInfo(string content, int type = 0)
{
if (OnShowCmdOperateInfo != null)
{
OnShowCmdOperateInfo(content, type);
}
}
///
/// 打开一个新的页面
///
public event Action OnOpenNewPage = null;
public virtual void OpenNewPageInMain(DocumentPage page, SurfaceGuid guid)
{
if (OnOpenNewPage != null)
{
OnOpenNewPage(page, guid, true);
}
}
///
/// 打开时出现等待框
///
public bool IsShowWatingFrm { get; set; } = false;
}
}