基线 SVN r240
SVN-Revision: r240
This commit is contained in:
@@ -0,0 +1,723 @@
|
||||
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 System.Net.Sockets;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using Lskj.Business;
|
||||
|
||||
|
||||
namespace Lskj.Notice
|
||||
{
|
||||
/// <summary>
|
||||
/// 通知界面
|
||||
/// </summary>
|
||||
public partial class FrmMain : BaseForm
|
||||
{
|
||||
string mUserID;
|
||||
string mUserName;
|
||||
string mUserPassword;
|
||||
private bool isConnect = true;
|
||||
private bool blink = false;
|
||||
private bool isSocketflush = false;
|
||||
private Icon blank = Resources.blank;
|
||||
private Icon striped = Resources.logo;
|
||||
private bool mouseinform = false;
|
||||
private Socket clientSocket = null;
|
||||
/// <summary>
|
||||
///json构造多线程
|
||||
/// </summary>
|
||||
private Thread JosnThread;
|
||||
/// <summary>
|
||||
/// 水印
|
||||
/// </summary>
|
||||
private MessageBoxWaterMark _waterMark = new MessageBoxWaterMark();
|
||||
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;
|
||||
}
|
||||
/// <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;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
//DataTable data = NoticeImpl.GetNoticeData2(ERPInfo.Instance.UserId);
|
||||
//int rowCount = data == null ? 0 : data.Rows.Count;
|
||||
|
||||
//this.gridControlEx.DataSource = data;
|
||||
DataTable data = (this.gridControlEx.DataSource as DataTable).TrimDeleteRows();
|
||||
int rowCount = data == null ? 0 : data.Rows.Count;
|
||||
this.Text = "您有" + rowCount + "条任务需要处理(提示:双击即可处理).";
|
||||
if (rowCount > 0)
|
||||
{
|
||||
// 开启新消息弹窗
|
||||
if (this.tsmiShowWindow.Checked)
|
||||
{
|
||||
this.NormalShowForm();
|
||||
}
|
||||
// 开启、关闭新消息闪烁
|
||||
this.blinkTimer.Enabled = this.tsmiFlicker.Checked;
|
||||
}
|
||||
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"] + "";
|
||||
switch (rowItem["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 "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.PubBrower.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 = "";
|
||||
DataTable data = NoticeImpl.GetNoticeData2(ERPInfo.Instance.UserId, out sqlStr);
|
||||
int rowCount = data == null ? 0 : data.Rows.Count;
|
||||
int topIndex = this.gridView.TopRowIndex;
|
||||
this.gridControlEx.DataSource = data;
|
||||
this.gridView.TopRowIndex = topIndex;
|
||||
this.Text = "您有" + rowCount + "条任务需要处理(提示:双击即可处理).";
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageUtil.Show(ex);
|
||||
}
|
||||
}
|
||||
/// <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)
|
||||
{
|
||||
DBConfig.Instance.CreateConnection();
|
||||
if (!BaseImpl.HasExistsTable("p_systemNoticeSheet"))
|
||||
{
|
||||
NoticeImpl.CreationNoticeTable();
|
||||
}
|
||||
this.tsmiFlicker.Checked = DBConfig.Instance.NoticeFlicker;
|
||||
this.tsmiShowWindow.Checked = DBConfig.Instance.NoticeShowWindow;
|
||||
string sqlStr = "";
|
||||
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;
|
||||
OnSocketSendData();
|
||||
this.ReloadGridData();
|
||||
this.timer3.Start();
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:通过Socket通讯更新数据</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2021-05-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 OnSocketSendData()
|
||||
{
|
||||
//WaitForm.ShowForm();
|
||||
//bool connected = false;
|
||||
string serverIp = string.Empty;
|
||||
string port = string.Empty;
|
||||
if (string.IsNullOrWhiteSpace(SystemInfo.Instance.MessageInteraction)) return;
|
||||
string[] serverIPPortS = SystemInfo.Instance.MessageInteraction.Split('^');
|
||||
foreach (string serverIPPort in serverIPPortS)
|
||||
{
|
||||
serverIp = serverIPPort;
|
||||
port = serverIp.Substring(serverIp.LastIndexOf(':') + 1);
|
||||
serverIp = serverIp.Substring(0, serverIp.LastIndexOf(':'));
|
||||
try
|
||||
{
|
||||
JosnThread = null;
|
||||
clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
//clientSocket.Blocking = false;//非阻塞模式,定时循环读取缓冲区的数据把它拼接到缓冲区数据队列 arrMsg
|
||||
//这里的ip地址,端口号都是服务端绑定的相关数据。
|
||||
IPAddress ip = serverIp.Contains(',') ? IPAddress.Parse(serverIp.Substring(0, serverIp.LastIndexOf(','))) : IPAddress.Parse(serverIp);
|
||||
IPEndPoint endpoint = new IPEndPoint(ip, Convert.ToInt32(!string.IsNullOrEmpty(port) ? port : "8080"));
|
||||
clientSocket.BeginConnect(endpoint, null, null);//链接有端口号与IP地址确定服务端.
|
||||
//connected = true;
|
||||
//IAsyncResult result = clientSocket.BeginConnect(endpoint, null, null);
|
||||
//result.AsyncWaitHandle.WaitOne(500);
|
||||
|
||||
string txtMsg_UserID = DBConfig.Instance.NoticeUserID;
|
||||
string txtMsg_UserName = DBConfig.Instance.NoticeUserName;
|
||||
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(txtMsg_UserID + ',' + txtMsg_UserName);
|
||||
byte[] newbuffer = new byte[buffer.Length + 1];//定义一个新数组
|
||||
newbuffer[0] = 0;//设置标识,表示发送的是字符串
|
||||
Buffer.BlockCopy(buffer, 0, newbuffer, 1, buffer.Length);//源数组中的数据拷贝到新数组中
|
||||
clientSocket.Send(newbuffer);//发送新数组中的数据
|
||||
//客户端在接受服务端发送过来的数据是通过Socket 中的Receive方法,
|
||||
//该方法会阻断线程,所以我们自己为该方法创建了一个线程
|
||||
JosnThread = new Thread(ReceMsg);
|
||||
JosnThread.IsBackground = true;//设置后台线程
|
||||
JosnThread.Start();
|
||||
break;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
isConnect = false;
|
||||
isSocketflush = false;
|
||||
this.gridControlEx.DataSource = null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
// WaitForm.HideForm();
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 接收服务端发送信息
|
||||
/// </summary>
|
||||
public void ReceMsg()
|
||||
{
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
isSocketflush = true;
|
||||
byte[] buffer = new byte[1024 * 1024 * 8];
|
||||
int clientInt = clientSocket.Receive(buffer);//接收服务端发送过来的数据
|
||||
if (clientInt != 0)
|
||||
{
|
||||
isConnect = true;
|
||||
}
|
||||
string ReceiveMsg = System.Text.Encoding.UTF8.GetString(buffer);//把接收到的字节数组转成字符串显示在文本框中。
|
||||
DataTable data = JsonUtil.ToDataTable(ReceiveMsg);
|
||||
int rowCount = data == null ? 0 : data.Rows.Count;
|
||||
if (rowCount != 0)
|
||||
{
|
||||
this.Invoke(new EventHandler(delegate
|
||||
{
|
||||
int topIndex = this.gridView.TopRowIndex;
|
||||
this.gridControlEx.DataSource = data;
|
||||
this.gridView.TopRowIndex = topIndex;
|
||||
this.Text = "您有" + rowCount + "条任务需要处理(提示:双击即可处理).";
|
||||
if (rowCount > 0)
|
||||
{
|
||||
// 开启新消息弹窗
|
||||
if (this.tsmiShowWindow.Checked)
|
||||
{
|
||||
this.NormalShowForm();
|
||||
}
|
||||
// 开启、关闭新消息闪烁
|
||||
this.blinkTimer.Enabled = this.tsmiFlicker.Checked;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WindowState = FormWindowState.Minimized;
|
||||
this.blinkTimer.Enabled = false;
|
||||
}
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
isSocketflush = false;
|
||||
this.gridControlEx.DataSource = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
isSocketflush = false;
|
||||
}
|
||||
}
|
||||
/// <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)
|
||||
{
|
||||
//if (isSocketflush)
|
||||
//{
|
||||
// this.gridControlEx.Paint -= new System.Windows.Forms.PaintEventHandler(this.OnLabelTitlePaint);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// this.gridControlEx.Paint += new System.Windows.Forms.PaintEventHandler(this.OnLabelTitlePaint);
|
||||
//}
|
||||
if (!mouseinform && !isSocketflush)
|
||||
{
|
||||
this.ReloadGridData();
|
||||
OnSocketSendData();
|
||||
}
|
||||
}
|
||||
/// <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)
|
||||
{
|
||||
DataRow rowItem = this.gridView.GetFocusedDataRow();
|
||||
|
||||
if (rowItem != null)
|
||||
{
|
||||
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 = "";
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <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)
|
||||
{
|
||||
this.WindowState = FormWindowState.Minimized;
|
||||
e.Cancel = true;
|
||||
}
|
||||
/// <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)
|
||||
{
|
||||
this.NormalShowForm();
|
||||
}
|
||||
/// <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)
|
||||
{
|
||||
if (MessageUtil.Show("确定要退出任务监视工具?\r\n退后后将无法收到审批消息.", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
|
||||
{
|
||||
try
|
||||
{
|
||||
notifyIcon1.Dispose();
|
||||
this.Dispose();
|
||||
this.Close();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <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)
|
||||
{
|
||||
if (WindowState == FormWindowState.Minimized)
|
||||
{
|
||||
this.ShowInTaskbar = false;
|
||||
this.notifyIcon1.Visible = true;
|
||||
}
|
||||
}
|
||||
/// <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)
|
||||
{
|
||||
if (e.Button == System.Windows.Forms.MouseButtons.Left)
|
||||
{
|
||||
this.NormalShowForm();
|
||||
}
|
||||
}
|
||||
/// <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)
|
||||
{
|
||||
this.tsmiShowWindow.Checked = !this.tsmiShowWindow.Checked;
|
||||
DBConfig.Instance.NoticeShowWindow = this.tsmiShowWindow.Checked;
|
||||
DBConfig.Instance.WriteConfig();
|
||||
}
|
||||
/// <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)
|
||||
{
|
||||
this.tsmiFlicker.Checked = !this.tsmiFlicker.Checked;
|
||||
DBConfig.Instance.NoticeFlicker = this.tsmiFlicker.Checked;
|
||||
DBConfig.Instance.WriteConfig();
|
||||
}
|
||||
/// <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)
|
||||
{
|
||||
this.tsmiExitByMain.Checked = !this.tsmiExitByMain.Checked;
|
||||
DBConfig.Instance.NoticeExit = this.tsmiExitByMain.Checked;
|
||||
DBConfig.Instance.WriteConfig();
|
||||
}
|
||||
/// <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)
|
||||
{
|
||||
NoticeImpl.UpeNoticeData("1");
|
||||
string sqlStr = "";
|
||||
DataTable data = NoticeImpl.GetNoticeData2(ERPInfo.Instance.UserId, out sqlStr);
|
||||
int rowCount = data == null ? 0 : data.Rows.Count;
|
||||
this.gridControlEx.DataSource = data;
|
||||
this.Text = "您有" + rowCount + "条任务需要处理(提示:双击即可处理).";
|
||||
}
|
||||
/// <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;
|
||||
if (JosnThread != null) JosnThread.Suspend();
|
||||
}
|
||||
/// <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;
|
||||
if (JosnThread != null) JosnThread.Resume();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:重绘单据水印</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-12-04 </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="PaintEventArgs"/> instance containing the event data.</param>
|
||||
private void OnLabelTitlePaint(object sender, PaintEventArgs e)
|
||||
{
|
||||
if (this._waterMark != null)
|
||||
{
|
||||
//GraphicsText graphicsText = new GraphicsText();
|
||||
//graphicsText.Graphics = e.Graphics;
|
||||
//绘制围绕点旋转的文本
|
||||
//StringFormat format = new StringFormat();
|
||||
//format.Alignment = StringAlignment.Center;
|
||||
//format.LineAlignment = StringAlignment.Center;
|
||||
// 绘制文本
|
||||
DataTable data = (this.gridControlEx.DataSource as DataTable).TrimDeleteRows();
|
||||
int rowCount = data == null ? 0 : data.Rows.Count;
|
||||
this._waterMark.Text = "";
|
||||
progressPanel.Hide();
|
||||
if (rowCount == 0)
|
||||
{
|
||||
this._waterMark.Text = "未连接到服务器,正在重连...";
|
||||
}
|
||||
if (isConnect == false)
|
||||
{
|
||||
progressPanel.Show();
|
||||
}
|
||||
//if (!string.IsNullOrEmpty(this._waterMark.Text))
|
||||
//{
|
||||
// //graphicsText.DrawString(this._waterMark.Text, new Font("宋体", 12, FontStyle.Bold), new SolidBrush(Color.Red), new PointF(this.Width / 2, this.Height / 2 - 10), format, 0);
|
||||
// //e.Graphics.TranslateTransform(0, 80);
|
||||
// //e.Graphics.RotateTransform(-15f);
|
||||
// //e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(14, 20, 55, 21));
|
||||
// progressPanel.Show();
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user