屠宰场客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.7 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BO;
namespace WinFormTest
{
public partial class Form1 : Form
{
BardCodeHooK BarCode = new BardCodeHooK();
public Form1()
{
InitializeComponent();
BarCode.BarCodeEvent += new BardCodeHooK.BardCodeDeletegate(BarCode_BarCodeEvent);
}
void BarCode_BarCodeEvent(BardCodeHooK.BarCodes barCode)
{
ShowInfo(barCode);
}
private delegate void ShowInfoDelegate(BardCodeHooK.BarCodes barCode);
private void ShowInfo(BardCodeHooK.BarCodes barCode)
{
if (this.InvokeRequired)
{
this.BeginInvoke(new ShowInfoDelegate(ShowInfo), new object[] { barCode });
}
else
{
if (barCode.IsValid)
{
// var code = UrlUtil.GetBarCode(barCode.BarCode.Trim());
// var goodsName = UrlUtil.GetGoodsName(barCode.BarCode);
var code = barCode.BarCode.Trim();
label1.Text = code;
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
weightControl1.WeightEventHandle += WeightControl1_WeightEventHandle;
BarCode.Start();
}
private void WeightControl1_WeightEventHandle(object sender, BWP.WinFormControl.WeightControl_.WeightEventArgu e)
{
label2.Text = e.WeightData;
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
BarCode.Stop();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
weightControl1.Close();
}
}
}