7 Commits

Author SHA1 Message Date
tdx d3587a16f1 chore(browser): sync current working implementation
Rollback tag: pre-current-browser-sync-20260818
2026-08-18 14:30:23 +08:00
tdx 6b78bbbf04 fix: 恢复 ModuleGridEx 组件容器管理 2026-08-15 22:37:07 +08:00
cyf 57dedb5e9d feat: 新增时间输入和Alt按钮快捷键 2026-08-15 22:26:11 +08:00
tdx a65dfab897 fix: synchronize module data cache cleanup 2026-08-15 18:39:26 +08:00
tdx d098dde830 chore(report): 清理临时资源诊断代码 2026-08-15 16:37:10 +08:00
tdx ef13d46fa2 Merge branch 'main' of http://192.168.0.7:4133/cyf/lserp_cs_6.0 2026-08-15 16:35:25 +08:00
tdx fc5faab65d fix(control): 修复金额单元格关闭阶段异常 2026-08-15 16:00:10 +08:00
49 changed files with 1199 additions and 985 deletions
@@ -107,7 +107,7 @@
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(80, 28);
this.btnCancel.TabIndex = 4;
this.btnCancel.Text = "退出(&C)";
this.btnCancel.Text = "退出(C)";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnFileManger
@@ -175,7 +175,7 @@
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(80, 28);
this.btnSave.TabIndex = 11;
this.btnSave.Text = "保存(&S)";
this.btnSave.Text = "保存(S)";
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// dpb_Tools
@@ -458,7 +458,7 @@
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(58, 23);
this.btnClose.TabIndex = 12;
this.btnClose.Text = "关闭(&Q)";
this.btnClose.Text = "关闭(Q)";
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// labeltxt_managerAudit
@@ -39,6 +39,9 @@ namespace Lskj.BaseAccraditation
{
public partial class FrmBaseAccraditation : BaseForm
{
private readonly AltButtonShortcutManager mAltButtonShortcuts =
new AltButtonShortcutManager();
#region
/// <summary>
/// 审批模型
@@ -190,6 +193,23 @@ namespace Lskj.BaseAccraditation
public FrmBaseAccraditation()
{
InitializeComponent();
InitializeAltButtonShortcuts();
}
private void InitializeAltButtonShortcuts()
{
mAltButtonShortcuts.Register(btnCancel, Keys.C);
mAltButtonShortcuts.Register(btnSave, Keys.S);
mAltButtonShortcuts.Register(btnAudit, Keys.Y);
mAltButtonShortcuts.Register(btnClose, Keys.Q);
mAltButtonShortcuts.Register(btnReturnd, Keys.N);
}
protected override bool ProcessCmdKey(
ref System.Windows.Forms.Message msg, Keys keyData)
{
return mAltButtonShortcuts.ProcessKey(keyData) ||
base.ProcessCmdKey(ref msg, keyData);
}
private void ReleaseResourcesForDispose()
@@ -219,7 +239,7 @@ namespace Lskj.BaseAccraditation
}
if (SysModel != null && SysModel.DataCaches != null)
{
SysModel.DataCaches.Remove(this);
SysModel.DataCaches.RemoveCache(this);
}
}
catch
@@ -1480,7 +1500,7 @@ namespace Lskj.BaseAccraditation
{
this.btnAudit.Enabled = true;
this.btnClose.Visible = this.btnRemindAccradit.Visible = this.btnRemindBack.Visible = this.btnSave.Visible = this.btnReturnd.Visible = false;
this.btnAudit.Text = "确认(&Y)";
this.btnAudit.Text = "确认(Y)";
this.label_auditPerson.Text = "确认意见";
this.labeltxt_managerAudit.Text = "会签人";
this.txt_remark.Text = "确认";
+8 -8
View File
@@ -175,7 +175,7 @@
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(75, 26);
this.btnClose.TabIndex = 22;
this.btnClose.Text = "关闭(&Q)";
this.btnClose.Text = "关闭(Q)";
//
// btnBack
//
@@ -187,7 +187,7 @@
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(75, 26);
this.btnBack.TabIndex = 21;
this.btnBack.Text = "返退(&N)";
this.btnBack.Text = "返退(N)";
this.btnBack.Click += new System.EventHandler(this.btnReturn_Click);
//
// btnSave
@@ -200,7 +200,7 @@
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 26);
this.btnSave.TabIndex = 25;
this.btnSave.Text = "保存(&S)";
this.btnSave.Text = "保存(S)";
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// btnAccradit
@@ -213,7 +213,7 @@
this.btnAccradit.Name = "btnAccradit";
this.btnAccradit.Size = new System.Drawing.Size(75, 26);
this.btnAccradit.TabIndex = 20;
this.btnAccradit.Text = "审核(&Y)";
this.btnAccradit.Text = "审核(Y)";
this.btnAccradit.Click += new System.EventHandler(this.btnAccradit_Click);
//
// btnPrint
@@ -256,7 +256,7 @@
this.btnSpare.Name = "btnSpare";
this.btnSpare.Size = new System.Drawing.Size(75, 26);
this.btnSpare.TabIndex = 27;
this.btnSpare.Text = "分单(&P)";
this.btnSpare.Text = "分单(P)";
this.btnSpare.Click += new System.EventHandler(this.btnSpare_Click);
//
// pcTool
@@ -381,7 +381,7 @@
this.btnReflash.Name = "btnReflash";
this.btnReflash.Size = new System.Drawing.Size(75, 26);
this.btnReflash.TabIndex = 27;
this.btnReflash.Text = "刷新(&R)";
this.btnReflash.Text = "刷新(R)";
this.btnReflash.Click += new System.EventHandler(this.btnReflash_Click);
//
// panelControl1
@@ -523,7 +523,7 @@
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(72, 26);
this.btnSearch.TabIndex = 6;
this.btnSearch.Text = "搜索(&Q)";
this.btnSearch.Text = "搜索(Q)";
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// labeldate_end
@@ -571,7 +571,7 @@
this.btnBackTop.Name = "btnBackTop";
this.btnBackTop.Size = new System.Drawing.Size(72, 26);
this.btnBackTop.TabIndex = 8;
this.btnBackTop.Text = "返审(&W)";
this.btnBackTop.Text = "返审(W)";
this.btnBackTop.Click += new System.EventHandler(this.btnBack_Click);
//
// pcBillDetail
+26 -2
View File
@@ -29,11 +29,35 @@ namespace Lskj.Control
{
public partial class AuditPanel2 : UserControl
{
private readonly AltButtonShortcutManager mAltButtonShortcuts =
new AltButtonShortcutManager();
public AuditPanel2()
{
InitializeComponent();
InitializeAltButtonShortcuts();
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.Selectable | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
}
private void InitializeAltButtonShortcuts()
{
mAltButtonShortcuts.Register(btnClose, Keys.Q);
mAltButtonShortcuts.Register(btnBack, Keys.N);
mAltButtonShortcuts.Register(btnSave, Keys.S);
mAltButtonShortcuts.Register(btnAccradit, Keys.Y);
mAltButtonShortcuts.Register(btnSpare, Keys.P);
mAltButtonShortcuts.Register(btnReflash, Keys.R);
mAltButtonShortcuts.Register(btnSearch, Keys.Q);
mAltButtonShortcuts.Register(btnBackTop, Keys.W);
}
protected override bool ProcessCmdKey(
ref System.Windows.Forms.Message msg, Keys keyData)
{
return mAltButtonShortcuts.ProcessKey(keyData) ||
base.ProcessCmdKey(ref msg, keyData);
}
#region
public string modelkeyName = "";
/// <summary>
@@ -1601,7 +1625,7 @@ namespace Lskj.Control
this.btnClose.Enabled = this.btnSave.Enabled = this.btnAccradit.Enabled = this.btnBack.Enabled = this.btnSpare.Enabled = false;
this.btnSave.Visible = this.btnClose.Visible = this.btnBack.Visible = this.pcTool.Visible = true;
this.btnAccradit.Text = "确认(&Y)";
this.btnAccradit.Text = "确认(Y)";
return;
}
@@ -3624,4 +3648,4 @@ namespace Lskj.Control
}
}
}
}
+171 -171
View File
@@ -48,34 +48,34 @@
this.btnBackAudit = new DevExpress.XtraEditors.SimpleButton();
this.btnRefresh = new DevExpress.XtraEditors.SimpleButton();
this.tabpage_finish = new DevExpress.XtraTab.XtraTabPage();
this.pl_top = new DevExpress.XtraEditors.PanelControl();
this.pl_top_right = new DevExpress.XtraEditors.PanelControl();
this.btnBack = new DevExpress.XtraEditors.SimpleButton();
this.simpleButton1 = new DevExpress.XtraEditors.SimpleButton();
this.pl_top_searchCond = new DevExpress.XtraEditors.PanelControl();
this.labeldate_end = new Lskj.Control.LabelCheckDateEdit();
this.btnSearch = new DevExpress.XtraEditors.SimpleButton();
this.labeltxt_dataFlag = new Lskj.Control.LabelTextEdit();
this.labelcheck_finalAuditor = new Lskj.Control.LabelCheckAutoTextEdit();
this.labeldate_start = new Lskj.Control.LabelCheckDateEdit();
this.splitBelow = new DevExpress.XtraEditors.SplitContainerControl();
this.gridDetail = new Lskj.Control.GridControlEx();
this.gridFlow = new Lskj.Control.GridControlEx();
this.gridFinish = new Lskj.Control.GridControlEx();
this.splitBelow = new DevExpress.XtraEditors.SplitContainerControl();
this.gridFlow = new Lskj.Control.GridControlEx();
this.gridDetail = new Lskj.Control.GridControlEx();
this.pl_top = new DevExpress.XtraEditors.PanelControl();
this.pl_top_searchCond = new DevExpress.XtraEditors.PanelControl();
this.labeldate_start = new Lskj.Control.LabelCheckDateEdit();
this.labelcheck_finalAuditor = new Lskj.Control.LabelCheckAutoTextEdit();
this.labeltxt_dataFlag = new Lskj.Control.LabelTextEdit();
this.btnSearch = new DevExpress.XtraEditors.SimpleButton();
this.labeldate_end = new Lskj.Control.LabelCheckDateEdit();
this.pl_top_right = new DevExpress.XtraEditors.PanelControl();
this.simpleButton1 = new DevExpress.XtraEditors.SimpleButton();
this.btnBack = new DevExpress.XtraEditors.SimpleButton();
this.tabMain = new DevExpress.XtraTab.XtraTabControl();
((System.ComponentModel.ISupportInitialize)(this.pl_bottom)).BeginInit();
this.pl_bottom.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.p_menu)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit();
this.tabpage_finish.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_top)).BeginInit();
this.pl_top.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_top_right)).BeginInit();
this.pl_top_right.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_top_searchCond)).BeginInit();
this.pl_top_searchCond.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitBelow)).BeginInit();
this.splitBelow.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_top)).BeginInit();
this.pl_top.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_top_searchCond)).BeginInit();
this.pl_top_searchCond.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_top_right)).BeginInit();
this.pl_top_right.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tabMain)).BeginInit();
this.tabMain.SuspendLayout();
this.SuspendLayout();
@@ -208,7 +208,7 @@
this.btnOkAudit.Name = "btnOkAudit";
this.btnOkAudit.Size = new System.Drawing.Size(82, 26);
this.btnOkAudit.TabIndex = 7;
this.btnOkAudit.Text = "批量审核(&Y)";
this.btnOkAudit.Text = "批量审核(Y)";
this.btnOkAudit.Visible = false;
this.btnOkAudit.Click += new System.EventHandler(this.OnBtnOkAuditClick);
//
@@ -221,7 +221,7 @@
this.btnBackAudit.Name = "btnBackAudit";
this.btnBackAudit.Size = new System.Drawing.Size(86, 26);
this.btnBackAudit.TabIndex = 6;
this.btnBackAudit.Text = "批量返审(&B)";
this.btnBackAudit.Text = "批量返审(B)";
this.btnBackAudit.Visible = false;
this.btnBackAudit.Click += new System.EventHandler(this.OnBtnBackAuditClick);
//
@@ -234,7 +234,7 @@
this.btnRefresh.Name = "btnRefresh";
this.btnRefresh.Size = new System.Drawing.Size(72, 26);
this.btnRefresh.TabIndex = 5;
this.btnRefresh.Text = "刷新(&R)";
this.btnRefresh.Text = "刷新(R)";
this.btnRefresh.Click += new System.EventHandler(this.BtnReflash_Click);
//
// tabpage_finish
@@ -246,6 +246,57 @@
this.tabpage_finish.Size = new System.Drawing.Size(1570, 1007);
this.tabpage_finish.Text = "已完成单据";
//
// gridFinish
//
this.gridFinish.AdapterObj = null;
this.gridFinish.AutoSize = true;
this.gridFinish.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridFinish.Location = new System.Drawing.Point(0, 39);
this.gridFinish.Margin = new System.Windows.Forms.Padding(4);
this.gridFinish.Name = "gridFinish";
this.gridFinish.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gridFinish.Size = new System.Drawing.Size(1570, 675);
this.gridFinish.SysModel = null;
this.gridFinish.TabIndex = 29;
//
// splitBelow
//
this.splitBelow.Dock = System.Windows.Forms.DockStyle.Bottom;
this.splitBelow.Location = new System.Drawing.Point(0, 714);
this.splitBelow.Name = "splitBelow";
this.splitBelow.Panel1.Controls.Add(this.gridFlow);
this.splitBelow.Panel1.Text = "Panel1";
this.splitBelow.Panel2.Controls.Add(this.gridDetail);
this.splitBelow.Panel2.Text = "Panel2";
this.splitBelow.Size = new System.Drawing.Size(1570, 293);
this.splitBelow.SplitterPosition = 453;
this.splitBelow.TabIndex = 28;
this.splitBelow.Text = "splitContainerControl1";
//
// gridFlow
//
this.gridFlow.AdapterObj = null;
this.gridFlow.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridFlow.Location = new System.Drawing.Point(0, 0);
this.gridFlow.Margin = new System.Windows.Forms.Padding(4);
this.gridFlow.Name = "gridFlow";
this.gridFlow.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gridFlow.Size = new System.Drawing.Size(453, 293);
this.gridFlow.SysModel = null;
this.gridFlow.TabIndex = 19;
//
// gridDetail
//
this.gridDetail.AdapterObj = null;
this.gridDetail.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridDetail.Location = new System.Drawing.Point(0, 0);
this.gridDetail.Margin = new System.Windows.Forms.Padding(4);
this.gridDetail.Name = "gridDetail";
this.gridDetail.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gridDetail.Size = new System.Drawing.Size(1112, 293);
this.gridDetail.SysModel = null;
this.gridDetail.TabIndex = 20;
//
// pl_top
//
this.pl_top.Controls.Add(this.pl_top_searchCond);
@@ -256,41 +307,6 @@
this.pl_top.Size = new System.Drawing.Size(1570, 39);
this.pl_top.TabIndex = 25;
//
// pl_top_right
//
this.pl_top_right.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_top_right.Controls.Add(this.simpleButton1);
this.pl_top_right.Controls.Add(this.btnBack);
this.pl_top_right.Dock = System.Windows.Forms.DockStyle.Right;
this.pl_top_right.Location = new System.Drawing.Point(1305, 2);
this.pl_top_right.Name = "pl_top_right";
this.pl_top_right.Size = new System.Drawing.Size(263, 35);
this.pl_top_right.TabIndex = 24;
//
// btnBack
//
this.btnBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBack.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnBack.Appearance.Options.UseFont = true;
this.btnBack.Location = new System.Drawing.Point(100, 5);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(82, 26);
this.btnBack.TabIndex = 8;
this.btnBack.Text = "返审(&W)";
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// simpleButton1
//
this.simpleButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.simpleButton1.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.simpleButton1.Appearance.Options.UseFont = true;
this.simpleButton1.Location = new System.Drawing.Point(188, 5);
this.simpleButton1.Name = "simpleButton1";
this.simpleButton1.Size = new System.Drawing.Size(72, 26);
this.simpleButton1.TabIndex = 9;
this.simpleButton1.Text = "帮助文档";
this.simpleButton1.Click += new System.EventHandler(this.simpleButton1_Click);
//
// pl_top_searchCond
//
this.pl_top_searchCond.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
@@ -305,71 +321,6 @@
this.pl_top_searchCond.Size = new System.Drawing.Size(1303, 35);
this.pl_top_searchCond.TabIndex = 23;
//
// labeldate_end
//
this.labeldate_end.BackColor = System.Drawing.Color.Transparent;
this.labeldate_end.BackgroundColor = System.Drawing.Color.Empty;
this.labeldate_end.ContentBold = false;
this.labeldate_end.EditText = null;
this.labeldate_end.FontSize = 0F;
this.labeldate_end.LabelText = "终审时间止";
this.labeldate_end.Location = new System.Drawing.Point(216, 8);
this.labeldate_end.Margin = new System.Windows.Forms.Padding(4);
this.labeldate_end.Model = null;
this.labeldate_end.Name = "labeldate_end";
this.labeldate_end.NullText = null;
this.labeldate_end.ReadOnly = false;
this.labeldate_end.Required = false;
this.labeldate_end.Size = new System.Drawing.Size(196, 21);
this.labeldate_end.TabIndex = 12;
//
// btnSearch
//
this.btnSearch.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnSearch.Appearance.Options.UseFont = true;
this.btnSearch.Location = new System.Drawing.Point(774, 5);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(72, 26);
this.btnSearch.TabIndex = 6;
this.btnSearch.Text = "搜索(&Q)";
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// labeltxt_dataFlag
//
this.labeltxt_dataFlag.BackColor = System.Drawing.Color.Transparent;
this.labeltxt_dataFlag.BackgroundColor = System.Drawing.Color.Empty;
this.labeltxt_dataFlag.ContentBold = false;
this.labeltxt_dataFlag.EditText = "";
this.labeltxt_dataFlag.FontSize = 0F;
this.labeltxt_dataFlag.LabelText = "数据标识号";
this.labeltxt_dataFlag.Location = new System.Drawing.Point(605, 8);
this.labeltxt_dataFlag.Margin = new System.Windows.Forms.Padding(4);
this.labeltxt_dataFlag.Model = null;
this.labeltxt_dataFlag.Name = "labeltxt_dataFlag";
this.labeltxt_dataFlag.NullText = "";
this.labeltxt_dataFlag.ReadOnly = false;
this.labeltxt_dataFlag.Required = false;
this.labeltxt_dataFlag.Size = new System.Drawing.Size(164, 21);
this.labeltxt_dataFlag.TabIndex = 10;
//
// labelcheck_finalAuditor
//
this.labelcheck_finalAuditor.BackColor = System.Drawing.Color.Transparent;
this.labelcheck_finalAuditor.BackgroundColor = System.Drawing.Color.Empty;
this.labelcheck_finalAuditor.ContentBold = false;
this.labelcheck_finalAuditor.EditText = null;
this.labelcheck_finalAuditor.FontSize = 0F;
this.labelcheck_finalAuditor.LabelText = "终审人";
this.labelcheck_finalAuditor.Location = new System.Drawing.Point(419, 8);
this.labelcheck_finalAuditor.Margin = new System.Windows.Forms.Padding(4);
this.labelcheck_finalAuditor.Model = null;
this.labelcheck_finalAuditor.Name = "labelcheck_finalAuditor";
this.labelcheck_finalAuditor.NullText = null;
this.labelcheck_finalAuditor.ReadOnly = false;
this.labelcheck_finalAuditor.Required = false;
this.labelcheck_finalAuditor.Size = new System.Drawing.Size(180, 21);
this.labelcheck_finalAuditor.TabIndex = 13;
//
// labeldate_start
//
this.labeldate_start.BackColor = System.Drawing.Color.Transparent;
@@ -388,56 +339,105 @@
this.labeldate_start.Size = new System.Drawing.Size(196, 21);
this.labeldate_start.TabIndex = 11;
//
// splitBelow
// labelcheck_finalAuditor
//
this.splitBelow.Dock = System.Windows.Forms.DockStyle.Bottom;
this.splitBelow.Location = new System.Drawing.Point(0, 714);
this.splitBelow.Name = "splitBelow";
this.splitBelow.Panel1.Controls.Add(this.gridFlow);
this.splitBelow.Panel1.Text = "Panel1";
this.splitBelow.Panel2.Controls.Add(this.gridDetail);
this.splitBelow.Panel2.Text = "Panel2";
this.splitBelow.Size = new System.Drawing.Size(1570, 293);
this.splitBelow.SplitterPosition = 453;
this.splitBelow.TabIndex = 28;
this.splitBelow.Text = "splitContainerControl1";
this.labelcheck_finalAuditor.BackColor = System.Drawing.Color.Transparent;
this.labelcheck_finalAuditor.BackgroundColor = System.Drawing.Color.Empty;
this.labelcheck_finalAuditor.ContentBold = false;
this.labelcheck_finalAuditor.EditText = null;
this.labelcheck_finalAuditor.FontSize = 0F;
this.labelcheck_finalAuditor.LabelText = "终审人";
this.labelcheck_finalAuditor.Location = new System.Drawing.Point(419, 8);
this.labelcheck_finalAuditor.Margin = new System.Windows.Forms.Padding(4);
this.labelcheck_finalAuditor.Model = null;
this.labelcheck_finalAuditor.Name = "labelcheck_finalAuditor";
this.labelcheck_finalAuditor.NullText = null;
this.labelcheck_finalAuditor.ReadOnly = false;
this.labelcheck_finalAuditor.Required = false;
this.labelcheck_finalAuditor.Size = new System.Drawing.Size(180, 21);
this.labelcheck_finalAuditor.TabIndex = 13;
//
// gridDetail
// labeltxt_dataFlag
//
this.gridDetail.AdapterObj = null;
this.gridDetail.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridDetail.Location = new System.Drawing.Point(0, 0);
this.gridDetail.Margin = new System.Windows.Forms.Padding(4);
this.gridDetail.Name = "gridDetail";
this.gridDetail.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gridDetail.Size = new System.Drawing.Size(1112, 293);
this.gridDetail.SysModel = null;
this.gridDetail.TabIndex = 20;
this.labeltxt_dataFlag.BackColor = System.Drawing.Color.Transparent;
this.labeltxt_dataFlag.BackgroundColor = System.Drawing.Color.Empty;
this.labeltxt_dataFlag.ContentBold = false;
this.labeltxt_dataFlag.EditText = "";
this.labeltxt_dataFlag.FontSize = 0F;
this.labeltxt_dataFlag.LabelText = "数据标识号";
this.labeltxt_dataFlag.Location = new System.Drawing.Point(605, 8);
this.labeltxt_dataFlag.Margin = new System.Windows.Forms.Padding(4);
this.labeltxt_dataFlag.Model = null;
this.labeltxt_dataFlag.Name = "labeltxt_dataFlag";
this.labeltxt_dataFlag.NullText = "";
this.labeltxt_dataFlag.ReadOnly = false;
this.labeltxt_dataFlag.Required = false;
this.labeltxt_dataFlag.Size = new System.Drawing.Size(164, 21);
this.labeltxt_dataFlag.TabIndex = 10;
//
// gridFlow
// btnSearch
//
this.gridFlow.AdapterObj = null;
this.gridFlow.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridFlow.Location = new System.Drawing.Point(0, 0);
this.gridFlow.Margin = new System.Windows.Forms.Padding(4);
this.gridFlow.Name = "gridFlow";
this.gridFlow.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gridFlow.Size = new System.Drawing.Size(453, 293);
this.gridFlow.SysModel = null;
this.gridFlow.TabIndex = 19;
this.btnSearch.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnSearch.Appearance.Options.UseFont = true;
this.btnSearch.Location = new System.Drawing.Point(774, 5);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(72, 26);
this.btnSearch.TabIndex = 6;
this.btnSearch.Text = "搜索(Q)";
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// gridFinish
// labeldate_end
//
this.gridFinish.AdapterObj = null;
this.gridFinish.AutoSize = true;
this.gridFinish.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridFinish.Location = new System.Drawing.Point(0, 39);
this.gridFinish.Margin = new System.Windows.Forms.Padding(4);
this.gridFinish.Name = "gridFinish";
this.gridFinish.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gridFinish.Size = new System.Drawing.Size(1570, 675);
this.gridFinish.SysModel = null;
this.gridFinish.TabIndex = 29;
this.labeldate_end.BackColor = System.Drawing.Color.Transparent;
this.labeldate_end.BackgroundColor = System.Drawing.Color.Empty;
this.labeldate_end.ContentBold = false;
this.labeldate_end.EditText = null;
this.labeldate_end.FontSize = 0F;
this.labeldate_end.LabelText = "终审时间止";
this.labeldate_end.Location = new System.Drawing.Point(216, 8);
this.labeldate_end.Margin = new System.Windows.Forms.Padding(4);
this.labeldate_end.Model = null;
this.labeldate_end.Name = "labeldate_end";
this.labeldate_end.NullText = null;
this.labeldate_end.ReadOnly = false;
this.labeldate_end.Required = false;
this.labeldate_end.Size = new System.Drawing.Size(196, 21);
this.labeldate_end.TabIndex = 12;
//
// pl_top_right
//
this.pl_top_right.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_top_right.Controls.Add(this.simpleButton1);
this.pl_top_right.Controls.Add(this.btnBack);
this.pl_top_right.Dock = System.Windows.Forms.DockStyle.Right;
this.pl_top_right.Location = new System.Drawing.Point(1305, 2);
this.pl_top_right.Name = "pl_top_right";
this.pl_top_right.Size = new System.Drawing.Size(263, 35);
this.pl_top_right.TabIndex = 24;
//
// simpleButton1
//
this.simpleButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.simpleButton1.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.simpleButton1.Appearance.Options.UseFont = true;
this.simpleButton1.Location = new System.Drawing.Point(188, 5);
this.simpleButton1.Name = "simpleButton1";
this.simpleButton1.Size = new System.Drawing.Size(72, 26);
this.simpleButton1.TabIndex = 9;
this.simpleButton1.Text = "帮助文档";
this.simpleButton1.Click += new System.EventHandler(this.simpleButton1_Click);
//
// btnBack
//
this.btnBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBack.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnBack.Appearance.Options.UseFont = true;
this.btnBack.Location = new System.Drawing.Point(100, 5);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(82, 26);
this.btnBack.TabIndex = 8;
this.btnBack.Text = "返审(W)";
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// tabMain
//
@@ -470,14 +470,14 @@
((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit();
this.tabpage_finish.ResumeLayout(false);
this.tabpage_finish.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_top)).EndInit();
this.pl_top.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_top_right)).EndInit();
this.pl_top_right.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_top_searchCond)).EndInit();
this.pl_top_searchCond.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitBelow)).EndInit();
this.splitBelow.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_top)).EndInit();
this.pl_top.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_top_searchCond)).EndInit();
this.pl_top_searchCond.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_top_right)).EndInit();
this.pl_top_right.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.tabMain)).EndInit();
this.tabMain.ResumeLayout(false);
this.ResumeLayout(false);
+20 -1
View File
@@ -42,10 +42,29 @@ namespace Lskj.Control
public partial class AuditPanelEx : UserControl
{
private bool mResourcesReleased;
private readonly AltButtonShortcutManager mAltButtonShortcuts =
new AltButtonShortcutManager();
public AuditPanelEx()
{
InitializeComponent();
InitializeAltButtonShortcuts();
}
private void InitializeAltButtonShortcuts()
{
mAltButtonShortcuts.Register(btnOkAudit, Keys.Y);
mAltButtonShortcuts.Register(btnBackAudit, Keys.B);
mAltButtonShortcuts.Register(btnRefresh, Keys.R);
mAltButtonShortcuts.Register(btnBack, Keys.W);
mAltButtonShortcuts.Register(btnSearch, Keys.Q);
}
protected override bool ProcessCmdKey(
ref System.Windows.Forms.Message msg, Keys keyData)
{
return mAltButtonShortcuts.ProcessKey(keyData) ||
base.ProcessCmdKey(ref msg, keyData);
}
internal void ReleaseResourcesForDispose()
@@ -94,7 +113,7 @@ namespace Lskj.Control
{
if (SysModel != null && SysModel.DataCaches != null)
{
SysModel.DataCaches.Remove(this);
SysModel.DataCaches.RemoveCache(this);
}
}
catch
+4 -2
View File
@@ -75,12 +75,14 @@ namespace Lskj.Control
case ControlType.LabDate:
case ControlType.LabDateTime:
case ControlType.LabDateTimeShort:
case ControlType.LabTime:
case ControlType.LabShortTime:
// 日期控件
LabelDateEdit dateEdit = this as LabelDateEdit;
UpdContrast = dateEdit.TextEdit.EditValue == null ? dateEdit.EditText : dateEdit.TextEdit.EditValue.ToString();
break;
case ControlType.LabTime:
case ControlType.LabShortTime:
LabelTimeEdit timeEdit = this as LabelTimeEdit;
return timeEdit != null && !timeEdit.IsSameTime(this.Model.Text);
}
return this.Model == null || this.Model.Text == null || !this.Model.Text.Equals(UpdContrast, StringComparison.OrdinalIgnoreCase);
}
+62 -111
View File
@@ -78,17 +78,17 @@ namespace Lskj.Control.BrowserSetting
string arg2 = message.Arguments.GetString(2);
string arg3 = message.Arguments.GetString(3);
string arg4 = message.Arguments.GetString(4);
PostToUiThread(
ERPInfo.Instance.MainControl,
delegate
if (ERPInfo.Instance.MainControl.InvokeRequired)
{
ERPInfo.Instance.MainControl.Invoke(new Action(() =>
{
BsOpenModuleHandler.OpenModule(
arg0,
arg1,
arg2,
arg3,
arg4);
});
BsOpenModuleHandler.OpenModule(arg0, arg1, arg2, arg3, arg4);
}));
}
else
{
BrowserSetting.BsOpenModuleHandler.OpenModule(arg0, arg1, arg2, arg3, arg4);
}
}
else if (message.Name.Equals("OpenOnRightClick"))
{
@@ -96,103 +96,75 @@ namespace Lskj.Control.BrowserSetting
string arg1 = message.Arguments.GetString(1);
string arg2 = message.Arguments.GetString(2);
string arg3 = message.Arguments.GetString(3);
PostToUiThread(
ERPInfo.Instance.MainControl,
delegate
if (ERPInfo.Instance.MainControl.InvokeRequired)
{
ERPInfo.Instance.MainControl.Invoke(new Action(() =>
{
BsOpenModuleHandler.OpenRightModule(
arg0,
arg1,
arg2,
arg3);
});
BsOpenModuleHandler.OpenRightModule(arg0, arg1, arg2, arg3);
}));
}
else
{
BsOpenModuleHandler.OpenRightModule(arg0, arg1, arg2, arg3);
}
}
else if (message.Name.Equals("CloseWin"))
{
var browserControl = frmWebBrowser;
PostToUiThread(
browserControl,
delegate
if (frmWebBrowser != null && frmWebBrowser.Parent != null && frmWebBrowser.Parent.Parent != null && frmWebBrowser.Parent.Parent is BaseForm baseForm)
{
if (baseForm.InvokeRequired)
{
baseForm.Invoke(new Action(() =>
{
baseForm.DialogResult = DialogResult.OK;
baseForm.Close();
}));
}
else
{
// Parent/Parent is a WinForms control-tree read and must
// not run on CEF's UI thread.
var parent = browserControl.Parent;
var baseForm = parent == null
? null
: parent.Parent as BaseForm;
if (baseForm == null || baseForm.IsDisposed)
return;
baseForm.DialogResult = DialogResult.OK;
baseForm.Close();
});
}
}
}
else if (message.Name.Equals("SelectPro"))
{
string arg0 = message.Arguments.GetString(0);
string arg1 = message.Arguments.GetString(1);
bool isclose = arg1!=null&&!string.IsNullOrWhiteSpace(arg1) && arg1.Equals("1") ? true : false;
var browserControl = frmWebBrowser;
PostToUiThread(
browserControl,
delegate
if (frmWebBrowser != null && frmWebBrowser.Parent != null && frmWebBrowser.Parent.Parent != null && frmWebBrowser.Parent.Parent is BaseForm baseForm)
{
if (baseForm.InvokeRequired)
{
baseForm.Invoke(new Action(() =>
{
BsOpenModuleHandler.AddReturnRow(arg0);
if (isclose)
{
baseForm.DialogResult = DialogResult.OK;
baseForm.Close();
}
}));
}
else
{
var parent = browserControl.Parent;
var baseForm = parent == null
? null
: parent.Parent as BaseForm;
if (baseForm == null || baseForm.IsDisposed)
return;
BsOpenModuleHandler.AddReturnRow(arg0);
if (isclose)
if (isclose)
{
baseForm.DialogResult = DialogResult.OK;
baseForm.Close();
}
});
}
}
}
}
return base.OnProcessMessageReceived(browser, frame, sourceProcess, message);
}
private static void PostToUiThread(
System.Windows.Forms.Control control,
Action action)
{
if (control == null || action == null || control.IsDisposed ||
!control.IsHandleCreated)
return;
Action guardedAction = delegate
{
if (control.IsDisposed)
return;
try
{
action();
}
catch (Exception exception)
{
ReportProcessMessageFailure(exception);
}
};
try
{
// CEF invokes OnProcessMessageReceived on its UI thread. A
// synchronous Control.Invoke can block that thread inside a
// modal dialog while the dialog waits for CEF to create its
// browser. Always queue the operation and return to CEF first.
control.BeginInvoke(guardedAction);
}
catch (Exception exception)
{
ReportProcessMessageFailure(exception);
}
}
private static void ReportProcessMessageFailure(Exception exception)
{
try
@@ -201,10 +173,10 @@ namespace Lskj.Control.BrowserSetting
}
catch
{
// Never propagate logging failures into a native CEF callback.
// Logging must never rethrow across the native CEF callback.
}
Action showError = delegate
Action showError = () =>
{
try
{
@@ -212,14 +184,14 @@ namespace Lskj.Control.BrowserSetting
}
catch
{
// Error reporting must never terminate the browser callback.
}
};
try
{
System.Windows.Forms.Control mainControl = ERPInfo.Instance.MainControl;
if (mainControl == null || mainControl.IsDisposed ||
!mainControl.IsHandleCreated)
if (mainControl == null || mainControl.IsDisposed || !mainControl.IsHandleCreated)
return;
if (mainControl.InvokeRequired)
@@ -229,36 +201,15 @@ namespace Lskj.Control.BrowserSetting
}
catch
{
// The main window may close while the callback is reporting.
// The main window may close while the CEF callback is reporting.
}
}
public void Created(CefBrowser cefBrowser)
{
if (frmWebBrowser != null && OnCreated != null)
if (OnCreated != null)
{
OnCreated(cefBrowser, EventArgs.Empty);
}
}
public bool Closing(CefBrowser browser)
{
var control = frmWebBrowser;
return control != null && control.BrowserClosing(browser);
}
public void Closed(CefBrowser browser)
{
var control = frmWebBrowser;
if (control != null)
{
control.BrowserClosed(browser);
if (control.cefBrowserSettings == null)
{
frmWebBrowser = null;
OnCreated = null;
}
}
}
}
}
@@ -42,7 +42,7 @@ namespace Lskj.Control.BrowserSetting
}
if (BsClient != null && BsClient.frmWebBrowser != null && BsClient.frmWebBrowser.Parent != null && BsClient.frmWebBrowser.Parent.Name.Equals("previewFrm"))
{
BsClient.frmWebBrowser.CloseBrowser();
browser.GetHost().CloseBrowser();
}
else if (BsClient != null && BsClient.frmWebBrowser != null)
{
@@ -196,24 +196,11 @@ namespace Lskj.Control.BrowserSetting
try
{
if (browser == null) return null;
IntPtr browserHandle;
using (var browserHost = browser.GetHost())
{
browserHandle = browserHost.GetWindowHandle();
}
IntPtr browserHandle = browser.GetHost().GetWindowHandle();
if (browserHandle == IntPtr.Zero) return null;
IntPtr parentHandle = GetParent(browserHandle);
System.Windows.Forms.Control control = null;
while (parentHandle != IntPtr.Zero && control == null)
{
// The CEF child now sits inside an application-owned native
// host. Walk through that host to preserve the original
// FrmWebBrowser-based module lookup.
control = System.Windows.Forms.Control.FromHandle(parentHandle);
parentHandle = GetParent(parentHandle);
}
if (control == null) return null;
if (parentHandle == IntPtr.Zero) return null;
System.Windows.Forms.Control control = System.Windows.Forms.Control.FromHandle(parentHandle);
if (control != null && control.Parent != null && control.Parent.Parent != null)
{
@@ -20,20 +20,9 @@ namespace Lskj.Control.BrowserSetting
base.OnAfterCreated(browser);
BsClient.Created(browser);
}
protected override bool DoClose(CefBrowser browser)
{
// CEF sends WM_CLOSE to the parked application-owned host after
// this callback. The host only allows that second close attempt.
return BsClient.Closing(browser);
}
protected override void OnBeforeClose(CefBrowser browser)
{
base.OnBeforeClose(browser);
// Release owner references after CEF completes its async close.
BsClient.Closed(browser);
}
protected override bool OnBeforePopup(
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xilium.CefGlue;
using Lskj.Business;
namespace Lskj.Control.BrowserSetting
{
@@ -47,12 +46,7 @@ namespace Lskj.Control.BrowserSetting
protected override void OnRenderProcessTerminated(CefBrowser browser, CefTerminationStatus status)
{
// Reloading immediately from this callback can create a new
// renderer while the old one is tearing down and cause a native
// libcef crash loop. Record the termination and let the module
// lifecycle decide whether a later reopen is appropriate.
LogUtil.WriteError("CEF 渲染进程已终止,状态=" + status,
new InvalidOperationException("CEF renderer termination status=" + status));
browser.Reload();
}
}
@@ -1,6 +1,5 @@
using Lskj.Business;
using Lskj.Model;
using Lskj.Util;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -55,19 +54,6 @@ namespace Lskj.Control.BrowserSetting2
return contextMenuHandler;
}
protected override bool OnProcessMessageReceived(CefBrowser browser, CefFrame frame, CefProcessId sourceProcess, CefProcessMessage message)
{
try
{
return OnProcessMessageReceivedCore(browser, frame, sourceProcess, message);
}
catch (Exception exception)
{
ReportProcessMessageFailure(exception);
return true;
}
}
private bool OnProcessMessageReceivedCore(CefBrowser browser, CefFrame frame, CefProcessId sourceProcess, CefProcessMessage message)
{
if (message.Name.Equals("OpenModule"))
{
@@ -76,17 +62,17 @@ namespace Lskj.Control.BrowserSetting2
string arg2 = message.Arguments.GetString(2);
string arg3 = message.Arguments.GetString(3);
string arg4 = message.Arguments.GetString(4);
PostToUiThread(
ERPInfo.Instance.MainControl,
delegate
if (ERPInfo.Instance.MainControl.InvokeRequired)
{
ERPInfo.Instance.MainControl.Invoke(new Action(() =>
{
BrowserSetting.BsOpenModuleHandler.OpenModule(
arg0,
arg1,
arg2,
arg3,
arg4);
});
BrowserSetting.BsOpenModuleHandler.OpenModule(arg0, arg1, arg2, arg3, arg4);
}));
}
else
{
BrowserSetting.BsOpenModuleHandler.OpenModule(arg0, arg1, arg2, arg3, arg4);
}
}
else if (message.Name.Equals("OpenOnRightClick"))
{
@@ -94,140 +80,43 @@ namespace Lskj.Control.BrowserSetting2
string arg1 = message.Arguments.GetString(1);
string arg2 = message.Arguments.GetString(2);
string arg3 = message.Arguments.GetString(3);
PostToUiThread(
ERPInfo.Instance.MainControl,
delegate
if (ERPInfo.Instance.MainControl.InvokeRequired)
{
ERPInfo.Instance.MainControl.Invoke(new Action(() =>
{
BrowserSetting.BsOpenModuleHandler.OpenRightModule(
arg0,
arg1,
arg2,
arg3);
});
BrowserSetting.BsOpenModuleHandler.OpenRightModule(arg0, arg1, arg2, arg3);
}));
}
else
{
BrowserSetting.BsOpenModuleHandler.OpenRightModule(arg0, arg1, arg2, arg3);
}
}
else if (message.Name.Equals("CloseWin"))
{
var browserControl = frmWebBrowser;
PostToUiThread(
browserControl,
delegate
if (frmWebBrowser != null && frmWebBrowser.Parent != null && frmWebBrowser.Parent.Parent != null && frmWebBrowser.Parent.Parent is BaseForm baseForm)
{
if (baseForm.InvokeRequired)
{
baseForm.Invoke(new Action(() =>
{
baseForm.Close();
}));
}
else
{
// Resolve the owning form only after returning to the
// WinForms UI thread.
var parent = browserControl.Parent;
var baseForm = parent == null
? null
: parent.Parent as BaseForm;
if (baseForm == null || baseForm.IsDisposed)
return;
baseForm.Close();
});
}
}
}
return base.OnProcessMessageReceived(browser, frame, sourceProcess, message);
}
private static void PostToUiThread(
System.Windows.Forms.Control control,
Action action)
{
if (control == null || action == null || control.IsDisposed ||
!control.IsHandleCreated)
return;
Action guardedAction = delegate
{
if (control.IsDisposed)
return;
try
{
action();
}
catch (Exception exception)
{
ReportProcessMessageFailure(exception);
}
};
try
{
// Never keep CEF's UI thread blocked while WinForms opens a
// modal module that may create another CEF browser.
control.BeginInvoke(guardedAction);
}
catch (Exception exception)
{
ReportProcessMessageFailure(exception);
}
}
private static void ReportProcessMessageFailure(Exception exception)
{
try
{
LogHelper.Instance.WriteError(exception);
}
catch
{
// Never propagate logging failures into a native CEF callback.
}
Action showError = delegate
{
try
{
MessageUtil.Show(exception);
}
catch
{
}
};
try
{
System.Windows.Forms.Control mainControl = ERPInfo.Instance.MainControl;
if (mainControl == null || mainControl.IsDisposed ||
!mainControl.IsHandleCreated)
return;
if (mainControl.InvokeRequired)
mainControl.BeginInvoke(showError);
else
showError();
}
catch
{
// The main window may close while the callback is reporting.
}
}
public void Created(CefBrowser cefBrowser)
{
if (frmWebBrowser != null && OnCreated != null)
if (OnCreated != null)
{
OnCreated(cefBrowser, EventArgs.Empty);
}
}
public bool Closing(CefBrowser browser)
{
var control = frmWebBrowser;
return control != null && control.BrowserClosing(browser);
}
public void Closed(CefBrowser browser)
{
var control = frmWebBrowser;
if (control != null)
{
control.BrowserClosed(browser);
if (control.cefBrowserSettings == null)
{
frmWebBrowser = null;
OnCreated = null;
}
}
}
}
}
@@ -20,20 +20,9 @@ namespace Lskj.Control.BrowserSetting2
base.OnAfterCreated(browser);
BsClient.Created(browser);
}
protected override bool DoClose(CefBrowser browser)
{
// CEF sends WM_CLOSE to the parked application-owned host after
// this callback. The host only allows that second close attempt.
return BsClient.Closing(browser);
}
protected override void OnBeforeClose(CefBrowser browser)
{
base.OnBeforeClose(browser);
// Release owner references after CEF completes its async close.
BsClient.Closed(browser);
}
protected override bool OnBeforePopup(
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xilium.CefGlue;
using Lskj.Business;
namespace Lskj.Control.BrowserSetting2
{
@@ -47,9 +46,7 @@ namespace Lskj.Control.BrowserSetting2
protected override void OnRenderProcessTerminated(CefBrowser browser, CefTerminationStatus status)
{
// Do not start a new renderer during native teardown.
LogUtil.WriteError("CEF 渲染进程已终止,状态=" + status,
new InvalidOperationException("CEF renderer termination status=" + status));
browser.Reload();
}
}
-2
View File
@@ -14,8 +14,6 @@ namespace Lskj.Control
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing)
CloseBrowserForDispose();
if (disposing && (components != null))
{
components.Dispose();
-39
View File
@@ -109,45 +109,6 @@ namespace Lskj.Control
cefBrowserSettings.GetMainFrame().LoadUrl(webResponse.ResponseUri.AbsoluteUri);
}
}
internal bool BrowserClosing(CefBrowser browser)
{
return false;
}
internal void BrowserClosed(CefBrowser browser)
{
var currentBrowser = cefBrowserSettings;
if (currentBrowser == null || browser == null)
return;
bool sameBrowser = ReferenceEquals(currentBrowser, browser);
if (!sameBrowser)
{
try
{
sameBrowser = currentBrowser.IsSame(browser);
}
catch (Exception)
{
}
}
if (sameBrowser)
Interlocked.CompareExchange(ref cefBrowserSettings, null, currentBrowser);
}
internal void CloseBrowser()
{
var browser = cefBrowserSettings;
if (browser != null)
browser.GetHost().CloseBrowser();
}
private void CloseBrowserForDispose()
{
}
public static string ToEnUrl(string url)
{
string[] urlParams = url.Split('?');
-2
View File
@@ -14,8 +14,6 @@ namespace Lskj.Control
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing)
CloseBrowserForDispose();
if (disposing && (components != null))
{
components.Dispose();
-39
View File
@@ -126,45 +126,6 @@ namespace Lskj.Control
cefBrowserSettings.GetMainFrame().LoadUrl(webResponse.ResponseUri.AbsoluteUri);
}
}
internal bool BrowserClosing(CefBrowser browser)
{
return false;
}
internal void BrowserClosed(CefBrowser browser)
{
var currentBrowser = cefBrowserSettings;
if (currentBrowser == null || browser == null)
return;
bool sameBrowser = ReferenceEquals(currentBrowser, browser);
if (!sameBrowser)
{
try
{
sameBrowser = currentBrowser.IsSame(browser);
}
catch (Exception)
{
}
}
if (sameBrowser)
Interlocked.CompareExchange(ref cefBrowserSettings, null, currentBrowser);
}
internal void CloseBrowser()
{
var browser = cefBrowserSettings;
if (browser != null)
browser.GetHost().CloseBrowser();
}
private void CloseBrowserForDispose()
{
}
public static string ToEnUrl(string url)
{
string[] urlParams = url.Split('?');
+28
View File
@@ -637,6 +637,11 @@ namespace Lskj.Control
}
_gridResourcesDisposed = true;
if (cellHelper != null)
{
cellHelper.Dispose();
cellHelper = null;
}
StopColumnSourceTimer();
if (mTimer != null)
{
@@ -4239,6 +4244,29 @@ namespace Lskj.Control
RepositoryItemTimeEdit timeEdit = new RepositoryItemTimeEdit();
timeEdit.DisplayFormat.FormatString = timeEdit.EditFormat.FormatString = timeEdit.Mask.EditMask = DateFormat.Format(fieldType);
timeEdit.DisplayFormat.FormatType = timeEdit.EditFormat.FormatType = DevExpress.Utils.FormatType.Custom;
timeEdit.ParseEditValue += delegate(object sender, ConvertEditValueEventArgs e)
{
// SQL Server 的 time 字段在 DataTable 中是 TimeSpanTimeEdit 输入后返回 DateTime。
// 只转换 TimeSpan 绑定列,不改变原有 DateTime 类型列的行为。
if (gridColumn.ColumnType != typeof(TimeSpan) || e.Value == null || e.Value == DBNull.Value)
{
return;
}
if (e.Value is DateTime)
{
e.Value = ((DateTime)e.Value).TimeOfDay;
e.Handled = true;
return;
}
TimeSpan timeValue;
if (!(e.Value is TimeSpan) && TimeSpan.TryParse(e.Value.ToString(), out timeValue))
{
e.Value = timeValue;
e.Handled = true;
}
};
@@ -12,10 +12,15 @@ using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
// Token: 0x02000003 RID: 3
public class AmountCellRender
public class AmountCellRender : IDisposable
{
public AmountCellRender(GridView gridView_0)
{
if (gridView_0 == null)
{
throw new ArgumentNullException("gridView_0");
}
Class5.gBkiB4AzUqwkh();
this.colorGray = Color.FromArgb(189, 185, 185);
this.colorGreen = Color.Green;
@@ -25,23 +30,58 @@ public class AmountCellRender
this.dictionary_0 = new Dictionary<string, Class2>();
this.list_0 = new List<GridColumn>();
this.object_0 = gridView_0;
this.gridControl_0 = this.object_0.GridControl;
this.object_0.CustomDrawCell += this.object_0_CustomDrawCell;
this.object_0.CustomDrawColumnHeader += this.object_0_CustomDrawColumnHeader;
this.object_0.CustomDrawFooterCell += this.object_0_CustomDrawFooterCell;
this.object_0.GridControl.Paint += this.method_0;
if (this.gridControl_0 != null)
{
this.gridControl_0.Paint += this.method_0;
}
}
private void method_0(object sender, PaintEventArgs e)
{
BaseViewInfo viewInfo = ((sender as GridControl).FocusedView as GridView).GetViewInfo();
if (this.disposed || this.list_0.Count == 0)
{
return;
}
GridControl gridControl = sender as GridControl;
if (gridControl == null || gridControl.IsDisposed || gridControl.Disposing)
{
return;
}
GridView gridView = gridControl.FocusedView as GridView;
if (gridView == null)
{
return;
}
GridViewInfo gridViewInfo = gridView.GetViewInfo() as GridViewInfo;
if (gridViewInfo == null || gridViewInfo.ColumnsInfo == null)
{
return;
}
foreach (GridColumn gridColumn in this.list_0)
{
Class2 @class = this.dictionary_0[gridColumn.Name];
Class2 @class;
if (gridColumn == null ||
!this.dictionary_0.TryGetValue(gridColumn.Name, out @class) ||
@class == null)
{
continue;
}
if (@class.IsCountinuousCell())
{
GridViewInfo gridViewInfo = viewInfo as GridViewInfo;
GridColumnInfoArgs gridColumnInfoArgs = gridViewInfo.ColumnsInfo[gridColumn];
if (gridColumnInfoArgs == null) return;
if (gridColumnInfoArgs == null)
{
continue;
}
int num = 0;
int int_;
if (@class.method_4())
@@ -82,10 +122,16 @@ public class AmountCellRender
private void object_0_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
{
if (this.dictionary_0.ContainsKey(e.Column.Name))
if (this.disposed || e.Column == null)
{
return;
}
Class2 @class;
if (this.dictionary_0.TryGetValue(e.Column.Name, out @class) &&
@class != null)
{
e.DisplayText = "";
Class2 @class = this.dictionary_0[e.Column.Name];
Rectangle bounds = e.Bounds;
Rectangle rectangle_ = bounds;
Graphics graphics = e.Graphics;
@@ -98,14 +144,20 @@ public class AmountCellRender
private void object_0_CustomDrawFooterCell(object sender, FooterCellCustomDrawEventArgs e)
{
if (this.dictionary_0.ContainsKey(e.Column.Name))
if (this.disposed || e.Column == null)
{
return;
}
Class2 @class;
if (this.dictionary_0.TryGetValue(e.Column.Name, out @class) &&
@class != null)
{
Class2 @class = this.dictionary_0[e.Column.Name];
if (@class.method_8())
{
e.Info.DisplayText = "";
Rectangle bounds = e.Bounds;
@class.method_17(bounds, e.Graphics, e.Appearance.Font, e.Info.Value.ToString());
@class.method_17(bounds, e.Graphics, e.Appearance.Font, Convert.ToString(e.Info.Value));
e.Handled = true;
}
}
@@ -113,13 +165,15 @@ public class AmountCellRender
private void object_0_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
{
if (e.Column == null)
if (this.disposed || e.Column == null)
{
return;
}
if (this.dictionary_0.ContainsKey(e.Column.Name))
Class2 @class;
if (this.dictionary_0.TryGetValue(e.Column.Name, out @class) &&
@class != null)
{
Class2 @class = this.dictionary_0[e.Column.Name];
if (@class.method_6())
{
e.Column.Caption = "";
@@ -204,14 +258,44 @@ public class AmountCellRender
public void RemoveAmountColumn(GridColumn gridColumn_0)
{
if (this.dictionary_0.ContainsKey(gridColumn_0.Name))
if (gridColumn_0 != null && this.dictionary_0.ContainsKey(gridColumn_0.Name))
{
this.dictionary_0.Remove(gridColumn_0.Name);
this.list_0.Remove(gridColumn_0);
}
}
public void Dispose()
{
if (this.disposed)
{
return;
}
this.disposed = true;
GridView gridView = this.object_0;
GridControl gridControl = this.gridControl_0;
this.object_0 = null;
this.gridControl_0 = null;
if (gridView != null)
{
gridView.CustomDrawCell -= this.object_0_CustomDrawCell;
gridView.CustomDrawColumnHeader -= this.object_0_CustomDrawColumnHeader;
gridView.CustomDrawFooterCell -= this.object_0_CustomDrawFooterCell;
}
if (gridControl != null)
{
gridControl.Paint -= this.method_0;
}
this.dictionary_0.Clear();
this.list_0.Clear();
}
private GridView object_0;
private GridControl gridControl_0;
private bool disposed;
private Color colorGray;
private Color colorGreen;
+9 -3
View File
@@ -255,7 +255,10 @@ public class Class2
if (color != Color.Empty)
{
Rectangle rect = new Rectangle(rectangle_0.Left + i - 2, int_2, int_1, int_3);
graphics_0.FillRectangle(new SolidBrush(color), rect);
using (SolidBrush solidBrush = new SolidBrush(color))
{
graphics_0.FillRectangle(solidBrush, rect);
}
}
}
else
@@ -265,9 +268,12 @@ public class Class2
num++;
}
Rectangle rect2 = new Rectangle(rectangle_0.Left - 1, int_2, int_1 + 1, int_3);
graphics_0.FillRectangle(new SolidBrush(Color.FromArgb(161, 157, 157)), rect2);
Rectangle rect3 = new Rectangle(rectangle_0.Left + rectangle_0.Width - 1, int_2, int_1 + 1, int_3);
graphics_0.FillRectangle(new SolidBrush(Color.FromArgb(161, 157, 157)), rect3);
using (SolidBrush solidBrush = new SolidBrush(Color.FromArgb(161, 157, 157)))
{
graphics_0.FillRectangle(solidBrush, rect2);
graphics_0.FillRectangle(solidBrush, rect3);
}
}
// Token: 0x06000028 RID: 40 RVA: 0x00002CC8 File Offset: 0x00000EC8
+252
View File
@@ -0,0 +1,252 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.XtraEditors;
namespace Lskj.Control
{
/// <summary>
/// 带标题的时间输入控件,使用上下按钮调整时间。
/// </summary>
public class LabelTimeEdit : BaseUserControl
{
private readonly Panel plLeft;
private readonly Panel plRight;
private readonly Label lblText;
private readonly TimeEdit txtEdit;
private string formatString = "HH:mm:ss";
public LabelTimeEdit()
{
plLeft = new Panel();
plRight = new Panel();
lblText = new Label();
txtEdit = new TimeEdit();
SuspendLayout();
plLeft.SuspendLayout();
plRight.SuspendLayout();
((System.ComponentModel.ISupportInitialize)txtEdit.Properties).BeginInit();
plLeft.BackColor = Color.Transparent;
plLeft.Controls.Add(lblText);
plLeft.Dock = DockStyle.Left;
plLeft.Size = new Size(40, 21);
lblText.AutoSize = true;
lblText.Location = new Point(5, 4);
lblText.Text = "名称";
plRight.Controls.Add(txtEdit);
plRight.Dock = DockStyle.Fill;
plRight.Location = new Point(40, 0);
txtEdit.Dock = DockStyle.Fill;
txtEdit.EditValue = null;
txtEdit.Properties.Buttons.Clear();
txtEdit.Properties.Buttons.Add(new DevExpress.XtraEditors.Controls.EditorButton(
DevExpress.XtraEditors.Controls.ButtonPredefines.Combo));
txtEdit.Properties.TimeEditStyle = DevExpress.XtraEditors.Repository.TimeEditStyle.SpinButtons;
AutoScaleMode = AutoScaleMode.None;
BackColor = Color.Transparent;
Controls.Add(plRight);
Controls.Add(plLeft);
Size = new Size(162, 21);
((System.ComponentModel.ISupportInitialize)txtEdit.Properties).EndInit();
plRight.ResumeLayout(false);
plLeft.ResumeLayout(false);
plLeft.PerformLayout();
ResumeLayout(false);
}
/// <summary>
/// 时间编辑器。
/// </summary>
public TimeEdit TextEdit
{
get { return txtEdit; }
}
public override string LabelText
{
get { return lblText.Text; }
set
{
lblText.Text = value;
if (FontSize > 0)
{
plLeft.AutoSize = false;
lblText.AutoSize = false;
lblText.Dock = DockStyle.Fill;
lblText.Location = new Point(0, 0);
lblText.TextAlign = ContentAlignment.MiddleLeft;
txtEdit.Properties.AutoHeight = false;
plLeft.Width = value.Length * GetCharWidth();
GetCharWidthMultilingual(lblText, lblText.Text, plLeft);
}
else
{
plLeft.Width = lblText.Width + PaddingLeft;
}
}
}
public override float FontSize
{
get { return base.FontSize; }
set
{
base.FontSize = value;
if (value > 0)
{
lblText.Font = new Font(lblText.Font.FontFamily, value);
txtEdit.Font = new Font(txtEdit.Font.FontFamily, value);
}
}
}
public override string EditText
{
get { return txtEdit.EditValue == null ? string.Empty : txtEdit.Text; }
set
{
TimeSpan timeValue;
txtEdit.EditValue = TryGetTime(value, out timeValue)
? (object)DateTime.Today.Add(timeValue)
: null;
}
}
public override string NullText
{
get { return txtEdit.Properties.NullValuePrompt; }
set
{
if (!string.IsNullOrEmpty(value))
{
txtEdit.Properties.NullValuePromptShowForEmptyValue = true;
txtEdit.Properties.NullValuePrompt = value;
}
base.NullText = value;
}
}
public override bool ReadOnly
{
get { return base.ReadOnly; }
set
{
base.ReadOnly = value;
txtEdit.Properties.ReadOnly = value;
txtEdit.Enabled = !value;
lblText.ForeColor = value ? ReadOnlyLabelForceColor : Required ? RequiredLabelForceColor : DefaultLabelForceColor;
}
}
public override bool Required
{
get { return base.Required; }
set
{
base.Required = value;
if (value)
{
lblText.ForeColor = RequiredLabelForceColor;
}
}
}
public override Color BackgroundColor
{
get { return txtEdit.Properties.Appearance.BackColor; }
set { txtEdit.Properties.Appearance.BackColor = value; }
}
public override Color ForeColor
{
get { return txtEdit.Properties.Appearance.ForeColor; }
set { txtEdit.Properties.Appearance.ForeColor = value; }
}
public override bool ContentBold
{
get { return txtEdit.Properties.Appearance.Font.Bold; }
set
{
Font oldFont = txtEdit.Properties.Appearance.Font;
txtEdit.Properties.Appearance.Font = new Font(oldFont.FontFamily, oldFont.Size, value ? FontStyle.Bold : FontStyle.Regular);
}
}
/// <summary>
/// 设置时间的显示和输入格式。
/// </summary>
public void TimeFormat(string value)
{
if (string.IsNullOrWhiteSpace(value))
{
return;
}
formatString = value;
txtEdit.Properties.DisplayFormat.FormatString = value;
txtEdit.Properties.EditFormat.FormatString = value;
txtEdit.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Custom;
txtEdit.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Custom;
txtEdit.Properties.Mask.EditMask = value;
txtEdit.Properties.Mask.UseMaskAsDisplayFormat = true;
txtEdit.Properties.TimeFormat = value.IndexOf("ss", StringComparison.OrdinalIgnoreCase) >= 0
? DevExpress.XtraEditors.Controls.TimeFormat.HourMinSec
: DevExpress.XtraEditors.Controls.TimeFormat.HourMin;
}
/// <summary>
/// 按控件显示精度比较当前值和原值,避免 DateTime/TimeSpan 字符串格式差异造成误判。
/// </summary>
public bool IsSameTime(string value)
{
TimeSpan oldTime;
TimeSpan currentTime;
bool hasOldTime = TryGetTime(value, out oldTime);
bool hasCurrentTime = TryGetTime(EditText, out currentTime);
if (!hasOldTime || !hasCurrentTime)
{
return !hasOldTime && !hasCurrentTime;
}
if (formatString.IndexOf("ss", StringComparison.OrdinalIgnoreCase) >= 0)
{
return oldTime.Hours == currentTime.Hours &&
oldTime.Minutes == currentTime.Minutes &&
oldTime.Seconds == currentTime.Seconds;
}
return oldTime.Hours == currentTime.Hours && oldTime.Minutes == currentTime.Minutes;
}
private static bool TryGetTime(string value, out TimeSpan timeValue)
{
timeValue = TimeSpan.Zero;
if (string.IsNullOrWhiteSpace(value))
{
return false;
}
if (TimeSpan.TryParse(value, out timeValue))
{
return true;
}
DateTime dateValue;
if (DateTime.TryParse(value, out dateValue))
{
timeValue = dateValue.TimeOfDay;
return true;
}
return false;
}
}
}
@@ -928,6 +928,7 @@
<DependentUpon>LabelWeigh.cs</DependentUpon>
</Compile>
<Compile Include="Model\AttachHelper.cs" />
<Compile Include="Model\AltButtonShortcutManager.cs" />
<Compile Include="AuditPanelEx.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -1219,6 +1220,9 @@
<Compile Include="LabelDateEdit.Designer.cs">
<DependentUpon>LabelDateEdit.cs</DependentUpon>
</Compile>
<Compile Include="LabelTimeEdit.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="LabelImageEdit.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -0,0 +1,122 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using DevExpress.XtraEditors;
namespace Lskj.Control.Model
{
/// <summary>
/// 将按钮原有的 &amp; 助记键改为必须按 Alt 才能触发的快捷键。
/// </summary>
public sealed class AltButtonShortcutManager
{
private sealed class ShortcutItem
{
public SimpleButton Button;
public Keys Key;
}
private readonly List<ShortcutItem> mShortcutItems =
new List<ShortcutItem>();
private bool mUpdatingText;
/// <summary>
/// 注册按钮快捷键,并移除标题中的 &amp;,保持界面显示为“按钮名(X)”。
/// </summary>
public void Register(SimpleButton button, Keys defaultKey)
{
if (button == null)
{
return;
}
ShortcutItem item = mShortcutItems.Find(
shortcut => ReferenceEquals(shortcut.Button, button));
if (item == null)
{
item = new ShortcutItem { Button = button, Key = defaultKey };
mShortcutItems.Add(item);
button.TextChanged += OnButtonTextChanged;
}
UpdateShortcut(item, defaultKey);
}
/// <summary>
/// 只响应 Alt+原助记键;未按 Alt、同时按下其他修饰键时均不处理。
/// </summary>
public bool ProcessKey(Keys keyData)
{
if ((keyData & Keys.Modifiers) != Keys.Alt)
{
return false;
}
Keys keyCode = keyData & Keys.KeyCode;
foreach (ShortcutItem item in mShortcutItems)
{
SimpleButton button = item.Button;
if (item.Key == keyCode && button != null &&
!button.IsDisposed && button.Visible && button.Enabled)
{
button.PerformClick();
return true;
}
}
return false;
}
private void OnButtonTextChanged(object sender, EventArgs e)
{
if (mUpdatingText)
{
return;
}
SimpleButton button = sender as SimpleButton;
ShortcutItem item = mShortcutItems.Find(
shortcut => ReferenceEquals(shortcut.Button, button));
if (item != null)
{
UpdateShortcut(item, item.Key);
}
}
private void UpdateShortcut(ShortcutItem item, Keys defaultKey)
{
string text = item.Button.Text ?? string.Empty;
int mnemonicIndex = FindMnemonicIndex(text);
if (mnemonicIndex >= 0)
{
item.Key = (Keys)char.ToUpperInvariant(text[mnemonicIndex + 1]);
mUpdatingText = true;
try
{
item.Button.Text = text.Remove(mnemonicIndex, 1);
}
finally
{
mUpdatingText = false;
}
}
else
{
item.Key = defaultKey;
}
}
private static int FindMnemonicIndex(string text)
{
for (int index = 0; index < text.Length - 1; index++)
{
if (text[index] == '&' && char.IsLetterOrDigit(text[index + 1]))
{
return index;
}
}
return -1;
}
}
}
+22 -5
View File
@@ -2095,8 +2095,6 @@ namespace Lskj.Control.Model
case ControlType.LabDate:
case ControlType.LabDateTime:
case ControlType.LabDateTimeShort:
case ControlType.LabTime:
case ControlType.LabShortTime:
// 日期控件
LabelDateEdit dateEdit = ctr as LabelDateEdit;
if (string.IsNullOrWhiteSpace(dateEdit.FormatType))
@@ -2109,6 +2107,12 @@ namespace Lskj.Control.Model
}
//value = dateEdit.TextEdit.EditValue == null ? dateEdit.EditText : dateEdit.TextEdit.EditValue.ToString();
break;
case ControlType.LabTime:
case ControlType.LabShortTime:
// 时间控件只返回时分秒部分,不附带日期。
LabelTimeEdit timeEdit = ctr as LabelTimeEdit;
value = timeEdit == null ? string.Empty : timeEdit.EditText;
break;
case ControlType.LabDateHalfDay:
// 日期半天控件
LabelDateHalfDayEdit dateHalfDayEdit = ctr as LabelDateHalfDayEdit;
@@ -4519,11 +4523,20 @@ namespace Lskj.Control.Model
Font mRowFont = new Font("Microsoft YaHei UI", 12);
switch (model.FieldType)
{
case ControlType.LabTime:
case ControlType.LabShortTime:
// 时间控件使用 TimeEdit,避免 DateEdit 显示日期日历。
LabelTimeEdit timeEdit = new LabelTimeEdit();
timeEdit.TextEdit.KeyDown += new KeyEventHandler(OnTextEditKeyDown);
timeEdit.TextEdit.TextChanged += new EventHandler(OnTextEditTextChanged);
// 时间类型固定使用时分或时分秒,避免旧的日期格式配置覆盖为年月日。
timeEdit.TimeFormat(DateFormat.Format(model.FieldType));
if (!isLoadBorder) timeEdit.TextEdit.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
baseControl = timeEdit;
break;
case ControlType.LabDate:
case ControlType.LabDateTime:
case ControlType.LabDateTimeShort:
case ControlType.LabTime:
case ControlType.LabShortTime:
case ControlType.LabShortDate:
// 日期控件
LabelDateEdit dateEdit = new LabelDateEdit();
@@ -6699,6 +6712,10 @@ namespace Lskj.Control.Model
LabelDateEdit dateEdit = controlObj as LabelDateEdit;
value = dateEdit.TextEdit.EditValue == null ? dateEdit.EditText : dateEdit.TextEdit.DateTime.ToString("yyyy-MM-dd");
}
else if (controlObj is LabelTimeEdit)
{
value = ((LabelTimeEdit)controlObj).EditText;
}
else if (controlObj is LabelCheckEdit)
{
LabelCheckEdit checkEdit = controlObj as LabelCheckEdit;
@@ -6892,7 +6909,7 @@ namespace Lskj.Control.Model
{
if (Model != null && Model.DataCaches != null)
{
Model.DataCaches.Remove(this);
Model.DataCaches.RemoveCache(this);
}
}
catch
+1 -1
View File
@@ -261,7 +261,7 @@ namespace Lskj.Control
{
if (Model != null && Model.DataCaches != null)
{
Model.DataCaches.Remove(this);
Model.DataCaches.RemoveCache(this);
}
}
catch
+1 -1
View File
@@ -193,7 +193,7 @@ namespace Lskj.Control
{
if (Model != null && Model.DataCaches != null)
{
Model.DataCaches.Remove(this);
Model.DataCaches.RemoveCache(this);
}
}
catch
+8 -8
View File
@@ -343,7 +343,7 @@
this.btnFixSearch.Name = "btnFixSearch";
this.btnFixSearch.Size = new System.Drawing.Size(63, 24);
this.btnFixSearch.TabIndex = 33;
this.btnFixSearch.Text = "查询(&Q)";
this.btnFixSearch.Text = "查询(Q)";
//
// txtFixKey
//
@@ -439,7 +439,7 @@
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(72, 26);
this.btnSave.TabIndex = 37;
this.btnSave.Text = "保存(&S)";
this.btnSave.Text = "保存(S)";
this.btnSave.Click += new System.EventHandler(this.OnSaveClick);
//
// btnUpdate
@@ -451,7 +451,7 @@
this.btnUpdate.Name = "btnUpdate";
this.btnUpdate.Size = new System.Drawing.Size(72, 26);
this.btnUpdate.TabIndex = 38;
this.btnUpdate.Text = "修改(&U)";
this.btnUpdate.Text = "修改(U)";
this.btnUpdate.Visible = false;
this.btnUpdate.Click += new System.EventHandler(this.OnUpdateClick);
//
@@ -464,7 +464,7 @@
this.btnPrint.Name = "btnPrint";
this.btnPrint.Size = new System.Drawing.Size(72, 26);
this.btnPrint.TabIndex = 37;
this.btnPrint.Text = "打印(&P)";
this.btnPrint.Text = "打印(P)";
this.btnPrint.Visible = false;
this.btnPrint.Click += new System.EventHandler(this.OnPrintClick);
//
@@ -477,7 +477,7 @@
this.btnExport.Name = "btnExport";
this.btnExport.Size = new System.Drawing.Size(72, 26);
this.btnExport.TabIndex = 37;
this.btnExport.Text = "导出(&E)";
this.btnExport.Text = "导出(E)";
this.btnExport.Visible = false;
this.btnExport.Click += new System.EventHandler(this.OnExportClick);
//
@@ -490,7 +490,7 @@
this.btnImport.Name = "btnImport";
this.btnImport.Size = new System.Drawing.Size(72, 26);
this.btnImport.TabIndex = 37;
this.btnImport.Text = "导入(&I)";
this.btnImport.Text = "导入(I)";
this.btnImport.Visible = false;
this.btnImport.Click += new System.EventHandler(this.OnImportClick);
//
@@ -503,7 +503,7 @@
this.btnDel.Name = "btnDel";
this.btnDel.Size = new System.Drawing.Size(72, 26);
this.btnDel.TabIndex = 36;
this.btnDel.Text = "删除(&D)";
this.btnDel.Text = "删除(D)";
this.btnDel.Click += new System.EventHandler(this.OnDelClick);
//
// btnAdd
@@ -515,7 +515,7 @@
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(72, 26);
this.btnAdd.TabIndex = 35;
this.btnAdd.Text = "增加(&A)";
this.btnAdd.Text = "增加(A)";
this.btnAdd.Click += new System.EventHandler(this.OnAddClick);
//
// ModuleGridEx
+24 -1
View File
@@ -53,6 +53,9 @@ namespace Lskj.Control
/// </summary>
public partial class ModuleGridEx : UserControl
{
private readonly AltButtonShortcutManager mAltButtonShortcuts =
new AltButtonShortcutManager();
#region private property
/// <summary>
@@ -3702,10 +3705,30 @@ namespace Lskj.Control
public ModuleGridEx()
{
InitializeComponent();
InitializeAltButtonShortcuts();
this.OperShortMode = true;
this.Disposed += OnModuleGridExDisposed;
}
private void InitializeAltButtonShortcuts()
{
mAltButtonShortcuts.Register(btnFixSearch, Keys.Q);
mAltButtonShortcuts.Register(btnSave, Keys.S);
mAltButtonShortcuts.Register(btnUpdate, Keys.U);
mAltButtonShortcuts.Register(btnPrint, Keys.P);
mAltButtonShortcuts.Register(btnExport, Keys.E);
mAltButtonShortcuts.Register(btnImport, Keys.I);
mAltButtonShortcuts.Register(btnDel, Keys.D);
mAltButtonShortcuts.Register(btnAdd, Keys.A);
}
protected override bool ProcessCmdKey(
ref System.Windows.Forms.Message msg, Keys keyData)
{
return mAltButtonShortcuts.ProcessKey(keyData) ||
base.ProcessCmdKey(ref msg, keyData);
}
/// <summary>
/// 清理公共事件和全局右键引用,避免模块关闭后仍保留当前表格。
/// </summary>
@@ -3780,7 +3803,7 @@ namespace Lskj.Control
{
if (Model != null && Model.DataCaches != null)
{
Model.DataCaches.Remove(this);
Model.DataCaches.RemoveCache(this);
}
}
catch
+5 -5
View File
@@ -310,7 +310,7 @@ namespace Lskj.Control
this.btnAttach.Size = new System.Drawing.Size(80, 28);
this.btnAttach.TabIndex = 6;
this.btnAttach.TabStop = false;
this.btnAttach.Text = "附件管理(&F)";
this.btnAttach.Text = "附件管理(F)";
//
// btnUpdate
//
@@ -321,7 +321,7 @@ namespace Lskj.Control
this.btnUpdate.Size = new System.Drawing.Size(80, 28);
this.btnUpdate.TabIndex = 4;
this.btnUpdate.TabStop = false;
this.btnUpdate.Text = "修改保存(&E)";
this.btnUpdate.Text = "修改保存(E)";
//
// ddb_common
//
@@ -342,7 +342,7 @@ namespace Lskj.Control
this.btnApply.Name = "btnApply";
this.btnApply.Size = new System.Drawing.Size(80, 28);
this.btnApply.TabIndex = 5;
this.btnApply.Text = "提交审核(&R)";
this.btnApply.Text = "提交审核(R)";
//
// btnAdd
//
@@ -353,7 +353,7 @@ namespace Lskj.Control
this.btnAdd.Size = new System.Drawing.Size(80, 28);
this.btnAdd.TabIndex = 3;
this.btnAdd.TabStop = false;
this.btnAdd.Text = "添加保存(&A)";
this.btnAdd.Text = "添加保存(A)";
//
// btnClose
//
@@ -364,7 +364,7 @@ namespace Lskj.Control
this.btnClose.Size = new System.Drawing.Size(80, 28);
this.btnClose.TabIndex = 10;
this.btnClose.TabStop = false;
this.btnClose.Text = "退出(&C)";
this.btnClose.Text = "退出(C)";
//
// simpleButton1
//
+23 -3
View File
@@ -47,6 +47,9 @@ namespace Lskj.Control
/// </summary>
public partial class ModulePanelEx : UserControl
{
private readonly AltButtonShortcutManager mAltButtonShortcuts =
new AltButtonShortcutManager();
public LabelTextEdit ScanEdit { get { return this._scanEdit; } }
#region private property
@@ -228,6 +231,7 @@ namespace Lskj.Control
{
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.Selectable | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
InitializeComponent();
InitializeAltButtonShortcuts();
this.scc_container.PanelVisibility = SplitPanelVisibility.Panel1;
this.simpleButton1.Click += simpleButton1_Click;
this.btnClear.Click += OnBtnClearClick;
@@ -241,6 +245,22 @@ namespace Lskj.Control
this.BtnMesClose.Click += OnBtnMesCloseClick;
}
private void InitializeAltButtonShortcuts()
{
mAltButtonShortcuts.Register(btnAttach, Keys.F);
mAltButtonShortcuts.Register(btnUpdate, Keys.E);
mAltButtonShortcuts.Register(btnApply, Keys.R);
mAltButtonShortcuts.Register(btnAdd, Keys.A);
mAltButtonShortcuts.Register(btnClose, Keys.C);
}
protected override bool ProcessCmdKey(
ref System.Windows.Forms.Message msg, Keys keyData)
{
return mAltButtonShortcuts.ProcessKey(keyData) ||
base.ProcessCmdKey(ref msg, keyData);
}
#region private method
/// <summary>
/// <para>说明:控制滚动条是否存在横向的</para>
@@ -360,9 +380,9 @@ namespace Lskj.Control
this.btnUpdate.Location = this.btnApply.Location;
}
// 设置文本
btnAdd.Text = !string.IsNullOrWhiteSpace(this.SysModel.AddCaption) ? this.SysModel.AddCaption : "添加保存(&A)";
btnUpdate.Text = !string.IsNullOrWhiteSpace(this.SysModel.ModifyCaption) ? this.SysModel.ModifyCaption : "修改保存(&E)";
btnApply.Text = !string.IsNullOrWhiteSpace(this.SysModel.ApplyCaption) ? this.SysModel.ApplyCaption : "提交审核(&R)";
btnAdd.Text = !string.IsNullOrWhiteSpace(this.SysModel.AddCaption) ? this.SysModel.AddCaption : "添加保存(A)";
btnUpdate.Text = !string.IsNullOrWhiteSpace(this.SysModel.ModifyCaption) ? this.SysModel.ModifyCaption : "修改保存(E)";
btnApply.Text = !string.IsNullOrWhiteSpace(this.SysModel.ApplyCaption) ? this.SysModel.ApplyCaption : "提交审核(R)";
//隐藏帮助文档按钮
if (SystemInfo.Instance.HideHelpDocument) this.simpleButton1.Visible = false;
@@ -121,7 +121,7 @@ namespace Lskj.Control
{
if (Model != null && Model.DataCaches != null)
{
Model.DataCaches.Remove(this);
Model.DataCaches.RemoveCache(this);
}
}
catch
@@ -432,7 +432,7 @@
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(67, 23);
this.btnSave.TabIndex = 17;
this.btnSave.Text = "保存(&S)";
this.btnSave.Text = "保存(S)";
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// dpb_Tools
@@ -481,7 +481,7 @@
this.btnSpare.Name = "btnSpare";
this.btnSpare.Size = new System.Drawing.Size(67, 23);
this.btnSpare.TabIndex = 19;
this.btnSpare.Text = "分单(&P)";
this.btnSpare.Text = "分单(P)";
this.btnSpare.Click += new System.EventHandler(this.btnSpare_Click);
//
// btnPrint
@@ -508,7 +508,7 @@
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(75, 23);
this.btnClose.TabIndex = 5;
this.btnClose.Text = "关闭(&Q)";
this.btnClose.Text = "关闭(Q)";
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// btnRemindBack
@@ -533,7 +533,7 @@
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(75, 23);
this.btnBack.TabIndex = 4;
this.btnBack.Text = "返退(&N)";
this.btnBack.Text = "返退(N)";
this.btnBack.Click += new System.EventHandler(this.btnReturn_Click);
//
// btnRemindAccradit
@@ -558,7 +558,7 @@
this.btnAccradit.Name = "btnAccradit";
this.btnAccradit.Size = new System.Drawing.Size(75, 23);
this.btnAccradit.TabIndex = 3;
this.btnAccradit.Text = "审核(&Y)";
this.btnAccradit.Text = "审核(Y)";
this.btnAccradit.Click += new System.EventHandler(this.btnAccradit_Click);
//
// label_date
@@ -44,9 +44,29 @@ namespace Lskj.PubAccraditation
/// </summary>
public partial class FrmAccraditation : BaseForm
{
private readonly AltButtonShortcutManager mAltButtonShortcuts =
new AltButtonShortcutManager();
public FrmAccraditation()
{
InitializeComponent();
InitializeAltButtonShortcuts();
}
private void InitializeAltButtonShortcuts()
{
mAltButtonShortcuts.Register(btnSave, Keys.S);
mAltButtonShortcuts.Register(btnSpare, Keys.P);
mAltButtonShortcuts.Register(btnClose, Keys.Q);
mAltButtonShortcuts.Register(btnBack, Keys.N);
mAltButtonShortcuts.Register(btnAccradit, Keys.Y);
}
protected override bool ProcessCmdKey(
ref System.Windows.Forms.Message msg, Keys keyData)
{
return mAltButtonShortcuts.ProcessKey(keyData) ||
base.ProcessCmdKey(ref msg, keyData);
}
private void ReleaseResourcesForDispose()
@@ -89,7 +109,7 @@ namespace Lskj.PubAccraditation
}
if (SysModel != null && SysModel.DataCaches != null)
{
SysModel.DataCaches.Remove(this);
SysModel.DataCaches.RemoveCache(this);
}
}
catch
@@ -2203,8 +2223,8 @@ namespace Lskj.PubAccraditation
{
this.btnAccradit.Enabled = true;
this.btnRemindAccradit.Visible = this.btnRemindBack.Visible = this.btnSave.Visible = this.btnClose.Visible = this.btnSpare.Visible = this.btnBack.Visible = false;
this.btnAccradit.Text = "确认(&Y)";
this.btnAccradit.Text = "确认(&Y)";
this.btnAccradit.Text = "确认(Y)";
this.btnAccradit.Text = "确认(Y)";
this.label_auditPerson.Text = "确认意见";
this.label_date.EditText = "会签人";
this.txtRemark.Text = "确认";
+7 -6
View File
@@ -28,16 +28,17 @@
/// </summary>
private void InitializeComponent()
{
this.barManager1 = new DevExpress.XtraBars.BarManager();
this.components = new System.ComponentModel.Container();
this.barManager1 = new DevExpress.XtraBars.BarManager(this.components);
this.barDockControl1 = new DevExpress.XtraBars.BarDockControl();
this.barDockControl2 = new DevExpress.XtraBars.BarDockControl();
this.barDockControl3 = new DevExpress.XtraBars.BarDockControl();
this.barDockControl5 = new DevExpress.XtraBars.BarDockControl();
this.pmFP = new DevExpress.XtraBars.PopupMenu();
this.pmBillExp = new DevExpress.XtraBars.PopupMenu();
this.pmBill = new DevExpress.XtraBars.PopupMenu();
this.pMprint = new DevExpress.XtraBars.PopupMenu();
this.pMenu = new DevExpress.XtraBars.PopupMenu();
this.pmFP = new DevExpress.XtraBars.PopupMenu(this.components);
this.pmBillExp = new DevExpress.XtraBars.PopupMenu(this.components);
this.pmBill = new DevExpress.XtraBars.PopupMenu(this.components);
this.pMprint = new DevExpress.XtraBars.PopupMenu(this.components);
this.pMenu = new DevExpress.XtraBars.PopupMenu(this.components);
this.tb_buttom = new Lskj.Control.TabControlEx();
this.ssc_main_top = new DevExpress.XtraEditors.SplitContainerControl();
this.pl_left = new DevExpress.XtraEditors.PanelControl();
+12 -2
View File
@@ -13,9 +13,19 @@
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
if (disposing)
{
components.Dispose();
if (cellHelper != null)
{
cellHelper.Dispose();
cellHelper = null;
}
class2_0 = null;
class2_1 = null;
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
+1 -24
View File
@@ -33,30 +33,7 @@ namespace Lskj.PubBrower
this.SubForm = main;
this.SubForm.Text = moduleModel.FormText;
main.PubBrowerModel = moduleModel;
// CEF must be created after the caller has established the final
// WinForms owner/parent hierarchy and the form HWND exists.
if (moduleModel.downLoadFlag == 1)
{
main.OnLoad();
}
else
{
EventHandler shown = null;
shown = delegate
{
main.Shown -= shown;
try
{
main.OnLoad();
}
catch (Exception ex)
{
LogUtil.WriteError("Lskj.PubBrower.dll--初始化错误-->" + obj.ToString(), ex);
}
};
main.Shown += shown;
}
main.OnLoad();
}
catch (Exception ex)
{
+1 -1
View File
@@ -100,8 +100,8 @@ namespace Lskj.PubBrower
previewFrm previewFrm = new previewFrm();
previewFrm.moduleWebView.PubBrowerModel = this.PubBrowerModel;
previewFrm.Dock = DockStyle.Fill;
this.Controls.Add(previewFrm);
previewFrm.OnLoad(url, RightKeyFlag);
this.Controls.Add(previewFrm);
}
}
catch (Exception ex)
+14
View File
@@ -16,6 +16,7 @@ namespace Lskj.PubBrower
public previewFrm()
{
InitializeComponent();
this.SizeChanged += OnSizeChanged;
}
/// <summary>
/// <para>说明:窗口加载</para>
@@ -47,5 +48,18 @@ namespace Lskj.PubBrower
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// 窗体大小改变时
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnSizeChanged(object sender, EventArgs e)
{
if (this.moduleWebView.cefBrowserSettings != null)
{
var handle = this.moduleWebView.cefBrowserSettings.GetHost().GetWindowHandle();
this.moduleWebView.ResizeWindow(handle, this.Width, this.Height);
}
}
}
}
+1 -24
View File
@@ -33,30 +33,7 @@ namespace Lskj.PubBrower2
this.SubForm = main;
this.SubForm.Text = moduleModel.FormText;
main.PubBrowerModel = moduleModel;
// CEF must be created after the caller has established the final
// WinForms owner/parent hierarchy and the form HWND exists.
if (moduleModel.downLoadFlag == 1)
{
main.OnLoad();
}
else
{
EventHandler shown = null;
shown = delegate
{
main.Shown -= shown;
try
{
main.OnLoad();
}
catch (Exception ex)
{
LogUtil.WriteError("Lskj.PubBrower2.dll--初始化错误-->" + obj.ToString(), ex);
}
};
main.Shown += shown;
}
main.OnLoad();
}
catch (Exception ex)
{
+1 -1
View File
@@ -95,8 +95,8 @@ namespace Lskj.PubBrower2
previewFrm previewFrm = new previewFrm();
previewFrm.moduleWebView.PubBrowerModel = this.PubBrowerModel;
previewFrm.Dock = DockStyle.Fill;
this.Controls.Add(previewFrm);
previewFrm.OnLoad(url, RightKeyFlag);
this.Controls.Add(previewFrm);
}
}
+14
View File
@@ -16,6 +16,7 @@ namespace Lskj.PubBrower2
public previewFrm()
{
InitializeComponent();
this.SizeChanged += OnSizeChanged;
}
/// <summary>
/// <para>说明:窗口加载</para>
@@ -48,5 +49,18 @@ namespace Lskj.PubBrower2
}
}
/// <summary>
/// 窗体大小改变时
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnSizeChanged(object sender, EventArgs e)
{
if (this.moduleWebView.cefBrowserSettings != null)
{
var handle = this.moduleWebView.cefBrowserSettings.GetHost().GetWindowHandle();
this.moduleWebView.ResizeWindow(handle, this.Width, this.Height);
}
}
}
}
+43 -35
View File
@@ -211,13 +211,14 @@ namespace Lskj.PubModuleDetail
Dictionary<object, Hashtable> dataCaches =
Model != null ? Model.DataCaches : null;
if (dataCaches == null || !AreDataCacheTasksCompleted(dataCaches))
HashSet<Task> completedTasks;
if (dataCaches == null ||
!TryDetachCompletedCacheTasks(dataCaches, out completedTasks))
{
return;
}
DisposeCompletedCacheTasks(dataCaches);
dataCaches.Clear();
DisposeCompletedCacheTasks(completedTasks);
}
/// <summary>
@@ -225,34 +226,10 @@ namespace Lskj.PubModuleDetail
/// Task.Result 在等待时可能创建底层等待对象,仅清空字典
/// 不会立即释放这些句柄。
/// </summary>
private static void DisposeCompletedCacheTasks(
Dictionary<object, Hashtable> dataCaches)
private static void DisposeCompletedCacheTasks(IEnumerable<Task> tasks)
{
HashSet<Task> tasks = new HashSet<Task>();
foreach (Hashtable cache in dataCaches.Values)
{
if (cache == null)
{
continue;
}
foreach (object value in cache.Values)
{
Task task = value as Task;
if (task != null)
{
tasks.Add(task);
}
}
}
foreach (Task task in tasks)
{
if (!task.IsCompleted)
{
continue;
}
try
{
task.Dispose();
@@ -264,27 +241,58 @@ namespace Lskj.PubModuleDetail
}
/// <summary>
/// 并行初始化仍在运行时不能清空缓存字典,后台任务还会读取或追加其中的数据
/// 仅当并行初始化全部完成时,才在同一同步区间摘除缓存任务
/// AddTask 使用同一个字典实例加锁,避免检查后又插入新任务。
/// </summary>
private static bool AreDataCacheTasksCompleted(Dictionary<object, Hashtable> dataCaches)
private static bool TryDetachCompletedCacheTasks(
Dictionary<object, Hashtable> dataCaches,
out HashSet<Task> completedTasks)
{
completedTasks = new HashSet<Task>();
try
{
foreach (Hashtable cacheValues in dataCaches.Values)
lock (dataCaches)
{
foreach (object value in cacheValues.Values)
foreach (Hashtable cacheValues in dataCaches.Values)
{
Task task = value as Task;
if (task != null && !task.IsCompleted)
if (cacheValues == null)
{
return false;
continue;
}
foreach (object value in cacheValues.Values)
{
Task task = value as Task;
if (task == null)
{
continue;
}
try
{
if (!task.IsCompleted)
{
completedTasks.Clear();
return false;
}
}
catch (ObjectDisposedException)
{
continue;
}
completedTasks.Add(task);
}
}
dataCaches.Clear();
}
return true;
}
catch (InvalidOperationException)
{
completedTasks.Clear();
return false;
}
}
+8 -6
View File
@@ -133,9 +133,11 @@
this.gcMain.AdapterObj = null;
this.gcMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.gcMain.Location = new System.Drawing.Point(0, 0);
this.gcMain.Margin = new System.Windows.Forms.Padding(4);
this.gcMain.Name = "gcMain";
this.gcMain.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gcMain.Size = new System.Drawing.Size(597, 548);
this.gcMain.SysModel = null;
this.gcMain.TabIndex = 2;
//
// panelControl4
@@ -173,7 +175,7 @@
this.btnExport.Name = "btnExport";
this.btnExport.Size = new System.Drawing.Size(72, 26);
this.btnExport.TabIndex = 15;
this.btnExport.Text = "导出(&E)";
this.btnExport.Text = "导出(E)";
this.btnExport.Click += new System.EventHandler(this.OnExportClick);
//
// btnShowAll
@@ -193,7 +195,7 @@
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(72, 26);
this.btnSave.TabIndex = 13;
this.btnSave.Text = "保存(&S)";
this.btnSave.Text = "保存(S)";
this.btnSave.Click += new System.EventHandler(this.OnSaveButtonClick);
//
// btnDelete
@@ -203,7 +205,7 @@
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(72, 26);
this.btnDelete.TabIndex = 12;
this.btnDelete.Text = "删除(&D)";
this.btnDelete.Text = "删除(D)";
this.btnDelete.Click += new System.EventHandler(this.OnDeleteButtonClick);
//
// btnAdd
@@ -213,7 +215,7 @@
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(72, 26);
this.btnAdd.TabIndex = 11;
this.btnAdd.Text = "增加(&A)";
this.btnAdd.Text = "增加(A)";
this.btnAdd.Click += new System.EventHandler(this.OnAddButtonClick);
//
// btnRefresh
@@ -223,7 +225,7 @@
this.btnRefresh.Name = "btnRefresh";
this.btnRefresh.Size = new System.Drawing.Size(72, 26);
this.btnRefresh.TabIndex = 10;
this.btnRefresh.Text = "刷新(&R)";
this.btnRefresh.Text = "刷新(R)";
this.btnRefresh.Click += new System.EventHandler(this.OnRefreshButtonClick);
//
// panelControl3
@@ -306,4 +308,4 @@
private DevExpress.XtraEditors.SimpleButton btnExport;
private DevExpress.XtraEditors.SimpleButton simpleButton1;
}
}
}
+20
View File
@@ -30,6 +30,9 @@ namespace Lskj.PubSpec
{
public partial class FrmMain : BaseForm
{
private readonly AltButtonShortcutManager mAltButtonShortcuts =
new AltButtonShortcutManager();
private bool _existsPid = false;
/// <summary>
/// 主键
@@ -59,6 +62,23 @@ namespace Lskj.PubSpec
public FrmMain()
{
InitializeComponent();
InitializeAltButtonShortcuts();
}
private void InitializeAltButtonShortcuts()
{
mAltButtonShortcuts.Register(btnExport, Keys.E);
mAltButtonShortcuts.Register(btnSave, Keys.S);
mAltButtonShortcuts.Register(btnDelete, Keys.D);
mAltButtonShortcuts.Register(btnAdd, Keys.A);
mAltButtonShortcuts.Register(btnRefresh, Keys.R);
}
protected override bool ProcessCmdKey(
ref System.Windows.Forms.Message msg, Keys keyData)
{
return mAltButtonShortcuts.ProcessKey(keyData) ||
base.ProcessCmdKey(ref msg, keyData);
}
/// <summary>
+2 -2
View File
@@ -213,7 +213,7 @@
this.btnExport.Name = "btnExport";
this.btnExport.Size = new System.Drawing.Size(72, 26);
this.btnExport.TabIndex = 19;
this.btnExport.Text = "导出(&E)";
this.btnExport.Text = "导出(E)";
this.btnExport.Click += new System.EventHandler(this.OnExportClick);
//
// btnShowAll
@@ -233,7 +233,7 @@
this.btnRefresh.Name = "btnRefresh";
this.btnRefresh.Size = new System.Drawing.Size(72, 26);
this.btnRefresh.TabIndex = 17;
this.btnRefresh.Text = "刷新(&R)";
this.btnRefresh.Text = "刷新(R)";
this.btnRefresh.Click += new System.EventHandler(this.OnRefreshButtonClick);
//
// FrmMain
+17
View File
@@ -28,6 +28,9 @@ namespace Lskj.PubSpec2
{
public partial class FrmMain : BaseForm
{
private readonly AltButtonShortcutManager mAltButtonShortcuts =
new AltButtonShortcutManager();
private bool _existsPid = false;
/// <summary>
/// 主键
@@ -55,6 +58,20 @@ namespace Lskj.PubSpec2
public FrmMain()
{
InitializeComponent();
InitializeAltButtonShortcuts();
}
private void InitializeAltButtonShortcuts()
{
mAltButtonShortcuts.Register(btnExport, Keys.E);
mAltButtonShortcuts.Register(btnRefresh, Keys.R);
}
protected override bool ProcessCmdKey(
ref System.Windows.Forms.Message msg, Keys keyData)
{
return mAltButtonShortcuts.ProcessKey(keyData) ||
base.ProcessCmdKey(ref msg, keyData);
}
private void ReleaseResourcesForDispose()
+2 -230
View File
@@ -13,7 +13,6 @@ using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Lskj.Control;
using Lskj.Model;
@@ -24,7 +23,6 @@ using Lskj.Business.Impl;
using Lskj.Business;
using System.Threading.Tasks;
using System.Collections;
using System.IO;
using System.Reflection;
namespace Lskj.Report
@@ -42,8 +40,6 @@ namespace Lskj.Report
mReportGridLocalizerViews =
new HashSet<DevExpress.XtraGrid.Views.Base.BaseView>();
private bool mReportGridResourcesReleased;
private int mDisposedReportGridViewCount;
private int mRemovedGridLocalizerHandlerCount;
public FrmMain()
{
@@ -99,19 +95,12 @@ namespace Lskj.Report
private void OnClose(object sender, FormClosingEventArgs e)
{
WriteReportLifecycleDiagnostics("closing-before-close-module");
this.mControl.CloseModule();
WriteReportLifecycleDiagnostics("closing-after-close-module");
}
private void OnFrmMainDisposed(object sender, EventArgs e)
{
DisposeReportGridViews();
WriteReportLifecycleDiagnostics(
"disposed-event;disposedGridViews=" +
mDisposedReportGridViewCount +
";gridLocalizerRemoved=" +
mRemovedGridLocalizerHandlerCount);
mReportGridLocalizerViews.Clear();
mPreexistingGridLocalizerViews.Clear();
this.FormClosing -= OnClose;
@@ -126,7 +115,7 @@ namespace Lskj.Report
try
{
model.DataCaches.Clear();
model.DataCaches.ClearCaches();
}
catch (Exception ex)
{
@@ -142,7 +131,6 @@ namespace Lskj.Report
}
mReportGridResourcesReleased = true;
WriteReportLifecycleDiagnostics("dispose-before-gridviews");
CaptureReportGridLocalizerViews();
if (this.mControl != null)
{
@@ -151,8 +139,6 @@ namespace Lskj.Report
HashSet<DevExpress.XtraGrid.Views.Base.BaseView> disposedViews =
new HashSet<DevExpress.XtraGrid.Views.Base.BaseView>();
int disposeErrorCount = 0;
int detachedDataSourceCount = 0;
foreach (System.Windows.Forms.Control control in
EnumerateControls(this.mControl))
{
@@ -165,12 +151,10 @@ namespace Lskj.Report
if (gridControl.DataSource != null)
{
gridControl.DataSource = null;
detachedDataSourceCount++;
}
}
catch (Exception ex)
{
disposeErrorCount++;
LogHelper.Instance.WriteError(ex, ResourceKeys.BaseReport);
}
@@ -191,7 +175,6 @@ namespace Lskj.Report
}
catch (Exception ex)
{
disposeErrorCount++;
LogHelper.Instance.WriteError(ex, ResourceKeys.BaseReport);
}
}
@@ -216,33 +199,16 @@ namespace Lskj.Report
dataSourceProperty.GetValue(control, null) != null)
{
dataSourceProperty.SetValue(control, null, null);
detachedDataSourceCount++;
}
}
catch (Exception ex)
{
disposeErrorCount++;
LogHelper.Instance.WriteError(ex, ResourceKeys.BaseReport);
}
}
}
int trackedGridViews = mReportGridLocalizerViews.Count;
int removedGridLocalizerHandlers =
ReleaseTrackedGridLocalizerViews(disposedViews);
mDisposedReportGridViewCount = disposedViews.Count;
mRemovedGridLocalizerHandlerCount = removedGridLocalizerHandlers;
WriteReportLifecycleDiagnostics(
"dispose-after-gridviews;dispose-attempts=" +
disposedViews.Count +
";dispose-errors=" +
disposeErrorCount +
";detachedDataSources=" +
detachedDataSourceCount +
";trackedGridViews=" +
trackedGridViews +
";gridLocalizerRemoved=" +
removedGridLocalizerHandlers);
ReleaseTrackedGridLocalizerViews(disposedViews);
}
private void CaptureReportGridLocalizerViews()
@@ -454,200 +420,6 @@ namespace Lskj.Report
handler.Target is DevExpress.XtraGrid.Views.Base.BaseView;
}
private void WriteReportLifecycleDiagnostics(string phase)
{
if (!IsReportDiagnosticsEnabled())
{
return;
}
try
{
LogHelper.Instance.WriteLog(
"REPORT_DIAGNOSTIC phase=" +
(phase ?? string.Empty) +
" " +
GetReportGridDiagnostics(),
"ResourceDiagnostics.Report");
}
catch
{
// Diagnostics must never interfere with module close/dispose.
}
}
private string GetReportGridDiagnostics()
{
int controlCount = 0;
int gridControlCount = 0;
int viewCount = 0;
HashSet<DevExpress.XtraGrid.Views.Base.BaseView> views =
new HashSet<DevExpress.XtraGrid.Views.Base.BaseView>();
StringBuilder viewDetails = new StringBuilder();
try
{
if (this.mControl != null)
{
foreach (System.Windows.Forms.Control control in EnumerateControls(this.mControl))
{
controlCount++;
DevExpress.XtraGrid.GridControl gridControl =
control as DevExpress.XtraGrid.GridControl;
if (gridControl == null)
{
continue;
}
gridControlCount++;
foreach (DevExpress.XtraGrid.Views.Base.BaseView view in
gridControl.ViewCollection.Cast<DevExpress.XtraGrid.Views.Base.BaseView>())
{
if (view == null || !views.Add(view))
{
continue;
}
viewCount++;
if (viewDetails.Length < 1800)
{
if (viewDetails.Length > 0)
{
viewDetails.Append(",");
}
viewDetails.Append(SafeViewDescription(view));
}
}
}
}
}
catch (Exception exception)
{
viewDetails.Append(",enumeration-error=");
viewDetails.Append(exception.GetType().Name);
}
return "formDisposed=" +
this.IsDisposed +
";controlCount=" +
controlCount +
";gridControlCount=" +
gridControlCount +
";viewCount=" +
viewCount +
";views=" +
viewDetails +
";gridLocalizer=" +
DescribeGridLocalizer();
}
private static string SafeViewDescription(
DevExpress.XtraGrid.Views.Base.BaseView view)
{
try
{
return view.GetType().FullName +
":" +
(view.Name ?? string.Empty).Replace(";", ",");
}
catch
{
return "<view-description-error>";
}
}
private static string DescribeGridLocalizer()
{
try
{
var active =
DevExpress.XtraGrid.Localization.GridLocalizer.Active;
if (active == null)
{
return "active=null";
}
StringBuilder handlers = new StringBuilder();
int handlerCount = 0;
Type currentType = active.GetType();
while (currentType != null && currentType != typeof(object))
{
FieldInfo[] fields = currentType.GetFields(
BindingFlags.Instance |
BindingFlags.Static |
BindingFlags.Public |
BindingFlags.NonPublic |
BindingFlags.DeclaredOnly);
foreach (FieldInfo field in fields)
{
if (!typeof(Delegate).IsAssignableFrom(field.FieldType))
{
continue;
}
object owner = field.IsStatic ? null : (object)active;
Delegate value = field.GetValue(owner) as Delegate;
if (value == null)
{
continue;
}
foreach (Delegate handler in value.GetInvocationList())
{
handlerCount++;
if (handlers.Length < 1800)
{
if (handlers.Length > 0)
{
handlers.Append(",");
}
string targetType = handler.Target == null
? "static"
: handler.Target.GetType().FullName;
handlers.Append(field.Name.Replace(";", ","));
handlers.Append("->");
handlers.Append(targetType.Replace(";", ","));
handlers.Append(".");
handlers.Append(handler.Method.Name.Replace(";", ","));
}
}
}
currentType = currentType.BaseType;
}
return "activeType=" +
active.GetType().FullName.Replace(";", ",") +
";handlerCount=" +
handlerCount +
";handlers=" +
handlers;
}
catch (Exception exception)
{
return "localizer-error=" + exception.GetType().Name;
}
}
private static bool IsReportDiagnosticsEnabled()
{
try
{
return File.Exists(
Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"Logs",
"ResourceDiagnostics",
"resource-diagnostics.enabled"));
}
catch
{
return false;
}
}
private static IEnumerable<System.Windows.Forms.Control> EnumerateControls(
System.Windows.Forms.Control root)
{
+74 -27
View File
@@ -197,26 +197,31 @@ namespace Lskj.Util
value = default;
return false;
}
if (dic.ContainsKey(control))
Task<T> task;
lock (dic)
{
if (dic[control].ContainsKey(key))
{
Task<T> task = dic[control][key] as Task<T>;
value = task.Result;
task.Dispose();
return true;
}
else
Hashtable cache;
if (!dic.TryGetValue(control, out cache) ||
cache == null ||
!cache.ContainsKey(key))
{
value = default;
return false;
}
task = cache[key] as Task<T>;
}
else
if (task == null)
{
value = default;
return false;
}
value = task.Result;
task.Dispose();
return true;
}
catch (Exception ex)
{
@@ -237,14 +242,23 @@ namespace Lskj.Util
{
try
{
if (cachesDic.ContainsKey(control) && cachesDic[control].ContainsKey(key))
{
return (Task<T>)cachesDic[control][key];
}
else
if (cachesDic == null)
{
return default;
}
lock (cachesDic)
{
Hashtable cache;
if (cachesDic.TryGetValue(control, out cache) &&
cache != null &&
cache.ContainsKey(key))
{
return cache[key] as Task<T>;
}
}
return default;
}
catch (Exception ex)
{
@@ -253,6 +267,36 @@ namespace Lskj.Util
}
}
/// <summary>
/// 在线程安全的同步区间内移除控件缓存。
/// </summary>
public static bool RemoveCache(this Dictionary<object, Hashtable> cachesDic, object control)
{
if (cachesDic == null)
{
return false;
}
lock (cachesDic)
{
return cachesDic.Remove(control);
}
}
/// <summary>
/// 在线程安全的同步区间内清空任务缓存。
/// </summary>
public static void ClearCaches(this Dictionary<object, Hashtable> cachesDic)
{
if (cachesDic == null)
{
return;
}
lock (cachesDic)
{
cachesDic.Clear();
}
}
/// <summary>
/// 添加任务
/// </summary>
/// <typeparam name="T"></typeparam>
@@ -262,20 +306,23 @@ namespace Lskj.Util
/// <param name="task"></param>
public static Task<T> AddTask<T>(this Dictionary<object, Hashtable> cachesDic, object control, string key, Task<T> task)
{
Hashtable cachesHash = new Hashtable();
if (!cachesDic.ContainsKey(control))
lock (cachesDic)
{
cachesDic.Add(control, cachesHash);
}
else
{
cachesHash = cachesDic[control];
}
cachesHash.Add(key, task);
if (task.Status == TaskStatus.Created)
{
task.Start(SchedulerUtil);
Hashtable cachesHash;
if (!cachesDic.TryGetValue(control, out cachesHash) ||
cachesHash == null)
{
cachesHash = new Hashtable();
cachesDic[control] = cachesHash;
}
cachesHash.Add(key, task);
if (task.Status == TaskStatus.Created)
{
task.Start(SchedulerUtil);
}
}
return task;
}