fix: 收敛旧模块资源释放与诊断

This commit is contained in:
2026-08-15 10:13:08 +08:00
parent 222ae3c08a
commit c49015d390
60 changed files with 4218 additions and 409 deletions
+76 -16
View File
@@ -41,11 +41,79 @@ namespace Lskj.Control
{
public partial class AuditPanelEx : UserControl
{
private bool mResourcesReleased;
public AuditPanelEx()
{
InitializeComponent();
}
internal void ReleaseResourcesForDispose()
{
if (mResourcesReleased)
{
return;
}
mResourcesReleased = true;
MyControl searchControl = _searchContrl;
_searchContrl = null;
if (searchControl != null)
{
searchControl.Dispose();
}
try
{
if (gridFinish != null && gridFinish.GridView != null)
{
gridFinish.GridView.SelectionChanged -= GvFinish_SelectionChangedClick;
gridFinish.GridView.DoubleClick -= GvFinish_DoubleClick;
}
foreach (TabPageObj tabPage in _tabPageObjs)
{
foreach (TabPageItemObj item in tabPage.TabPageItemObjs)
{
if (item.GridControlObj != null &&
item.GridControlObj.GridView != null)
{
item.GridControlObj.GridView.DoubleClick -=
OnGridViewDoubleClick;
item.GridControlObj.Model = null;
}
}
tabPage.TabPageItemObjs.Clear();
}
}
catch
{
// A partially disposed DevExpress view must not stop cleanup.
}
try
{
if (SysModel != null && SysModel.DataCaches != null)
{
SysModel.DataCaches.Remove(this);
}
}
catch
{
// Cache cleanup must not interrupt control disposal.
}
_tabPageObjs.Clear();
_tabPageCount.Clear();
OnGridViewDoubleCallBack = null;
OnGridFinshViewDoubleCallBack = null;
OnBtnSearchCallBack = null;
SectionAccradit = null;
AuditComModelObj = null;
BaseAccraditModelObj = null;
PubSysModel = null;
SysModel = null;
}
#region
/// <summary>
@@ -299,17 +367,12 @@ namespace Lskj.Control
{
return new AccraditationModel(dataRow);
}));
Task<GridControlEx> gridControlExTask = cachesDic.AddTask(dataRow, "GridControlEx", new Task<GridControlEx>(() =>
{
return new GridControlEx();
}));
GridControlEx gridControlEx = gridControlExTask.Result;
string key = "FLOWSTEP_" + dynamicModel.ModuleCode + "_" + flowTypeStepModelTask.Result.StepCode + "_" + accraditationModelTask.Result.Id + "";
Task<DataTable> baseGridRowColorsTask = cachesDic.AddTask(gridControlEx, "BaseGridRowColors", new Task<DataTable>(() =>
Task<DataTable> baseGridRowColorsTask = cachesDic.AddTask(dataRow, "BaseGridRowColors", new Task<DataTable>(() =>
{
return BaseModuleImpl.GetBaseGridRowColors(key);
}));
Task<DataTable> flowstepGridRightMenusTask = cachesDic.AddTask(gridControlEx, "FlowstepGridRightMenus", new Task<DataTable>(() =>
Task<DataTable> flowstepGridRightMenusTask = cachesDic.AddTask(dataRow, "FlowstepGridRightMenus", new Task<DataTable>(() =>
{
return BaseModuleImpl.GetBaseGridRightMenus($"FLOWSTEP_{accraditationModelTask.Result.Formkey}");
}));
@@ -317,10 +380,6 @@ namespace Lskj.Control
//{
// return BaseImpl.GetDataTableResult(accraditationModelTask.Result.StepSql);
//}));
string modelkeyName = isBill ? GridCustomColumnStruct.AuditMainGridView : GridCustomColumnStruct.BaseAuditMainGridView;
string customColumKey = modelkeyName + key;
cachesDic.AddTask(gridControlEx, "DynamicModel", dynamicModelTask);
gridControlEx.GetDataCaches(cachesDic, customColumKey);
}
return flowList;
}));
@@ -613,18 +672,19 @@ namespace Lskj.Control
gridPanel.Padding = new System.Windows.Forms.Padding(2);
gridPanel.Dock = DockStyle.Right;
gridPanel.BorderStyle = BorderStyles.NoBorder;
if (!dataCaches.GetValue(dataRow, "GridControlEx", out GridControlEx grid))
GridControlEx grid = new GridControlEx();
if (dataCaches != null)
{
grid = new GridControlEx();
grid.GetDataCaches(dataCaches, modelkeyName + key);
}
grid.Parent = gridPanel;
grid.Dock = DockStyle.Fill;
grid.BorderStyle = BorderStyle.None;
if (!dataCaches.GetValue(grid, "BaseGridRowColors", out DataTable dtGridRowColors))
if (!dataCaches.GetValue(dataRow, "BaseGridRowColors", out DataTable dtGridRowColors))
{
dtGridRowColors = BaseModuleImpl.GetBaseGridRowColors(key);
}
if (!dataCaches.GetValue(grid, "FlowstepGridRightMenus", out DataTable dtGridRightMenus))
if (!dataCaches.GetValue(dataRow, "FlowstepGridRightMenus", out DataTable dtGridRightMenus))
{
dtGridRightMenus = BaseModuleImpl.GetBaseGridRightMenus($"FLOWSTEP_{accrModel.Formkey}");
}
@@ -1906,4 +1966,4 @@ namespace Lskj.Control
}
}
}
}