You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.2 KiB
C#
60 lines
1.2 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using PrintBarCode.Business;
|
|
using PrintBarCode.Helper;
|
|
using PrintBarCode.Model;
|
|
using SlnMesnac.Redis;
|
|
using static PrintBarCode.MessageClient;
|
|
|
|
namespace PrintBarCode
|
|
{
|
|
public partial class MainForm : Form
|
|
{
|
|
|
|
|
|
public MainForm()
|
|
{
|
|
MessageClient.addLogEvent += addLog;
|
|
InitializeComponent();
|
|
|
|
addLog("启动监听打印服务成功......");
|
|
|
|
|
|
}
|
|
|
|
|
|
private void addLog(string logInfo)
|
|
{
|
|
try
|
|
{
|
|
|
|
// 如果当前调用线程不是创建窗体的线程,使用 Invoke
|
|
if (this.logList.InvokeRequired)
|
|
{
|
|
this.logList.Invoke(new Action<string>(addLog), logInfo);
|
|
}
|
|
else
|
|
{
|
|
this.logList.Items.Add($"{DateTime.Now}==>{logInfo}");
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
protected override void OnFormClosing(FormClosingEventArgs e)
|
|
{
|
|
// 取消关闭操作
|
|
e.Cancel = true;
|
|
// 将窗口状态设置为最小化
|
|
this.WindowState = FormWindowState.Minimized;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
} |