feat(legacy): add shell-independent module page compatibility
This commit is contained in:
@@ -260,6 +260,16 @@ namespace Lskj.Main.Control
|
||||
{
|
||||
try
|
||||
{
|
||||
// Bind the real WinForms page surface before any menu or
|
||||
// startup callback can open a module. The WPF host never
|
||||
// constructs this panel; the explicit shell check keeps its
|
||||
// ModulePageHost untouched if a shared AppDomain is used.
|
||||
if (Manager.ExternalMainShell == null)
|
||||
{
|
||||
ERPInfo.Instance.ModulePageHost = null;
|
||||
ERPInfo.Instance.PageControl = this.tabMain;
|
||||
Manager.TabMain = this.tabMain;
|
||||
}
|
||||
WaitForm.ShowForm();
|
||||
|
||||
ContextMenuStrip headMenuStrip = new ContextMenuStrip();
|
||||
@@ -366,7 +376,6 @@ namespace Lskj.Main.Control
|
||||
new Thread(MainImpl.DnsHostEntry).Start();
|
||||
this.mark_timer.Start();
|
||||
|
||||
ERPInfo.Instance.PageControl = this.tabMain;
|
||||
ERPInfo.Instance.ModuleForms = Manager.ModuleForms;
|
||||
if ((!this._allMenus.Columns.Contains("menuposition") || (!SystemInfo.Instance.IsOpenWork && !SystemInfo.Instance.ShowGallerysFromMenu)) && (!SystemInfo.Instance.HideGallerys || SystemInfo.Instance.DesktopFormatShowGallerys))
|
||||
{
|
||||
@@ -3850,12 +3859,12 @@ namespace Lskj.Main.Control
|
||||
XtraTabPage beforePage = m.BeforePage;
|
||||
if (beforePage != null)
|
||||
{
|
||||
foreach (XtraTabPage tablepage in ERPInfo.Instance.PageControl.TabPages)
|
||||
foreach (XtraTabPage tablepage in ERPInfo.Instance.ModulePages)
|
||||
{
|
||||
|
||||
if (tablepage == beforePage)
|
||||
{
|
||||
ERPInfo.Instance.PageControl.SelectedTabPage = beforePage;
|
||||
ERPInfo.Instance.CurrentModulePage = beforePage;
|
||||
if (isclose) tabPage.Dispose();
|
||||
}
|
||||
}
|
||||
@@ -4945,6 +4954,7 @@ namespace Lskj.Main.Control
|
||||
try
|
||||
{
|
||||
XtraTabPage tabPage = this.tabMain.SelectedTabPage;
|
||||
ERPInfo.Instance.NotifyModulePageSelected(tabPage);
|
||||
string guid = tabPage.Tag + "";
|
||||
if (!string.IsNullOrWhiteSpace(guid) && Manager.ModuleForms.ContainsKey(guid))
|
||||
{
|
||||
|
||||
@@ -61,6 +61,17 @@ namespace Lskj.Main.Hosting
|
||||
Manager.ExternalMainShell = externalMainShell;
|
||||
try
|
||||
{
|
||||
// A standalone Ls_ERP process must always start in the
|
||||
// original WinForms page mode. Clear any stale host
|
||||
// references before FrmMain is created so Manager.OpenModule
|
||||
// cannot accidentally route pages to a previous WPF shell
|
||||
// when the legacy runtime is reused in-process.
|
||||
if (externalMainShell == null)
|
||||
{
|
||||
ERPInfo.Instance.ModulePageHost = null;
|
||||
ERPInfo.Instance.PageControl = null;
|
||||
Manager.TabMain = null;
|
||||
}
|
||||
Program.InitializeMainProcess();
|
||||
_mainProcessInitialized = true;
|
||||
}
|
||||
|
||||
@@ -356,12 +356,12 @@ namespace Lskj.Main.Model
|
||||
dllName = MainImpl.GetDefaultValue(dllName);
|
||||
if (SystemInfo.Instance.SoftOpenMode || SingleOpenMode)
|
||||
{
|
||||
foreach (XtraTabPage tablepage in TabMain.TabPages)
|
||||
foreach (XtraTabPage tablepage in ERPInfo.Instance.ModulePages)
|
||||
{
|
||||
if (tablepage.Text == menuName)
|
||||
{
|
||||
MessageUtil.Show("已设置不能打开多个相同模块!");
|
||||
TabMain.SelectedTabPage = tablepage;
|
||||
ERPInfo.Instance.SelectModulePage(tablepage);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -414,8 +414,8 @@ namespace Lskj.Main.Model
|
||||
tp.Dock = DockStyle.Fill;
|
||||
module.Tag = guid;
|
||||
module.ModuleInPtr = exeMainHandle;
|
||||
TabMain.TabPages.Add(tp);
|
||||
TabMain.SelectedTabPage = tp;
|
||||
ERPInfo.Instance.AddModulePage(tp);
|
||||
ERPInfo.Instance.SelectModulePage(tp);
|
||||
ModuleForms.Add(guid, module);
|
||||
}
|
||||
else//直接打开exe模块
|
||||
@@ -688,8 +688,8 @@ namespace Lskj.Main.Model
|
||||
//}
|
||||
}
|
||||
|
||||
TabMain.TabPages.Add(tp);
|
||||
TabMain.SelectedTabPage = tp;
|
||||
ERPInfo.Instance.AddModulePage(tp);
|
||||
ERPInfo.Instance.SelectModulePage(tp);
|
||||
ModuleForms.Add(guid, module);
|
||||
|
||||
//LastModuleForm.Add(module);
|
||||
@@ -720,10 +720,7 @@ namespace Lskj.Main.Model
|
||||
if (tabPage != null)
|
||||
{
|
||||
StaticControl.DogVerifyModuleForms.Remove(tabPage);
|
||||
if (TabMain != null && TabMain.TabPages.Contains(tabPage))
|
||||
{
|
||||
TabMain.TabPages.Remove(tabPage);
|
||||
}
|
||||
ERPInfo.Instance.RemoveModulePage(tabPage);
|
||||
}
|
||||
|
||||
if (form != null && !form.IsDisposed)
|
||||
|
||||
Reference in New Issue
Block a user