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.
70 lines
2.2 KiB
C#
70 lines
2.2 KiB
C#
using DevExpress.XtraEditors;
|
|
using System;
|
|
using System.Configuration;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Windows.Forms;
|
|
using ZJ_BYD.Common;
|
|
using ZJ_BYD.Untils;
|
|
|
|
namespace ZJ_BYD
|
|
{
|
|
public partial class Print : XtraForm
|
|
{
|
|
public Print()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Print_Load(object sender, EventArgs e)
|
|
{
|
|
var logoFileName = ConfigurationManager.AppSettings["logofilename"];
|
|
var imgPath = Path.Combine(Application.StartupPath, "image/" + logoFileName);
|
|
loginpic.Image = Image.FromFile(imgPath);
|
|
this.btnPrint.Text = "BarTender打印";
|
|
this.btnPrint.Enabled = true;
|
|
BindCombox.BindMachieTypeForLookUp(lkMachineType);
|
|
}
|
|
|
|
private void btnPrint_Click(object sender, EventArgs e)
|
|
{
|
|
var flag = this.RegexSave(new Control[] { lkMachineType, txtSoftWareVersion, txtBarCode }, out _);
|
|
if (!flag)
|
|
{
|
|
return;
|
|
}
|
|
var fileName = lkMachineType.Text.ToString();
|
|
if (string.IsNullOrWhiteSpace(fileName))
|
|
{
|
|
XtraMessageBox.Show("请选择机型!");
|
|
return;
|
|
}
|
|
this.btnPrint.Text = "BarTender打印中...";
|
|
this.btnPrint.Enabled = false;
|
|
try
|
|
{
|
|
(bool ok, string barCode, string msg) = BartenderPrintHeper.PrintByHttp(fileName.TrimEnd('*'), txtSoftWareVersion.Text.Trim(), txtBarCode.Text.Trim());
|
|
XtraMessageBox.Show(msg);
|
|
this.btnPrint.Text = "BarTender打印";
|
|
this.btnPrint.Enabled = true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
XtraMessageBox.Show(ex == null ? "打印异常" : ex.Message);
|
|
this.btnPrint.Text = "BarTender打印";
|
|
this.btnPrint.Enabled = true;
|
|
}
|
|
}
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void lblClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|