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