|
|
|
@ -16,20 +16,21 @@ using DB.Entity;
|
|
|
|
|
using NewLife.Data;
|
|
|
|
|
using NewLife.Log;
|
|
|
|
|
using Tool;
|
|
|
|
|
using HslCommunication;
|
|
|
|
|
|
|
|
|
|
namespace RfidWeb
|
|
|
|
|
{
|
|
|
|
|
public partial class Form1 : Form
|
|
|
|
|
public partial class FrmMain : Form
|
|
|
|
|
{
|
|
|
|
|
private ILogNet logNet = ILogNetFactory.GetLogNet;
|
|
|
|
|
|
|
|
|
|
public Form1()
|
|
|
|
|
public FrmMain()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|
|
|
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
|
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果所有的日志在记录之前需要在控制台显示出来
|
|
|
|
|
logNet.BeforeSaveToFile += (object sender, HslEventArgs e) =>
|
|
|
|
@ -38,7 +39,38 @@ namespace RfidWeb
|
|
|
|
|
};
|
|
|
|
|
logNet.ConsoleOutput = true;
|
|
|
|
|
logNet.WriteInfo("nihao");
|
|
|
|
|
|
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Init()
|
|
|
|
|
{
|
|
|
|
|
//if (this.FormBorderStyle == FormBorderStyle.None)
|
|
|
|
|
//{
|
|
|
|
|
// this.FormBorderStyle = FormBorderStyle.FixedSingle;
|
|
|
|
|
// this.WindowState = FormWindowState.Normal;
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// this.FormBorderStyle = FormBorderStyle.None;
|
|
|
|
|
// this.WindowState = FormWindowState.Maximized;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当前写入操作的代码 The code for the current write operation
|
|
|
|
|
OperateResult write = PlcConnect.Instance.Write("A1", short.Parse("4"));
|
|
|
|
|
if (write.IsSuccess)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Write [A1] success");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Write [A1] failed: " + write.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|