FrmTrayInfo.cs
2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace OnlineStore.AssemblyLine
{
internal partial class FrmTrayInfo : FrmBase
{
public FrmTrayInfo()
{
InitializeComponent();
}
private string _contentText = "暂无信息!";
public string ContentText
{
get { return _contentText; }
set { _contentText = value; }
}
private string gouStr = "✔";
private void FrmTrayInfo_Load(object sender, EventArgs e)
{
loadMsg();
}
private string getMsg()
{
string msg = "";
List<TrayInfo> tray = TrayManager.getTrayList();
LogUtil.info("-------------------开始打印托盘信息:");
msg += "-------------------开始打印托盘信息:\r\n";
foreach (TrayInfo t in tray)
{
string disstr = gouStr;
if (TrayDisableManager.DisableTray(t.TrayCode))
{
disstr = "✘";
}
LogUtil.info(disstr + t.ToStr());
msg += disstr + t.ToStr() + "\r\n";
}
LogUtil.info("-------------------结束打印托盘信息");
msg += "-------------------结束打印托盘信息";
return msg;
}
private void loadMsg()
{
this._contentText = getMsg();
if (this._contentText.Trim() != "")
{
this.label1.Text = this._contentText;
}
}
private void btnUpdate_Click(object sender, EventArgs e)
{
loadMsg();
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void FrmTrayInfo_SizeChanged(object sender, EventArgs e)
{
this.Left = Screen.PrimaryScreen.Bounds.Width / 2 - this.Width / 2;//桌面的宽度的一半减去自身宽的的一半
this.Top = Screen.PrimaryScreen.Bounds.Height / 2 - this.Height / 2;//桌面的高度的一半减去自身高度的一半
}
}
}