基线 SVN r240

SVN-Revision: r240
This commit is contained in:
cyf
2025-02-06 06:46:06 +00:00
commit ab56a9bcf7
5317 changed files with 902274 additions and 0 deletions
+222
View File
@@ -0,0 +1,222 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
/******************************
* 说明:delphi与C#互操作类
* 创建人:龚宇超
* 创建日期:2017-08-16
* 修改人:
* 修改日期:
* 修改备注:
* 版本:1.0.0.0
******************************/
namespace Lskj.Notice
{
/// <summary>
/// delphi与C#互操作类
/// </summary>
public sealed class DelphiHelper
{
[DllImport("user32.dll", EntryPoint = "SetParent")]
public static extern IntPtr SetParent(IntPtr hChild, IntPtr hParent);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int Width, int Height, int flags);
/// <summary>
/// <para>说明:调用delphi库函数</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-16 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="Path">The path.</param>
/// <param name="Path1">The path1.</param>
/// <param name="FrmCaption">The FRM caption.</param>
/// <param name="SysParameterStr1">The system parameter STR1.</param>
/// <param name="SysParameterStr2">The system parameter STR2.</param>
/// <param name="FrmShowid">The FRM showid.</param>
/// <param name="SysParameterStr3">The system parameter STR3.</param>
/// <returns>System.Int32.</returns>
[DllImport("Lib/DelphiDll.dll")]
public static extern int Delphi_Call(StringBuilder Path, StringBuilder Path1, StringBuilder FrmCaption,StringBuilder SysParameterStr1, StringBuilder SysParameterStr2, int FrmShowid, StringBuilder SysParameterStr3);
/// <summary>
/// <para>说明:初始化</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-16 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="ConStr">The con string.</param>
/// <returns>System.Int32.</returns>
[DllImport("Lib/DelphiDll.dll")]
public static extern int Delphi_Init(StringBuilder ConStr);
/// <summary>
/// <para>说明:设置delphi库调用参数</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-16 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="OperatorID">The operator identifier.</param>
/// <param name="systemID">The system identifier.</param>
/// <param name="OperatorName">Name of the operator.</param>
/// <param name="WSName">Name of the ws.</param>
/// <param name="SkinPathStr">The skin path string.</param>
/// <returns>System.Int32.</returns>
[DllImport("Lib/DelphiDll.dll")]
public static extern int Delphi_SetParams(int OperatorID, int systemID, StringBuilder OperatorName, StringBuilder WSName, StringBuilder SkinPathStr);
/// <summary>
/// <para>说明:给调用delphi库的通用库设置主窗体句柄 CallingConvention = CallingConvention.StdCall)</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-16 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="MainHandle">The main handle.</param>
/// <returns>System.Int32.</returns>
[DllImport("Lib/DelphiDll.dll")]
public static extern int SetMainHandle(int MainHandle);
/// <summary>
/// <para>说明:delphi调用c#库</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-16 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="DLLName">Name of the DLL.</param>
/// <param name="parms">The parms.</param>
/// <returns>System.Int32.</returns>
[DllImport("Lib/DelphiDll.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
public static extern int DelphiCallCSharpDll(StringBuilder DLLName, StringBuilder parms);
/// <summary>
/// <para>说明:获取两个密码</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-16 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="ValidateCodeE">The validate code e.</param>
/// <param name="CodeELen">Length of the code e.</param>
/// <param name="ValidateCodeT">The validate code t.</param>
/// <param name="CodeTLen">Length of the code t.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
[DllImport("Lib/DelphiDll.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
public static extern bool GetValidateCode(ref StringBuilder ValidateCodeE, ref int CodeELen, ref StringBuilder ValidateCodeT, ref int CodeTLen);
/// <summary>
/// <para>说明:调用delphi库函数</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-16 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="libKey">The library key.</param>
/// <returns>System.Int32.</returns>
[DllImport("Lib/DelphiDll.dll")]
public static extern int FreeDll(StringBuilder libKey);
/// <summary>
/// <para>说明:调用delphi库函数下载附件</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-16 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="dfile">The dfile.</param>
/// <param name="hwnd">The HWND.</param>
/// <returns>StringBuilder.</returns>
[DllImport("Lib/DelphiDll.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
public static extern StringBuilder DownloadAttach(StringBuilder dfile, int hwnd);
/// <summary>
/// <para>说明:调用delphi库</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2018-06-08 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sPath">The s path.</param>
/// <returns>System.Int32.</returns>
public static int LoadDelphiDll(string sPath)
{
return LoadDelphiDll("lib/" + sPath, sPath, "", "", "", 0, "");
}
/// <summary>
/// <para>说明:调用delphi库</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-16 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sPath">The s path.</param>
/// <param name="sPath1">The s path1.</param>
/// <param name="sFrmCaption">The s FRM caption.</param>
/// <param name="sSysParameterStr1">The s system parameter STR1.</param>
/// <param name="sSysParameterStr2">The s system parameter STR2.</param>
/// <param name="showId">The FRM showid.</param>
/// <param name="sSysParameterStr3">The s system parameter STR3.</param>
/// <returns>System.Int32.</returns>
public static int LoadDelphiDll(string sPath, string sPath1, string sFrmCaption,string sSysParameterStr1, string sSysParameterStr2, int showId, string sSysParameterStr3)
{
int result = 0;
Cursor.Current = Cursors.WaitCursor;
try
{
StringBuilder path = new StringBuilder();
path.Append(sPath);
StringBuilder path1 = new StringBuilder();
path1.Append(sPath1);
StringBuilder caption = new StringBuilder();
caption.Append(sFrmCaption);
StringBuilder sps1 = new StringBuilder();
sps1.Append(sSysParameterStr1);
StringBuilder sps2 = new StringBuilder();
sps2.Append(sSysParameterStr2);
StringBuilder sps3 = new StringBuilder();
sps3.Append(sSysParameterStr3);
result = Delphi_Call(path, path1, caption, sps1, sps2, showId, sps3);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
Cursor.Current = Cursors.Default;
}
return result;
}
}
}
+310
View File
@@ -0,0 +1,310 @@
using Lskj.Control;
namespace Lskj.Notice
{
partial class FrmMain
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
this.timer3 = new System.Windows.Forms.Timer(this.components);
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.TsmiShow = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiSetting = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiShowWindow = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiFlicker = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiExitByMain = new System.Windows.Forms.ToolStripMenuItem();
this.TsmiClose = new System.Windows.Forms.ToolStripMenuItem();
this.gridControlEx = new DevExpress.XtraGrid.GridControl();
this.gridView = new DevExpress.XtraGrid.Views.Grid.GridView();
this.AuditMessages = new DevExpress.XtraGrid.Columns.GridColumn();
this.repositoryItemMemoEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit();
this.OperateDate = new DevExpress.XtraGrid.Columns.GridColumn();
this.repositoryItemMemoEdit3 = new DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit();
this.CreateUserName = new DevExpress.XtraGrid.Columns.GridColumn();
this.repositoryItemTextEdit2 = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit();
this.repositoryItemMemoExEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemMemoExEdit();
this.repositoryItemTextEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit();
this.repositoryItemTextEdit3 = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit();
this.repositoryItemTimeEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemTimeEdit();
this.repositoryItemMemoEdit2 = new DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit();
this.blinkTimer = new System.Windows.Forms.Timer(this.components);
this.contextMenuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridControlEx)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemMemoEdit1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemMemoEdit3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemTextEdit2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemMemoExEdit1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemTextEdit1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemTextEdit3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemTimeEdit1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemMemoEdit2)).BeginInit();
this.SuspendLayout();
//
// timer3
//
this.timer3.Interval = 4000;
this.timer3.Tick += new System.EventHandler(this.OnTimerReloadTick);
//
// notifyIcon1
//
this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1;
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
this.notifyIcon1.Text = "任务监视工具";
this.notifyIcon1.Visible = true;
this.notifyIcon1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.OnNotifyIconMouseClick);
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.TsmiShow,
this.tsmiSetting,
this.TsmiClose});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(125, 70);
//
// TsmiShow
//
this.TsmiShow.Name = "TsmiShow";
this.TsmiShow.Size = new System.Drawing.Size(124, 22);
this.TsmiShow.Text = "显示列表";
this.TsmiShow.Click += new System.EventHandler(this.OnTsmiShowClick);
//
// tsmiSetting
//
this.tsmiSetting.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmiShowWindow,
this.tsmiFlicker,
this.tsmiExitByMain});
this.tsmiSetting.Name = "tsmiSetting";
this.tsmiSetting.Size = new System.Drawing.Size(124, 22);
this.tsmiSetting.Text = "系统设置";
//
// tsmiShowWindow
//
this.tsmiShowWindow.Name = "tsmiShowWindow";
this.tsmiShowWindow.Size = new System.Drawing.Size(148, 22);
this.tsmiShowWindow.Text = "新消息弹窗";
this.tsmiShowWindow.Click += new System.EventHandler(this.OnTsmiShowWindowClick);
//
// tsmiFlicker
//
this.tsmiFlicker.Name = "tsmiFlicker";
this.tsmiFlicker.Size = new System.Drawing.Size(148, 22);
this.tsmiFlicker.Text = "新消息闪烁";
this.tsmiFlicker.Click += new System.EventHandler(this.OnTsmiFlickerClick);
//
// tsmiExitByMain
//
this.tsmiExitByMain.Name = "tsmiExitByMain";
this.tsmiExitByMain.Size = new System.Drawing.Size(148, 22);
this.tsmiExitByMain.Text = "随主程序退出";
this.tsmiExitByMain.Click += new System.EventHandler(this.OnTsmiExitByMainClick);
//
// TsmiClose
//
this.TsmiClose.Name = "TsmiClose";
this.TsmiClose.Size = new System.Drawing.Size(124, 22);
this.TsmiClose.Text = "退出";
this.TsmiClose.Click += new System.EventHandler(this.OnTsmiCloseClick);
//
// gridControlEx
//
this.gridControlEx.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridControlEx.EmbeddedNavigator.Margin = new System.Windows.Forms.Padding(2);
this.gridControlEx.Location = new System.Drawing.Point(0, 0);
this.gridControlEx.MainView = this.gridView;
this.gridControlEx.Margin = new System.Windows.Forms.Padding(2);
this.gridControlEx.Name = "gridControlEx";
this.gridControlEx.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
this.repositoryItemMemoEdit1,
this.repositoryItemMemoExEdit1,
this.repositoryItemTextEdit1,
this.repositoryItemTextEdit2,
this.repositoryItemTextEdit3,
this.repositoryItemTimeEdit1,
this.repositoryItemMemoEdit2,
this.repositoryItemMemoEdit3});
this.gridControlEx.Size = new System.Drawing.Size(461, 290);
this.gridControlEx.TabIndex = 4;
this.gridControlEx.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
this.gridView});
this.gridControlEx.MouseEnter += new System.EventHandler(this.OnTsmiMouseEnter);
this.gridControlEx.MouseLeave += new System.EventHandler(this.OnTsmiMouseLeave);
//
// gridView
//
this.gridView.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
this.AuditMessages,
this.OperateDate,
this.CreateUserName});
this.gridView.GridControl = this.gridControlEx;
this.gridView.Name = "gridView";
this.gridView.OptionsBehavior.Editable = false;
this.gridView.OptionsView.RowAutoHeight = true;
this.gridView.OptionsView.ShowGroupPanel = false;
this.gridView.OptionsView.ShowIndicator = false;
//
// AuditMessages
//
this.AuditMessages.Caption = "待处理审批";
this.AuditMessages.ColumnEdit = this.repositoryItemMemoEdit1;
this.AuditMessages.FieldName = "AuditMessages";
this.AuditMessages.Name = "AuditMessages";
this.AuditMessages.Visible = true;
this.AuditMessages.VisibleIndex = 0;
this.AuditMessages.Width = 225;
//
// repositoryItemMemoEdit1
//
this.repositoryItemMemoEdit1.Appearance.Options.UseTextOptions = true;
this.repositoryItemMemoEdit1.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
this.repositoryItemMemoEdit1.Name = "repositoryItemMemoEdit1";
//
// OperateDate
//
this.OperateDate.Caption = "发生时间";
this.OperateDate.ColumnEdit = this.repositoryItemMemoEdit3;
this.OperateDate.FieldName = "OperateDate";
this.OperateDate.Name = "OperateDate";
this.OperateDate.Visible = true;
this.OperateDate.VisibleIndex = 1;
this.OperateDate.Width = 91;
//
// repositoryItemMemoEdit3
//
this.repositoryItemMemoEdit3.Name = "repositoryItemMemoEdit3";
//
// CreateUserName
//
this.CreateUserName.Caption = "发起人";
this.CreateUserName.ColumnEdit = this.repositoryItemTextEdit2;
this.CreateUserName.FieldName = "CreateUserName";
this.CreateUserName.Name = "CreateUserName";
this.CreateUserName.Visible = true;
this.CreateUserName.VisibleIndex = 2;
this.CreateUserName.Width = 63;
//
// repositoryItemTextEdit2
//
this.repositoryItemTextEdit2.AutoHeight = false;
this.repositoryItemTextEdit2.Name = "repositoryItemTextEdit2";
//
// repositoryItemMemoExEdit1
//
this.repositoryItemMemoExEdit1.AutoHeight = false;
this.repositoryItemMemoExEdit1.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.repositoryItemMemoExEdit1.Name = "repositoryItemMemoExEdit1";
//
// repositoryItemTextEdit1
//
this.repositoryItemTextEdit1.AutoHeight = false;
this.repositoryItemTextEdit1.Name = "repositoryItemTextEdit1";
//
// repositoryItemTextEdit3
//
this.repositoryItemTextEdit3.AutoHeight = false;
this.repositoryItemTextEdit3.Name = "repositoryItemTextEdit3";
//
// repositoryItemTimeEdit1
//
this.repositoryItemTimeEdit1.AutoHeight = false;
this.repositoryItemTimeEdit1.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.repositoryItemTimeEdit1.Name = "repositoryItemTimeEdit1";
//
// repositoryItemMemoEdit2
//
this.repositoryItemMemoEdit2.Name = "repositoryItemMemoEdit2";
//
// blinkTimer
//
this.blinkTimer.Interval = 500;
this.blinkTimer.Tick += new System.EventHandler(this.OnBlinkTimerTick);
//
// FrmMain
//
this.Appearance.BackColor = System.Drawing.SystemColors.Control;
this.Appearance.Options.UseBackColor = true;
this.Appearance.Options.UseFont = true;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(461, 290);
this.Controls.Add(this.gridControlEx);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmMain";
this.Text = "待处理任务";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.OnMainFormClosing);
this.Load += new System.EventHandler(this.OnMainLoad);
this.SizeChanged += new System.EventHandler(this.OnFrmMainSizeChanged);
this.contextMenuStrip1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridControlEx)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemMemoEdit1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemMemoEdit3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemTextEdit2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemMemoExEdit1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemTextEdit1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemTextEdit3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemTimeEdit1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemMemoEdit2)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Timer timer3;
private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem TsmiShow;
private System.Windows.Forms.ToolStripMenuItem TsmiClose;
private DevExpress.XtraGrid.GridControl gridControlEx;
private DevExpress.XtraGrid.Views.Grid.GridView gridView;
private DevExpress.XtraGrid.Columns.GridColumn OperateDate;
private System.Windows.Forms.Timer blinkTimer;
private System.Windows.Forms.ToolStripMenuItem tsmiSetting;
private System.Windows.Forms.ToolStripMenuItem tsmiShowWindow;
private System.Windows.Forms.ToolStripMenuItem tsmiFlicker;
private System.Windows.Forms.ToolStripMenuItem tsmiExitByMain;
private DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit repositoryItemMemoEdit1;
private DevExpress.XtraEditors.Repository.RepositoryItemMemoExEdit repositoryItemMemoExEdit1;
private DevExpress.XtraGrid.Columns.GridColumn AuditMessages;
private DevExpress.XtraEditors.Repository.RepositoryItemTextEdit repositoryItemTextEdit1;
private DevExpress.XtraGrid.Columns.GridColumn CreateUserName;
private DevExpress.XtraEditors.Repository.RepositoryItemTextEdit repositoryItemTextEdit2;
private DevExpress.XtraEditors.Repository.RepositoryItemTextEdit repositoryItemTextEdit3;
private DevExpress.XtraEditors.Repository.RepositoryItemTimeEdit repositoryItemTimeEdit1;
private DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit repositoryItemMemoEdit2;
private DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit repositoryItemMemoEdit3;
}
}
+780
View File
@@ -0,0 +1,780 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraGrid.Views.Grid;
using Lskj.Control;
using Lskj.Core;
using Lskj.Util;
using Lskj.Business.Impl;
using Lskj.Model;
using Lskj.Data;
using Lskj.Notice.Properties;
using DevExpress.XtraGrid;
using Lskj.Business;
namespace Lskj.Notice
{
/// <summary>
/// 通知界面
/// </summary>
public partial class FrmMain : BaseForm
{
string mUserID;
string mUserName;
string mUserPassword;
private bool blink = false;
private Icon blank = Resources.blank;
private Icon striped = Resources.logo;
private bool mouseinform = false;
private int LastRowCount;//上一次记录的行数
private bool FirstEntry=true;//是否是第一次进入
/// <summary>
/// 语言设置,设置后为true
/// </summary>
public bool LanguageSettings = false;
/// <summary>
/// 语言
/// </summary>
public string Language;
/// <summary>
/// 语言设置,设置后为true
/// </summary>
// public bool LanguageSettings = false;
public FrmMain(string[] args)
{
InitializeComponent();
this.gridView.DoubleClick += new EventHandler(OnGridViewDoubleClick);
if (args != null && args.Length > 1)
{
this.mUserID = args[0];
this.mUserName = args[1];
this.mUserPassword = args[2];
}
this.tsmiShowWindow.Checked = DBConfig.Instance.NoticeShowWindow;//新消息弹窗
this.tsmiFlicker.Checked = DBConfig.Instance.NoticeFlicker;//新消息闪烁
this.tsmiExitByMain.Checked = DBConfig.Instance.NoticeExit;//随主系统退出
}
/// <summary>
/// <para>说明:显示窗口</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2019-09-10 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
void ThreadShowFrom()
{
int x = Screen.PrimaryScreen.WorkingArea.Width - this.Width;
int y = Screen.PrimaryScreen.WorkingArea.Height - this.Height;
this.SetDesktopLocation(x, y);
//Point p = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
//this.PointToClient(p);
//this.Location = p;
//this.Show();
//for (int i = 0; i < this.Height; i++)
//{
// this.Location = new Point(p.X, p.Y - i);
// System.Threading.Thread.Sleep(1);
//}
}
/// <summary>
/// <para>说明:显示普通窗口</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2019-09-10 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
void NormalShowForm()
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Activate();
this.WindowState = FormWindowState.Normal;
this.ShowInTaskbar = true;
this.notifyIcon1.Visible = false;
}
}
/// <summary>
/// <para>说明:重新加载表格数据</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2019-09-10 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
void ReloadGridData()
{
try
{
DBConfig.Instance.ReadConfig();
DBConfig.Instance.CreateConnection();
ERPInfo.Instance.UserId = DBConfig.Instance.NoticeUserID;
ERPInfo.Instance.UserName = DBConfig.Instance.NoticeUserName;
ERPInfo.Instance.Password = mUserPassword;
mUserName = DBConfig.Instance.NoticeUserName;
//判断是否存在多语种的情况
if (!LanguageSettings)
{
if (!string.IsNullOrWhiteSpace(ERPInfo.Instance.UserId))
{
string sql = string.Format("select useLanguage from P_EmployeeTab where EmployeeId='{0}'", ERPInfo.Instance.UserId);
this.Language = SqlHelper.ExecuteScalar(sql) + "";
if (string.IsNullOrWhiteSpace(this.Language)) this.Language = "中文";
ERPInfo.Instance.LanguageName = this.Language;
this.LanguageSettings = true;
}
}
}
catch (Exception)
{
}
string sqlStr = string.Empty;
DataTable data = NoticeImpl.GetNoticeData2(ERPInfo.Instance.UserId,out sqlStr);
int rowCount = data == null ? 0 : data.Rows.Count;
this.gridControlEx.DataSource = data;
this.Text = "您有" + rowCount + "条任务需要处理(提示:双击即可处理).";
if (rowCount > 0)
{
// 开启新消息弹窗
if (this.tsmiShowWindow.Checked)
{
this.NormalShowForm();
}
// 开启、关闭新消息闪烁
if (FirstEntry)
{
this.blinkTimer.Enabled = this.tsmiFlicker.Checked;
FirstEntry = false;
}
//开启了闪烁,并且当前数量大于上一次数量,才闪烁
if (this.tsmiFlicker.Checked && rowCount > LastRowCount && this.timer3.Enabled)
{
this.blinkTimer.Enabled = this.tsmiFlicker.Checked;
}
LastRowCount = rowCount;
}
else
{
//this.WindowState = FormWindowState.Minimized;
this.blinkTimer.Enabled = false;
}
}
/// <summary>
/// 打开基础或单据模块审批模块
/// </summary>
void OpenAuditControl(DataRow rowItem)
{
try
{
bool isCustomNotice = false;
string BetweenDLLCoid = string.Empty;
String[] AutoParame = rowItem["dllname"].ToString().Split('^');
if (AutoParame.Count() >= 4)
{
rowItem["dllname"] = AutoParame[0];
rowItem["keyvalue"] = AutoParame[1];
rowItem["modulename"] = AutoParame[2];
if (AutoParame[0].Equals("MiniBlink.dll", StringComparison.CurrentCultureIgnoreCase) || AutoParame[0].Equals("Lskj.PubBrower.dll", StringComparison.CurrentCultureIgnoreCase))
{
BetweenDLLCoid = AutoParame[3];
}
else
{
rowItem["stepcode"] = AutoParame[3];
}
isCustomNotice = true;
}
string[] defaultArgs = string.Format(ModuleArgs.DefaultArgs, rowItem["modulename"] + "", ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, 1, rowItem["moduleid"] + "").Split('~');
string[] menuArgs = new string[] { "0", rowItem["moduleid"] + "", rowItem["stepcode"] + "", rowItem["keyvalue"] + "", "0", "0" };
string dllName = rowItem["dllname"] + "";
dllName = dllName.ToLower();
switch (dllName)
{
case "lskj.baseinfo.dll":
menuArgs = new string[] { "1", rowItem["moduleid"] + "", rowItem["keyvalue"] + "" };
break;
case "lskj.pubbillinfo.dll":
menuArgs = new string[] { rowItem["moduleid"] + "", rowItem["keyvalue"] + "", rowItem["modulename"] + "", rowItem["stepcode"] + "" };
break;
case "lskj.pubbill.dll":
menuArgs = new string[] { "", rowItem["moduleid"] + "" };
break;
case "lskj.pubmoduledetail.dll":
menuArgs = new string[] { "", rowItem["moduleid"] + "" };
break;
case "miniblink.dll":
menuArgs = new string[] { "", rowItem["keyvalue"] + "", BetweenDLLCoid };
break;
case "pubbrower.dll":
menuArgs = new string[] { "", rowItem["keyvalue"] + "", BetweenDLLCoid };
break;
case "lskj.pubbrower.dll":
menuArgs = new string[] { "", rowItem["keyvalue"] + "", BetweenDLLCoid };
break;
}
if ("2".Equals(rowItem["messid"] + ""))
{
menuArgs = new string[] { "0", rowItem["moduleid"] + "", rowItem["stepcode"] + "", rowItem["keyvalue"] + "", "1", "0" };
}
string[] args = defaultArgs.Concat(menuArgs).ToArray();
IForm form = FormHelper.LoadDllForm(dllName, args);
if (dllName.Equals("miniblink.dll")) form.SubForm.WindowState = FormWindowState.Maximized;
if (dllName.Equals("lskj.pubmoduledetail.dll")|| dllName.Equals("lskj.pubbill.dll")) form.SubForm.WindowState = FormWindowState.Maximized;//默认全部最大化
DialogResult result = form.SubForm.ShowDialog();
if (result != DialogResult.OK && ("1".Equals(rowItem["messid"] + "") || "2".Equals(rowItem["messid"] + "")))
{
//if ("2".Equals(rowItem["messid"] + ""))
//{
// NoticeImpl.UpdRemindField(rowItem, dllName);
//}
NoticeImpl.UpeNoticeData(rowItem, isCustomNotice);
string sqlStr = string.Empty;
DataTable data = NoticeImpl.GetNoticeData2(ERPInfo.Instance.UserId,out sqlStr);
int rowCount = data == null ? 0 : data.Rows.Count;
this.gridControlEx.DataSource = data;
this.Text = "您有" + rowCount + "条任务需要处理(提示:双击即可处理).";
}
}
catch (Exception ex)
{
//MessageUtil.Show(ex);
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message);
}
}
/// <summary>
/// <para>说明:窗户加载</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2019-09-10 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
void OnMainLoad(object sender, EventArgs e)
{
try
{
DBConfig.Instance.CreateConnection();
if (!DBConfig.Instance.CreateConnection(DBConfig.Instance.Connection))
{
MessageUtil.Show(ResourceKeys.ServerAddressFault);
return;
}
else
{
if (DelphiHelper.Delphi_Init(new StringBuilder(DBConfig.Instance.GetDelphiConnection(DBConfig.Instance.dephiConnection))) == 0)
{
MessageUtil.Show(ResourceKeys.UnConnectServer + "[By Delphi]");
return;
}
}
if (!BaseImpl.HasExistsTable("p_systemNoticeSheet"))
{
NoticeImpl.CreationNoticeTable();
}
//判断是否存在多语种的情况
if (BaseImpl.HasExistsColumn("P_EmployeeTab", "useLanguage"))
{
if (!string.IsNullOrWhiteSpace(ERPInfo.Instance.UserId))
{
string sql = string.Format("select useLanguage from P_EmployeeTab where EmployeeId='{0}'", ERPInfo.Instance.UserId);
this.Language = SqlHelper.ExecuteScalar(sql)+"";
if (string.IsNullOrWhiteSpace(this.Language)) this.Language = "中文";
ERPInfo.Instance.LanguageName = this.Language;
this.LanguageSettings = true;
}
}
else
{
this.LanguageSettings = true;
this.Language = "中文";
}
SetDelphiDllParams();
this.tsmiFlicker.Checked = DBConfig.Instance.NoticeFlicker;
this.tsmiShowWindow.Checked = DBConfig.Instance.NoticeShowWindow;
string sqlStr = string.Empty;
DataTable data = NoticeImpl.GetNoticeData2(ERPInfo.Instance.UserId,out sqlStr);
int rowCount = data == null ? 0 : data.Rows.Count;
this.gridControlEx.DataSource = data;
this.Text = "您有" + rowCount + "条任务需要处理(提示:双击即可处理).";
this.ThreadShowFrom();
if (rowCount == 0)
this.WindowState = FormWindowState.Minimized;
if (SystemInfo.Instance.MessageRefreshTime > 0) this.timer3.Interval = SystemInfo.Instance.MessageRefreshTime * 1000;
if (SystemInfo.Instance.MessageFlicker) this.tsmiFlicker.Checked = DBConfig.Instance.NoticeFlicker = true;
this.timer3.Start();
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message);
}
finally
{
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this);
}
}
/// <summary>
/// <para>说明:重新加载数据</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2019-09-10 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
void OnTimerReloadTick(object sender, EventArgs e)
{
try
{
if (!mouseinform)
{
this.ReloadGridData();
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message);
}
}
/// <summary>
/// <para>说明:点击打开审批界面</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期:2020-08-03 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs"/> instance containing the event data.</param>
void OnGridViewDoubleClick(object sender, EventArgs e)
{
try
{
DataRow rowItem = this.gridView.GetFocusedDataRow();
if (rowItem != null)
{
//设置第一次点击时间
if (rowItem.Table.Columns.Contains("FirstViewTime"))
{
string tableName = rowItem["TableName"]+"";
string id= rowItem["id"]+"";
if (tableName.Equals("p_systemMessageTab")&&string.IsNullOrWhiteSpace(rowItem["FirstViewTime"] + ""))
{
NoticeImpl.UpeNoticeData(tableName, id);
}
}
if (rowItem["messid"] + "" == "1" && string.IsNullOrWhiteSpace(rowItem["dllname"] + ""))
{
// 保存小类设置
FrmNoticePrompt frmNoticePrompt = new FrmNoticePrompt();
frmNoticePrompt.TextBoxObj.Text = BaseImpl.HasExistsTable("p_systemMessageTab") ? rowItem["keyvalue"] + "" : rowItem["Msg"] + "";
if (frmNoticePrompt.ShowDialog() == DialogResult.OK)
{
NoticeImpl.UpeNoticeData(rowItem);
string sqlStr = string.Empty;
DataTable data = NoticeImpl.GetNoticeData2(ERPInfo.Instance.UserId,out sqlStr);
int rowCount = data == null ? 0 : data.Rows.Count;
this.gridControlEx.DataSource = data;
this.Text = "您有" + rowCount + "条任务需要处理(提示:双击即可处理).";
}
}
else
{
OpenAuditControl(rowItem);
}
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message);
}
}
/// <summary>
/// <para>说明:最小化到托盘</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2019-09-10 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="FormClosingEventArgs"/> instance containing the event data.</param>
void OnMainFormClosing(object sender, FormClosingEventArgs e)
{
try
{
this.WindowState = FormWindowState.Minimized;
e.Cancel = true;
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message);
}
}
/// <summary>
/// <para>说明:显示窗口</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2019-09-10 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
void OnTsmiShowClick(object sender, EventArgs e)
{
try
{
this.NormalShowForm();
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message);
}
}
/// <summary>
/// <para>说明:退出系统</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2019-09-10 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
void OnTsmiCloseClick(object sender, EventArgs e)
{
try
{
if (MessageUtil.Show("确定要退出任务监视工具?\r\n退后后将无法收到审批消息.", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
{
try
{
notifyIcon1.Dispose();
this.Dispose();
this.Close();
}
catch (Exception)
{
}
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message);
}
}
/// <summary>
/// <para>说明:窗口最小化时显示图标</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2019-09-10 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
void OnFrmMainSizeChanged(object sender, EventArgs e)
{
try
{
if (WindowState == FormWindowState.Minimized)
{
this.ShowInTaskbar = false;
this.notifyIcon1.Visible = true;
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message);
}
}
/// <summary>
/// <para>说明:左键点击打开消息列表</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2019-09-10 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
void OnNotifyIconMouseClick(object sender, MouseEventArgs e)
{
try
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
this.NormalShowForm();
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message);
}
}
/// <summary>
/// <para>说明:闪烁图标</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期: </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
void OnBlinkTimerTick(object sender, EventArgs e)
{
try
{
if (!blink)
{
this.notifyIcon1.Icon = striped;
}
else
{
this.notifyIcon1.Icon = blank;
}
blink = !blink;
}
catch (Exception)
{
}
}
/// <summary>
/// <para>说明:</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期: </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
void OnTsmiShowWindowClick(object sender, EventArgs e)
{
try
{
this.tsmiShowWindow.Checked = !this.tsmiShowWindow.Checked;
DBConfig.Instance.NoticeShowWindow = this.tsmiShowWindow.Checked;
DBConfig.Instance.WriteConfig();
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message);
}
}
/// <summary>
/// <para>说明:</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期: </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
void OnTsmiFlickerClick(object sender, EventArgs e)
{
try
{
this.tsmiFlicker.Checked = !this.tsmiFlicker.Checked;
DBConfig.Instance.NoticeFlicker = this.tsmiFlicker.Checked;
DBConfig.Instance.WriteConfig();
blink = false;
this.notifyIcon1.Icon = striped;
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message);
}
}
/// <summary>
/// <para>说明:随主系统退出</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期: </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
void OnTsmiExitByMainClick(object sender, EventArgs e)
{
try
{
this.tsmiExitByMain.Checked = !this.tsmiExitByMain.Checked;
DBConfig.Instance.NoticeExit = this.tsmiExitByMain.Checked;
DBConfig.Instance.WriteConfig();
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message);
}
}
/// <summary>
/// <para>说明:清除所有标识为1的消息</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期: </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void OnTsmiCleanAllClick(object sender, EventArgs e)
{
try
{
NoticeImpl.UpeNoticeData("1");
string sqlStr = string.Empty;
DataTable data = NoticeImpl.GetNoticeData2(ERPInfo.Instance.UserId,out sqlStr);
int rowCount = data == null ? 0 : data.Rows.Count;
this.gridControlEx.DataSource = data;
this.Text = "您有" + rowCount + "条任务需要处理(提示:双击即可处理).";
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message);
}
}
/// <summary>
/// <para>说明:鼠标进入窗体事件</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期: </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void OnTsmiMouseEnter(object sender, EventArgs e)
{
mouseinform = true;
this.blinkTimer.Enabled = false;
this.notifyIcon1.Icon = striped;
}
/// <summary>
/// <para>说明:鼠标离开窗体事件</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期: </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void OnTsmiMouseLeave(object sender, EventArgs e)
{
mouseinform = false;
}
/// <summary>
/// <para>说明:设置delphi参数</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2018-03-12 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void SetDelphiDllParams()
{
try
{
StringBuilder sb1 = new StringBuilder();
sb1.Append(ERPInfo.Instance.UserName);
StringBuilder sb2 = new StringBuilder();
sb2.Append(ERPInfo.Instance.WindowName);
StringBuilder sb3 = new StringBuilder();
sb3.Append(ERPInfo.Instance.SkinName);
//给delphi库设置参数(用户id、子系统id、操作员名称、计算机名称)
DelphiHelper.Delphi_SetParams(Convert.ToInt32(ERPInfo.Instance.UserId), Convert.ToInt32(ERPInfo.Instance.SubSysId), sb1, sb2, sb3);
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
LogHelper.Instance.WriteError(ex);
//LogUtil.WriteError("设置delphi参数错误", ex);
}
}
}
}
File diff suppressed because it is too large Load Diff
+110
View File
@@ -0,0 +1,110 @@
namespace Lskj.Notice
{
partial class FrmNoticePrompt
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnCancel = new DevExpress.XtraEditors.SimpleButton();
this.btnOK = new DevExpress.XtraEditors.SimpleButton();
this.label1 = new System.Windows.Forms.Label();
this.txtEdit = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// btnCancel
//
this.btnCancel.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnCancel.Appearance.Options.UseFont = true;
this.btnCancel.Location = new System.Drawing.Point(357, 160);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(80, 28);
this.btnCancel.TabIndex = 24;
this.btnCancel.TabStop = false;
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.OnBtnCancelClick);
//
// btnOK
//
this.btnOK.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnOK.Appearance.Options.UseFont = true;
this.btnOK.Location = new System.Drawing.Point(68, 160);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(80, 28);
this.btnOK.TabIndex = 23;
this.btnOK.TabStop = false;
this.btnOK.Text = "确定";
this.btnOK.Click += new System.EventHandler(this.OnBtnOKClick);
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.ForeColor = System.Drawing.Color.Blue;
this.label1.Location = new System.Drawing.Point(12, 18);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(136, 16);
this.label1.TabIndex = 22;
this.label1.Text = "请确认审核消息:";
//
// txtEdit
//
this.txtEdit.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtEdit.Location = new System.Drawing.Point(51, 46);
this.txtEdit.Multiline = true;
this.txtEdit.Name = "txtEdit";
this.txtEdit.ReadOnly = true;
this.txtEdit.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtEdit.Size = new System.Drawing.Size(386, 94);
this.txtEdit.TabIndex = 25;
//
// FrmNoticePrompt
//
this.Appearance.BackColor = System.Drawing.SystemColors.Control;
this.Appearance.Options.UseBackColor = true;
this.Appearance.Options.UseFont = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(487, 200);
this.Controls.Add(this.txtEdit);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.label1);
this.Name = "FrmNoticePrompt";
this.Text = "信息确认框";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private DevExpress.XtraEditors.SimpleButton btnCancel;
private DevExpress.XtraEditors.SimpleButton btnOK;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtEdit;
}
}
+63
View File
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using Lskj.Control;
using Lskj.Business.Impl;
namespace Lskj.Notice
{
public partial class FrmNoticePrompt : BaseForm
{
public FrmNoticePrompt()
{
InitializeComponent();
}
public TextBox TextBoxObj { get { return txtEdit; } }
/// <summary>
/// <para>说明:确定事件</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期:2020-08-20 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
void OnBtnOKClick(object sender, EventArgs e)
{
try
{
this.Close();
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
catch (Exception ex)
{
//MessageUtil.Show(ex);
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message,ex.Message);
}
}
/// <summary>
/// <para>说明:取消事件</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期:2019-08-20 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
void OnBtnCancelClick(object sender, EventArgs e)
{
this.Close();
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+161
View File
@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{940214A8-6D8E-46F0-BCA3-112747ACE3A4}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Lskj.Notice</RootNamespace>
<AssemblyName>Ls_Notice</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\..\Debug\AllMethodXml\Ls_Notice.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>logo.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Printing.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Sparkline.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Utils.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraEditors.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraGrid.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraLayout.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraPrinting.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Xilium.CefGlue, Version=87.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\引用DLL\Xilium.CefGlue.dll</HintPath>
</Reference>
<Reference Include="Xilium.CefGlue.WindowsForms, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\引用DLL\Xilium.CefGlue.WindowsForms.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="DelphiHelper.cs" />
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="FrmNoticePrompt.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmNoticePrompt.Designer.cs">
<DependentUpon>FrmNoticePrompt.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MessageBoxWaterMark.cs" />
<Compile Include="winApi.cs" />
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmNoticePrompt.resx">
<DependentUpon>FrmNoticePrompt.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lskj.Business\Lskj.Business.csproj">
<Project>{7EAFCCC2-A18F-49E9-85C6-A984966CFD01}</Project>
<Name>Lskj.Business</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Control\Lskj.Control.csproj">
<Project>{447CDC40-659F-4CCA-9ED6-8E818B4CF8BF}</Project>
<Name>Lskj.Control</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Core\Lskj.Core.csproj">
<Project>{2A1BE6AC-1077-491B-A754-C5822FE8121E}</Project>
<Name>Lskj.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Data\Lskj.Data.csproj">
<Project>{308B9B18-9BE2-495C-9C64-EED81D567813}</Project>
<Name>Lskj.Data</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Model\Lskj.Model.csproj">
<Project>{52BC40E0-C0C6-4F78-996B-CAE028D209CA}</Project>
<Name>Lskj.Model</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Util\Lskj.Util.csproj">
<Project>{A51BF642-6543-4DE3-8948-83F558B72BD4}</Project>
<Name>Lskj.Util</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="logo.ico" />
<None Include="Resources\right.png" />
<None Include="Resources\blank.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Lskj.Notice
{
public class MessageBoxWaterMark
{
/// <summary>
/// 文本内容
/// </summary>
public string Text;
}
}
+127
View File
@@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;
using System.Diagnostics;
using Lskj.Control;
using Lskj.Util;
using Xilium.CefGlue;
namespace Lskj.Notice
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
CefRuntime.Load();//cef浏览器模块设置加载
var mainArgs = new CefMainArgs(args);
var app = new DemoApp();
var exitCode = CefRuntime.ExecuteProcess(mainArgs, app);
var settings = new CefSettings
{
MultiThreadedMessageLoop = true,
LogSeverity = CefLogSeverity.Disable,
LogFile = "CefGlue.log",
Locale = "zh-CN"
};
CefRuntime.Initialize(mainArgs, settings, app);
try
{
bool isRunning = false;
Mutex mutex = new Mutex(true, Process.GetCurrentProcess().ProcessName, out isRunning);
if (isRunning)
{
Application.EnableVisualStyles();
AboutDevCompanion DC = new AboutDevCompanion(1, false);
DC.Run();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmMain(args));
DC.Stop();
Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
mutex.ReleaseMutex();
}
else
{
//MessageUtil.Show("程序已启动.");
if (!settings.MultiThreadedMessageLoop)
{
Application.Idle += (sender, e) => { CefRuntime.DoMessageLoopWork(); };
CefRuntime.Shutdown();
}
}
}
catch (Exception ex)
{
}
}
/// <summary>
/// <para>说明:处理异常</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-11-22 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="ThreadExceptionEventArgs"/> instance containing the event data.</param>
static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
MessageUtil.Show(e.Exception);
LogHelper.Instance.WriteError(e.Exception);
}
/// <summary>
/// <para>说明:处理异常</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期:2021-07-08 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="ThreadExceptionEventArgs"/> instance containing the event data.</param>
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Console.WriteLine(e.ExceptionObject.ToString());
MessageUtil.Show(e.ExceptionObject.ToString());
}
class SingleApplication
{
[DllImport("Kernel32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr OpenMutex(uint dwDesiredAccess, int bInheritHandle, string lpName);
[DllImport("Kernel32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr CreateMutex(IntPtr lpMutexAttributes, int bInitialOwner, string lpName);
public static bool IsRunning(string appID)
{
bool running = false;
if (OpenMutex(0x1F0001, 0, appID) == IntPtr.Zero)
{
CreateMutex(IntPtr.Zero, 0, appID);
running = true;
}
return running;
}
}
internal sealed class DemoApp : CefApp
{
protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
{
commandLine.AppendSwitch("ppapi-flash-version", "28.0.0.137");
commandLine.AppendSwitch("ppapi-flash-path", @"D:\测试\LSERP\Debug\pepflashplayer.dll");
}
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Hoker.Notice")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Hoker.Notice")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("739fe2ac-ddec-4c14-9e9b-eeade7e8c03f")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 内部版本号
// 修订号
//
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+93
View File
@@ -0,0 +1,93 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.18408
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Lskj.Notice.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Lskj.Notice.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找类似于 (Icon) 的 System.Drawing.Icon 类型的本地化资源。
/// </summary>
internal static System.Drawing.Icon blank {
get {
object obj = ResourceManager.GetObject("blank", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// 查找类似于 (Icon) 的 System.Drawing.Icon 类型的本地化资源。
/// </summary>
internal static System.Drawing.Icon logo {
get {
object obj = ResourceManager.GetObject("logo", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap right {
get {
object obj = ResourceManager.GetObject("right", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="blank" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\blank.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="right" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
+26
View File
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.18408
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Lskj.Notice.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

+35
View File
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NPOI" publicKeyToken="0df73ec7942b34e1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.3.1" newVersion="2.1.3.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Spire.XLS" publicKeyToken="663f351905198cb3" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.3.8.0" newVersion="10.3.8.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Spire.Presentation" publicKeyToken="663f351905198cb3" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.3.6.0" newVersion="5.3.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Spire.Doc" publicKeyToken="663f351905198cb3" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.3.15.0" newVersion="8.3.15.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

+372
View File
@@ -0,0 +1,372 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Lskj.Notice
{
public static class WinAPI
{
#region
public const int GWL_WNDPROC = -4; //得到窗口回调函数的地址,或者句柄。得到后必须使用CallWindowProc函数来调用
public const int GWL_HINSTANCE = -6; //得到应用程序运行实例的句柄
public const int GWL_HWNDPARENT = -8; //得到父窗口的句柄
public const int GWL_STYLE = -16; //得到窗口风格
public const int GWL_EXSTYLE = -20; //得到扩展的窗口风格
public const int GWL_USERDATA = -21; //得到和窗口相关联的32位的值(每一个窗口都有一个有意留给创建窗口的应用程序是用的32位的值)
public const int GWL_ID = -12; //得到窗口的标识符
public const int DWL_MSGRESULT = 0;
public const int DWL_DLGPROC = 4;
public const int DWL_USER = 8;
public const int HWND_BOTTOM = 1;
public const int HWND_TOP = 0;
public const int HWND_TOPMOST = -1;
public const int HWND_NOTOPMOST = -2;
public const int SWP_DRAW = 0x20;
public const int SWP_HIDEWINDOW = 0x80;
public const int SWP_NOACTIVATE = 0x10;
public const int SWP_NOMOVE = 0x2;
public const int SWP_NOREDRAW = 0x8;
public const int SWP_NOSIZE = 0x1;
public const int SWP_NOZORDER = 0x4;
public const int SWP_SHOWWINDOW = 0x40;
public const int WS_OVERLAPPED = 0;
public const int WS_BORDER = 0x800000;
public const int WS_CAPTION = 0xC00000;
public const int WS_CHILD = 0x40000000;
public const int WS_DLGFRAME = 0x400000;
public const int WS_SIZEBOX = 0x40000;
public const int WS_MAXIMIZEBOX = 0x10000;
public const int WS_MINIMIZEBOX = 0x20000;
public const int WS_SYSMENU = 0x80000;
public const int WS_HSCROLL = 0x100000;
public const int WS_VSCROLL = 0x200000;
public const int WA_INACTIVE = 0;
public const int WA_ACTIVE = 1;
public const int WA_CLICKACTIVE = 2;
public const int WM_NOTIFY = 0x004E;
public const int WM_ACTIVATE = 0x0006;
public const int WM_NULL = 0x0000;
public const int WM_CREATE = 0x0001;
public const int WM_DESTROY = 0x0002;
public const int WM_MOVE = 0x0003;
public const int WM_SIZE = 0x0005;
public const int WM_SETFOCUS = 0x0007;
public const int WM_MOUSEACTIVATE = 0x0021;
public const int WM_CLOSE = 0x0010;
public const int WM_QUIT = 0x0012;
public const int WM_KEYDOWN = 0x0100;
public const int WM_KEYUP = 0x0101;
public const int WM_CHAR = 0x0102;
public const int WM_DEADCHAR = 0x0103;
public const int WM_SYSKEYDOWN = 0x0104;
public const int WM_SYSKEYUP = 0x0105;
public const int WM_SYSCHAR = 0x0106;
public const int WM_SYSDEADCHAR = 0x0107;
public const int WM_UNICHAR = 0x0109;
public const int WM_KEYLAST = 0x0109;
public const int UNICODE_NOCHAR = 0xFFFF;
public const int MK_LBUTTON = 0x0001;
public const int MK_RBUTTON = 0x0002;
public const int MK_SHIFT = 0x0004;
public const int MK_CONTROL = 0x0008;
public const int MK_MBUTTON = 0x0010;
public const int WM_MOUSEFIRST = 0x0200;
public const int WM_MOUSEMOVE = 0x0200;
public const int WM_LBUTTONDOWN = 0x0201;
public const int WM_LBUTTONUP = 0x0202;
public const int WM_LBUTTONDBLCLK = 0x0203;
public const int WM_RBUTTONDOWN = 0x0204;
public const int WM_RBUTTONUP = 0x0205;
public const int WM_RBUTTONDBLCLK = 0x0206;
public const int WM_MBUTTONDOWN = 0x0207;
public const int WM_MBUTTONUP = 0x0208;
public const int WM_MBUTTONDBLCLK = 0x0209;
public const int WM_MOUSEWHEEL = 0x020A;
public const int WM_MDICREATE = 0x0220;
public const int WM_ERASEBKGND = 0x14;
public const int WM_PAINT = 0xF;
public const int WM_NC_HITTEST = 0x84;
public const int WM_NC_PAINT = 0x85;
public const int WM_PRINTCLIENT = 0x318;
public const int WM_SETCURSOR = 0x20;
public const int BM_CLICK = 0x00F5;
public const int BM_GETIMAGE = 0x00F6;
public const int BM_SETIMAGE = 0x00F7;
public const int VK_BACK = 0x08;
public const int VK_TAB = 0x09;
public const int VK_CLEAR = 0x0C;
public const int VK_RETURN = 0x0D;
public const int VK_SHIFT = 0x10;
public const int VK_CONTROL = 0x11;
public const int VK_MENU = 0x12;
public const int VK_PAUSE = 0x13;
public const int VK_CAPITAL = 0x14;
public const int VK_KANA = 0x15;
public const int VK_HANGEUL = 0x15;
public const int VK_HANGUL = 0x15;
public const int VK_JUNJA = 0x17;
public const int VK_FINAL = 0x18;
public const int VK_HANJA = 0x19;
public const int VK_KANJI = 0x19;
public const int VK_ESCAPE = 0x1B;
public const int VK_CONVERT = 0x1C;
public const int VK_NONCONVERT = 0x1D;
public const int VK_ACCEPT = 0x1E;
public const int VK_MODECHANGE = 0x1F;
public const int VK_SPACE = 0x20;
public const int VK_PRIOR = 0x21;
public const int VK_NEXT = 0x22;
public const int VK_END = 0x23;
public const int VK_HOME = 0x24;
public const int VK_LEFT = 0x25;
public const int VK_UP = 0x26;
public const int VK_RIGHT = 0x27;
public const int VK_DOWN = 0x28;
public const int VK_SELECT = 0x29;
public const int VK_PRINT = 0x2A;
public const int VK_EXECUTE = 0x2B;
public const int VK_SNAPSHOT = 0x2C;
public const int VK_INSERT = 0x2D;
public const int VK_DELETE = 0x2E;
public const int VK_HELP = 0x2F;
public const int KEYEVENTF_EXTENDEDKEY = 0x0001;
public const int KEYEVENTF_KEYUP = 0x0002;
public const int KEYEVENTF_UNICODE = 0x0004;
public const int KEYEVENTF_SCANCODE = 0x0008;
public const int HC_ACTION = 0x0;
public const int WH_MOUSELL = 0xE;
public const int STATUS_SUCCESS = 0x0;
#endregion
#region API函数声明
[DllImport("user32.dll", EntryPoint = "SetParent")]
public static extern int SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll", EntryPoint = "GetParent")]
public static extern int GetParent(IntPtr hWnd);
[DllImport("user32.dll", EntryPoint = "GetWindowLong")]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
public static extern int GetWindowRect(IntPtr hwnd, out Rect lpRect);
[DllImport("user32.dll", EntryPoint = "SetWindowLong")]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int lNewLong);
[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
public static extern bool SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int cx, int cy, int uFlags);
[DllImport("user32.dll", EntryPoint = "UpdateWindow")]
public static extern bool UpdateWindow(IntPtr hWnd);
[DllImport("user32.dll", EntryPoint = "SendMessage")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImport("user32.dll", EntryPoint = "SendMessage")]
public static extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", EntryPoint = "PostMessage")]
public static extern int PostMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
[DllImport("user32.dll", EntryPoint = "PostMessage")]
public static extern int PostMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", EntryPoint = "keybd_event")]
public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, long dwExtraInfo);
[DllImport("user32.dll", EntryPoint = "GetWindowThreadProcessId")]
public static extern int GetWindowThreadProcessId(IntPtr hwnd, out int lpdwProcessId);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern void SetForegroundWindow(IntPtr hwnd);
[DllImport("user32.dll", EntryPoint = "DrawMenuBar")]
public static extern int DrawMenuBar(IntPtr hWnd);
[DllImport("user32.dll", EntryPoint = "mouse_event")]
public static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, IntPtr dwExtraInfo);
[DllImport("user32.dll", EntryPoint = "SetCursorPos")]
public static extern void SetCursorPos(int x, int y);
[DllImport("user32.dll", EntryPoint = "GetCursorPos")]
public static extern bool GetCursorPos(out POINT p);
[DllImport("user32.dll", EntryPoint = "SetWindowsHookEx")]
public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);
[DllImport("user32.dll", EntryPoint = "UnhookWindowsHookEx")]
public static extern int UnhookWindowsHookEx(int idHook);
[DllImport("user32.dll", EntryPoint = "CallNextHookEx")]
public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", EntryPoint = "GetWindowDC")]
public static extern IntPtr GetWindowDC(IntPtr hWnd);
[DllImport("user32.dll", EntryPoint = "ReleaseDC")]
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
[DllImport("kernel32.dll")]
public static extern IntPtr GetModuleHandle(string name);
[DllImport("user32.dll")]
public static extern IntPtr WindowFromPoint(POINT Point);
[DllImport("user32.dll", EntryPoint = "GetDoubleClickTime")]
public static extern int GetDoubleClickTime();
[DllImport("user32.dll", EntryPoint = "FindWindow")]
public extern static IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", EntryPoint = "FindWindow")]
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
#endregion
/// <summary>
/// 表示 Hook 回调函数。
/// </summary>
/// <param name="nCode"></param>
/// <param name="wParam"></param>
/// <param name="lParam"></param>
/// <returns></returns>
public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam);
/// <summary>
/// 表示进程间传递的数据结构
/// </summary>
public struct COPYDATASTRUCT
{
public IntPtr dwData;
public int cbData;
[MarshalAs(UnmanagedType.LPStr)]
public string lpData;
}
/// <summary>
/// 用于通过 API 获取位置信息的结构。
/// </summary>
public struct Rect
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
/// <summary>
/// 与非托管通信的鼠标位置结构。
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
public int X;
public int Y;
}
/// <summary>
/// 鼠标事件标识。
/// </summary>
public enum MouseEventFlags
{
Move = 0x0001,
LeftDown = 0x0002,
LeftUp = 0x0004,
RightDown = 0x0008,
RightUp = 0x0010,
MiddleDown = 0x0020,
MiddleUp = 0x0040,
Wheel = 0x0800,
Absolute = 0x8000
}
}
/// <summary>
/// DevExpress
/// </summary>
public class AboutDevCompanion
{
private int Interval;
private bool ResidentMode;
private bool StopCompanion;
private Thread m_Thread;
/// <summary>
/// 按指定的模式创建 <see cref="Wunion.Budget.PowerBasicFramework.AboutDevCompanion"/> 对象实例。
/// <param name="interval">检测Dev注册弹框的时间间隔(以毫秒为单位)。</param>
/// <param name="resident">检测程序是否以常驻模式运行(默认值 true)。</param>
/// </summary>
public AboutDevCompanion(int interval, bool resident = true)
{
Interval = interval;
ResidentMode = resident;
StopCompanion = true;
}
/// <summary>
/// 关闭 DevExpress 控件的注册弹框(如果调用时找到并关闭了DevExpress注册弹框则返回true,否则返回false)。
/// </summary>
/// <returns></returns>
private bool CloseAboutDev()
{
IntPtr devHwnd = WinAPI.FindWindow(null, "About DevExpress");
if (devHwnd != IntPtr.Zero)
{
WinAPI.SendMessage(devHwnd, WinAPI.WM_CLOSE, 0, 0);
return true;
}
return false;
}
/// <summary>
/// 运行 Dev 伴侣,对其注册弹框下毒手。
/// </summary>
public void Run()
{
if (!StopCompanion)
return; // 防止多次运行导致可能的线程错误。
StopCompanion = false;
m_Thread = new Thread(new ThreadStart(() =>
{
while (!StopCompanion)
{
if (ResidentMode)
CloseAboutDev();
else // 如果非常驻模式,则在检测并关闭Dev注册弹框后应结束程序。
StopCompanion = CloseAboutDev();
Thread.Sleep(Interval);
}
m_Thread = null;
}));
m_Thread.Start();
}
/// <summary>
/// 关闭程序的运行。
/// </summary>
public void Stop()
{
StopCompanion = true;
}
}
}