using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Drawing;
|
using System.Data;
|
using System.Text;
|
using System.Linq;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
using DevExpress.XtraEditors;
|
|
namespace IStation.WinFormUI
|
{
|
public partial class DocumentPage : DevExpress.XtraEditors.XtraUserControl
|
{
|
public DocumentPage()
|
{
|
InitializeComponent();
|
}
|
|
public DocumentPage(SurfaceGuid surfaceGuid)
|
{
|
InitializeComponent();
|
this.PageTitle = new PageTitle();
|
this.SurfaceGuid = surfaceGuid;
|
}
|
|
/// <summary>
|
/// 加载菜单事件
|
/// </summary>
|
public event Action<SurfaceGuid, List<PageMenu>> LoadPageMenuEvent;
|
protected void LoadPageMenu(SurfaceGuid sguid, List<PageMenu> menus)
|
{
|
this.LoadPageMenuEvent?.Invoke(sguid, menus);
|
}
|
|
/// <summary>
|
/// 根据字符串判断Document是否存在,
|
/// 第一个参数为SurfaceGuid参数类
|
/// 第二个参数如果页面存在是否激活页面
|
/// 第三个参数 存在则激活并返回TRUE,不存在返回FALSE
|
/// </summary>
|
public event Func<SurfaceGuid, bool, bool> IsExistPageEvent;
|
protected bool IsExistPage(SurfaceGuid sguid, bool isActivateDoc)
|
{
|
if (this.IsExistPageEvent != null)
|
return this.IsExistPageEvent(sguid, isActivateDoc);
|
return false;
|
}
|
|
/// <summary>
|
/// 查找Page
|
/// </summary>
|
public event Func<SurfaceGuid, bool, DocumentPage> FindPageEvent;
|
protected DocumentPage FindPage(SurfaceGuid sguid, bool isActivateDoc)
|
{
|
if (this.FindPageEvent != null)
|
return this.FindPageEvent(sguid, isActivateDoc);
|
return null;
|
}
|
|
/// <summary>
|
/// 创建Page
|
/// </summary>
|
public event Func<DocumentPage, SurfaceGuid, bool> CreatePageEvent;
|
protected bool CreatePage(DocumentPage page, SurfaceGuid sguid)
|
{
|
if (this.CreatePageEvent != null)
|
return CreatePageEvent(page, sguid);
|
return false;
|
}
|
|
/// <summary>
|
/// 更新数据事件
|
/// 第一个参数为SurfaceGuid
|
/// </summary>
|
public event Action<SurfaceGuid> RefreshPageDataEvent;
|
protected void RefreshPageData(SurfaceGuid sguid)
|
{
|
this.RefreshPageDataEvent?.Invoke(sguid);
|
}
|
|
/// <summary>
|
/// 更新PageTitle事件
|
/// </summary>
|
public event Action<SurfaceGuid, PageTitle> UpdatePageTitleEvent;
|
protected void UpdatePageTitle(SurfaceGuid sguid, PageTitle title)
|
{
|
this.UpdatePageTitleEvent?.Invoke(sguid, title);
|
}
|
|
/// <summary>
|
/// 关闭Page事件
|
/// </summary>
|
public event Action<SurfaceGuid> ClosePageEvent;
|
protected void ClosePage(SurfaceGuid sguid)
|
{
|
this.ClosePageEvent?.Invoke(sguid);
|
}
|
|
/// <summary>
|
/// 重置所有页面事件
|
/// </summary>
|
public event Action ResetAllPagesEvent;
|
protected void ResetAllPages()
|
{
|
this.ResetAllPagesEvent?.Invoke();
|
}
|
|
|
/// <summary>
|
/// 头部部分
|
/// </summary>
|
public PageTitle PageTitle { get; set; } = new PageTitle();
|
|
/// <summary>
|
/// 自身标识
|
/// </summary>
|
public SurfaceGuid SurfaceGuid { get; set; }
|
|
|
/// <summary>
|
/// 初始化数据
|
/// </summary>
|
public virtual void InitialDataSource()
|
{
|
|
}
|
|
|
/// <summary>
|
/// 刷新数据
|
/// </summary>
|
public virtual void RefreshDataSource()
|
{
|
|
}
|
|
/// <summary>
|
/// 关闭时调用
|
/// </summary>
|
public virtual void Close()
|
{
|
|
}
|
|
/// <summary>
|
/// 是否可以关闭
|
/// </summary>
|
public virtual bool CanClose()
|
{
|
return true;
|
}
|
|
/// <summary>
|
/// 注册事件
|
/// </summary>
|
public virtual void RegistEvents()
|
{
|
|
}
|
|
/// <summary>
|
/// 取消注册事件
|
/// </summary>
|
public virtual void UnRegistEvents()
|
{
|
|
}
|
|
|
|
}
|
}
|