/// <summary> /// 创建一个新的单位工程选项卡(空工程) /// </summary> /// <param name="p_UnitProject">单位工程</param> public void CreateNewUnitProject(CWellComeProject p_Parent, _UnitProject p_UnitProject) { //如果选项卡已经存在设置为当前操作选中 XtraTabPageEx xtp = null; xtp = this.Find(p_UnitProject); if (xtp == null) { xtp = XtraTabPageEx.CreateInstance(p_Parent, p_UnitProject); xtp.UnitProject = p_UnitProject; //若已经存在当前选项卡则被调用 this.TabPages.Add(xtp); } this.SelectedTabPage = xtp; }
/// <summary> /// 创建项目欢迎页面 /// </summary> /// <param name="p_Project">当前项目</param> /// <returns></returns> public static XtraTabPageEx CreateWellCome(_Projects p_Project) { XtraTabPageEx xtp = new XtraTabPageEx(); xtp.m_XtraTabType = "项目指引"; xtp.Text = p_Project.Property.Basis.Name; xtp.ImageIndex = 0; CWellComeProject form = new CWellComeProject(); form.FormBorderStyle = FormBorderStyle.None; form.Dock = DockStyle.Fill;//设置样式是否填充整个PANEL //设置为非顶级控件 form.TopLevel = false; //显示窗体 form.Visible = true; xtp.Controls.Add(form); return(xtp); }
/// <summary> /// 获取一个(单位工程)选项卡对象 /// </summary> /// <returns></returns> public static XtraTabPageEx CreateInstance(CWellComeProject p_Parent, _UnitProject p_UnitProject) { //如果不存在当前打开的工程文件对象则放入此工程 /*if (_Common.Application.Global.Configuration.Bool_Temporary_UnitProject) * { * if (!_Common.Application.Cache.Cache_Bak_Object.Contains(p_UnitProject)) * { * _Common.Application.Cache.Cache_Bak_Object.Add(p_UnitProject); * } * }*/ XtraTabPageEx xtp = new XtraTabPageEx(); xtp.m_XtraTabType = "单位工程"; xtp.Dock = DockStyle.Fill;//设置样式是否填充整个PANEL //创建新的应用窗体 xtp.m_ProjectForm = new ProjectForm(); //同步当前业务对象 GLODSOFT.QDJJ.BUSINESS._Project_Statistics statistics = new GLODSOFT.QDJJ.BUSINESS._Project_Statistics(p_UnitProject, p_Parent.CurrentBusiness); statistics.Calculate(); xtp.m_ProjectForm.CurrentBusiness = p_Parent.CurrentBusiness; p_UnitProject.NeedCalculate = true; //活动的单位工程 xtp.m_ProjectForm.Activitie = p_UnitProject; //设置父类容器 xtp.m_ProjectForm.Parent_Projects = p_Parent; xtp.m_ProjectForm.FormBorderStyle = FormBorderStyle.None; xtp.m_ProjectForm.Dock = DockStyle.Fill;//设置样式是否填充整个PANEL xtp.GetProjectForm.MainForm = p_Parent.Parent as ApplicationForm; //设置为非顶级控件 xtp.m_ProjectForm.TopLevel = false; //显示窗体 xtp.m_ProjectForm.Visible = true; xtp.Text = p_UnitProject.Name; xtp.ImageIndex = 2; //当有新子列表被添加到工作区时激发 xtp.m_ProjectForm.WorkPanel.ControlAdded += new ControlEventHandler(WorkPanel_ControlAdded); xtp.Controls.Add(xtp.m_ProjectForm); return(xtp); }
/// <summary> /// 替换当前选项卡 /// </summary> /// <param name="p_Parent"></param> /// <param name="p_UnitProject"></param> public void Replace(CWellComeProject p_Parent, _UnitProject p_UnitProject, int OldId) { //1.如果选项卡是当前打开的选项卡 重新添加页面数据 //2.如果当前选项卡存在列表中 重新添加数据 XtraTabPageEx xtp = this.Find(p_UnitProject, OldId); if (xtp == null) { return; } //APP.Methods.Init(p_UnitProject); //xtp.XtraTabType = "单位工程"; //xtp.Dock = DockStyle.Fill;//设置样式是否填充整个PANEL GLODSOFT.QDJJ.BUSINESS._Project_Statistics statistics = new GLODSOFT.QDJJ.BUSINESS._Project_Statistics(p_UnitProject, p_Parent.CurrentBusiness); statistics.Calculate(); //创建新的应用窗体 xtp.GetProjectForm = new ProjectForm(); xtp.UnitProject = p_UnitProject; //同步当前业务对象 xtp.GetProjectForm.CurrentBusiness = p_Parent.CurrentBusiness; p_UnitProject.NeedCalculate = true; //活动的单位工程 xtp.GetProjectForm.Activitie = p_UnitProject; //设置父类容器 xtp.GetProjectForm.Parent_Projects = p_Parent; xtp.GetProjectForm.FormBorderStyle = FormBorderStyle.None; xtp.GetProjectForm.Dock = DockStyle.Fill;//设置样式是否填充整个PANEL //设置为非顶级控件 xtp.GetProjectForm.TopLevel = false; //显示窗体 xtp.GetProjectForm.Visible = true; xtp.Text = p_UnitProject.Name; xtp.GetProjectForm.dp_Function.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; //当前存在的重新加载数据 //删除原来的Project对象 xtp.Controls.Remove(xtp.Controls[0]); //添加新的Project对象 xtp.Controls.Add(xtp.GetProjectForm); }
/// <summary> /// 判断两个选项卡正在操作的内容是否相同 /// </summary> /// <param name="curr_Page">当前选项卡</param> /// <param name="pav_Page">前一个选项卡</param> /// <returns></returns> private bool IsSame(XtraTabPageEx curr_Page, XtraTabPageEx pav_Page) { if (pav_Page == null) { return(false); } ProjectForm from1 = curr_Page.Controls[0] as ProjectForm; ProjectForm from2 = pav_Page.Controls[0] as ProjectForm; if (from1 == null || from2 == null) { return(false); } if (from1.GetWorkAreas == null || from2.GetWorkAreas == null) { return(false); } if (from1.GetWorkAreas.GetType().Name == from2.GetWorkAreas.GetType().Name) { return(true); } return(false); }