Commit 8b572893 刘韬

1

1 个父辈 e57b9fab
正在显示 49 个修改的文件 包含 2829 行增加46 行删除
......@@ -262,6 +262,8 @@ namespace OnlineStore
private static bool getLangRes(string lang) {
if (string.IsNullOrEmpty(lang))
lang = "zh-CN";
if (!LangMap.ContainsKey(lang)) {
string path = Application.StartupPath + @"\resources\"+lang+ ".lngres";
if (!File.Exists(path))
......@@ -299,14 +301,14 @@ namespace OnlineStore
if (string.IsNullOrEmpty(className))
className = cc.GetType().Name;
if (CurrLanguage.Equals(CodeResourceControl.GetLanguage()))
//if (CurrLanguage.Equals(CodeResourceControl.GetLanguage()))
{
//return;
}
//string className = cc.ClassName;
CurrLanguage = CodeResourceControl.GetLanguage();
//string name = CodeResourceControl.GetString(CodeResourceControl.GetTextIdStr(className), cc.Text);
//if (!name.Equals("")) { cc.Text = name; }
CurrLanguage = GetLanguage();
string name = GetString(CodeResourceControl.GetTextIdStr(className, className), cc.Text);
if (!name.Equals("")) { cc.Text = name; }
PreControlLanaguage(cc, className);
RefreshLanguageEvent?.Invoke();
......
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using ConfigHelper;
using log4net.Core;
namespace OnlineStore.Common
{
......@@ -69,6 +70,9 @@ namespace OnlineStore.Common
[MyConfigComment("是否启用库位屏蔽")]
public static MyConfig<bool> Device_DisableStorePosition = false;
[MyConfigComment("超声波传感器液位距离")]
public static MyConfig<int> Device_Liquid_level_distance = 180;
[MyConfigComment("打印机IP地址")]
public static MyConfig<string> Printer_IP = "192.168.4.21";
[MyConfigComment("打印机标签模版")]
......
......@@ -42,16 +42,19 @@ namespace DeviceLibrary
public string[] GetLabelList() {
return print.GetLabelName();
}
public Task<(bool,string)> PrintLabel(ReelParam reel)
public Task<(bool,string)> PrintLabel(ReelParam reel,string labelname)
{
return Task.Run(() =>
{
string labelname = Setting_Init.Printer_Labelname;
//string labelname = Setting_Init.Printer_Labelname;
Dictionary<string, string> data = new Dictionary<string, string>();
data.Add("PN", reel.PN);
data.Add("LOT", reel.LOT);
data.Add("EXP", reel.EXP);
data.Add("SN", reel.SN);
data.Add("Time1", DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss"));
data.Add("Time2", DateTime.Now.AddHours(4).ToString("MM-dd-yyyy HH:mm:ss"));
data.Add("Time3", DateTime.Now.AddHours(5*24+4).ToString("MM-dd-yyyy HH:mm:ss"));
data.Add("datetime", DateTime.Now.ToString());
LogUtil.info($"打印标签:{reel.ToDetailStr()}");
var result = Print(labelname, data, out string msg);
......
......@@ -19,7 +19,7 @@ namespace DeviceLibrary
{
[Serializable]
public enum TestStorePointPort {
入口, 出口, 上层左侧, 上层右侧, 下层左侧, 下层右侧,贴标,接标台
入口, 出口, 上层左侧, 上层右侧, 下层左侧, 下层右侧,贴标, 接标台打印, 接标台取标
}
[Serializable]
public class tstoredata {
......@@ -241,13 +241,17 @@ namespace DeviceLibrary
/// </summary>
/// <returns></returns>
public static bool TestHasLabelOnDock(bool checkstatus) {
var r = CameraPointTest.CameraData[TestStorePointPort.接标台.ToString()].PointList;
var posname = checkstatus ? TestStorePointPort.接标台打印.ToString() : TestStorePointPort.接标台取标.ToString();
var r = CameraPointTest.CameraData[posname].PointList;
var sl = CameraPointTest.CameraData[posname].S;
Point checkpoint = r[0];
var bmp = RobotManage.CameraA.GetImage(0);
if (bmp == null)
return true;
//bmp = new Bitmap("d:\\新建分组1_监控点1_106_20220818172856_3997146.bmp");
//var bmp = new Bitmap("D:\\logs\\入口1.bmp");
BitmapData bd = null;
try
......@@ -255,12 +259,12 @@ namespace DeviceLibrary
bd = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, bmp.PixelFormat);
var p = checkpoint;
p.X = p.X - 8;
p.Y = p.Y - 8;
p.X = p.X - 4;
p.Y = p.Y - 4;
var cl = new List<ColorHSV>();
for (int j = 0; j < 16; j++)
for (int j = 0; j < 8; j++)
{
for (int k = 0; k < 16; k++)
for (int k = 0; k < 8; k++)
{
var x = p.X + j;
var y = p.Y + k;
......@@ -277,15 +281,15 @@ namespace DeviceLibrary
var v = cl.Average(cc => cc.V);
var has = (h>180 && h<260) || s<10;
has = s < 15;
LogUtil.info($"TestHasLabelOnDock checkstatus:{checkstatus}, h:{h},s:{s},v:{v},config_s:{CameraData[TestStorePointPort.接标台.ToString()].S}");
has = s < sl;
LogUtil.info($"TestHasLabelOnDock checkstatus:{checkstatus},{posname}, h:{h},s:{s},v:{v},config_s:{sl},has:{has}");
if (has != checkstatus)
{
Directory.CreateDirectory("\\image\\LabelDock");
bmp.Save("\\image\\LabelDock\\"+ checkstatus +"_"+ DateTime.Now.ToString("yyyyMMddHHmmss")+".jpg");
}
return has;
return has== checkstatus;
}
catch (AccessViolationException ex)
{
......
......@@ -43,7 +43,7 @@ namespace DeviceLibrary
// RightDoorOpen = false;
//}
if (RobotManage.dauxiKS107.Distance < 180) {
if (RobotManage.dauxiKS107.Distance < Setting_Init.Device_Liquid_level_distance) {
Msg.add(crc.GetString("Res0163.f6ad5099","冷凝液回收桶已满"), MsgLevel.warning);
}
......
......@@ -83,9 +83,16 @@ namespace DeviceLibrary
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling06);
LabelingMoveInfo.MoveParam.PlateH = 50;
LabelingMoveInfo.MoveParam.PlateW = 7;
LabelingMoveInfo.MoveParam.PosID = "";
LabelingMoveInfo.log("code: "+LabelingMoveInfo.MoveParam.WareCode);
ScanTimes = 0;
ServerCM.SendInStoreRequest(new string[] { LabelingMoveInfo.MoveParam.WareCode }, LabelingMoveInfo.MoveParam, true);
if (string.IsNullOrEmpty(LabelingMoveInfo.MoveParam.PosID))
{
if (!LabelingMoveInfo.MoveParam.IsNg)
LabelingMoveInfo.MoveParam.NgMsg = crc.GetString("Res0177.eb52c0df","服务器异常");
LabelingMoveInfo.MoveParam.IsNg = true;
}
Setting_Init.Runtime_Posid = LabelingMoveInfo.MoveParam.PosID;
Setting_Init.Runtime_RFID = LabelingMoveInfo.MoveParam.RFID;
......@@ -94,7 +101,7 @@ namespace DeviceLibrary
LabelingMoveInfo.log($"获取库位失败,送到NG口:{LabelingMoveInfo.MoveParam.NgMsg}");
return;
}
PrintTask = RobotManage.printerHelper.PrintLabel(LabelingMoveInfo.MoveParam);
PrintTask = RobotManage.printerHelper.PrintLabel(LabelingMoveInfo.MoveParam, Setting_Init.Printer_Labelname);
Setting_Init.Runtime_Step = Runtime_StepE.Printed;
LabelingMoveInfo.log("开始打印标签:" + LabelingMoveInfo.MoveParam.ToDetailStr());
Task.Run(() =>
......@@ -187,7 +194,7 @@ namespace DeviceLibrary
break;
case MoveStep.Labeling10:
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling11);
PrintTask = RobotManage.printerHelper.PrintLabel(LabelingMoveInfo.MoveParam);
PrintTask = RobotManage.printerHelper.PrintLabel(LabelingMoveInfo.MoveParam, Setting_Init.Printer_Labelname);
Setting_Init.Runtime_Step = Runtime_StepE.Printed;
LabelingMoveInfo.log("开始打印标签:" + LabelingMoveInfo.MoveParam.ToDetailStr());
break;
......@@ -268,7 +275,7 @@ namespace DeviceLibrary
//LabelingMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.Labeling51:
if (CameraPointTest.TestHasLabelOnDock(false))
if (!CameraPointTest.TestHasLabelOnDock(false))
{
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling56);
Msg.add(crc.GetString("Res0167.8453b300","取标失败"), MsgLevel.alarm, ErrInfo.LabelInPaste);
......@@ -302,6 +309,7 @@ namespace DeviceLibrary
if (RotateEquip.TurnWork.IsCompleted)
{
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling54);
IOMove(IO_Type.Label_PasteBlow, IO_VALUE.LOW);
RotateEquip.TurnDegree(-45);
//RotateEquip.TurnDouble();
}
......@@ -309,7 +317,7 @@ namespace DeviceLibrary
case MoveStep.Labeling54:
if (RotateEquip.TurnWork.IsCompleted)
{
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling56);
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling56);
CylinderMove(null, IO_Type.Labeling_Down, IO_Type.Labeling_Up, IO_VALUE.HIGH);
//RotateEquip.TurnDegree(90);
RotateEquip.TurnDouble();
......@@ -483,8 +491,8 @@ namespace DeviceLibrary
if (cs.Length >= 7)
{
reelParam.PN = cs[0].Substring(1);
reelParam.LOT = cs[3].Substring(1);
reelParam.EXP = cs[4].Substring(1);
reelParam.LOT = cs[3].Substring(2);
reelParam.EXP = cs[4].Substring(2);
reelParam.SN = cs[5].Substring(1);
reelParam.WareCode = rightcode;
reelParam.ReeID = reelParam.SN;
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
# Visual Studio Version 17
VisualStudioVersion = 17.6.33815.320
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}"
EndProject
......@@ -11,6 +11,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "DeviceLibr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TheMachine", "TheMachine\TheMachine.csproj", "{61FDFF14-8BB7-439A-85A0-592E3011F4C4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TinLabel", "TinLabel\TinLabel.csproj", "{E0B06008-2DD9-439B-BB21-90CFD4AC46DD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TinLabelPrinter", "TinLabelPrinter\TinLabelPrinter.csproj", "{B563AAC1-0875-4106-B16F-8E58F7A14C4F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -33,6 +37,14 @@ Global
{61FDFF14-8BB7-439A-85A0-592E3011F4C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61FDFF14-8BB7-439A-85A0-592E3011F4C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61FDFF14-8BB7-439A-85A0-592E3011F4C4}.Release|Any CPU.Build.0 = Release|Any CPU
{E0B06008-2DD9-439B-BB21-90CFD4AC46DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E0B06008-2DD9-439B-BB21-90CFD4AC46DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0B06008-2DD9-439B-BB21-90CFD4AC46DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0B06008-2DD9-439B-BB21-90CFD4AC46DD}.Release|Any CPU.Build.0 = Release|Any CPU
{B563AAC1-0875-4106-B16F-8E58F7A14C4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B563AAC1-0875-4106-B16F-8E58F7A14C4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B563AAC1-0875-4106-B16F-8E58F7A14C4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B563AAC1-0875-4106-B16F-8E58F7A14C4F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -29,6 +29,7 @@ namespace TheMachine
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.设备操作ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.启用调试模式ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
......@@ -146,7 +147,7 @@ namespace TheMachine
// 简体中文ToolStripMenuItem
//
this.简体中文ToolStripMenuItem.Name = "简体中文ToolStripMenuItem";
this.简体中文ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.简体中文ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.简体中文ToolStripMenuItem.Tag = "not";
this.简体中文ToolStripMenuItem.Text = "简体中文";
this.简体中文ToolStripMenuItem.Click += new System.EventHandler(this.简体中文ToolStripMenuItem_Click);
......@@ -154,7 +155,7 @@ namespace TheMachine
// englishToolStripMenuItem
//
this.englishToolStripMenuItem.Name = "englishToolStripMenuItem";
this.englishToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.englishToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.englishToolStripMenuItem.Tag = "not";
this.englishToolStripMenuItem.Text = "English";
this.englishToolStripMenuItem.Click += new System.EventHandler(this.englishToolStripMenuItem_Click);
......@@ -466,6 +467,7 @@ namespace TheMachine
this.Controls.Add(this.btn_run);
this.Controls.Add(this.menuStrip1);
this.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
......
此文件的差异太大,无法显示。
......@@ -32,7 +32,7 @@ namespace TheMachine
//var bmp = new Bitmap(bmpfile);
//var r = CameraPointTest.TestStorePoint(bmp, TestStorePointPort.入口);
Config.LoadMyConfig(new Setting_Init().GetType());
_ = new Mutex(true, Application.ProductName, out bool ret);
if (!ret)
{
......@@ -57,7 +57,7 @@ namespace TheMachine
}
}
Config.LoadMyConfig(new Setting_Init().GetType());
Application.ThreadException += Application_ThreadException;
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
......
......@@ -30,12 +30,12 @@ namespace TheMachine
chbAutoRun.Checked =Setting_Init.App_AutoRun;
this.chbAutoRun.CheckedChanged += new System.EventHandler(this.chbAutoRun_CheckedChanged);
//chbAutoRun.Enabled = true;
for (int i = 0; i < 20; i++)
{
cb_tempsensorport.Items.Add("COM" + i);
}
//for (int i = 0; i < 20; i++)
//{
// cb_tempsensorport.Items.Add("COM" + i);
//}
this.cb_tempsensorport.SelectedIndexChanged += new System.EventHandler(this.cb_tempsensorport_SelectedIndexChanged);
//this.cb_tempsensorport.SelectedIndexChanged += new System.EventHandler(this.cb_tempsensorport_SelectedIndexChanged);
}
private void Crc_LanguageChangeEvent(object sender, EventArgs e)
......@@ -54,7 +54,7 @@ namespace TheMachine
private void SettingControl_Load(object sender, EventArgs e)
{
Config.PropertyBind(Setting_Init.Device_DauxiKS107_Port.Key, cb_tempsensorport, "SelectedItem", "SelectedIndexChanged");
//Config.PropertyBind(Setting_Init.Device_DauxiKS107_Port.Key, cb_tempsensorport, "SelectedItem", "SelectedIndexChanged");
Config.PropertyBind(Setting_Init.Printer_Labelname.Key, cb_labelselect, "SelectedItem", "SelectedValueChanged");
loadlabellist();
}
......@@ -111,14 +111,20 @@ namespace TheMachine
if (!Visible)
return;
lbl_hmdstate.Text = crc.GetString("Res0022","当前状态:");
if (!HumitureController.IsRun)
{
lbl_hmdstate.Text += crc.GetString("Res0023","未成功连接");
return;
}
var t = HumitureController.LastData;
lbl_hmdstate.Text += $"{"温度"}:{t.Temperate}℃, {"湿度"}:{t.Humidity}%";
//lbl_hmdstate.Text = crc.GetString("Res0022","当前状态:");
//if (!HumitureController.IsRun)
//{
// lbl_hmdstate.Text += crc.GetString("Res0023", "未成功连接");
//}
//else
//{
// var t = HumitureController.LastData;
// lbl_hmdstate.Text += $"{"温度"}:{t.Temperate}℃, {"湿度"}:{t.Humidity}%";
//}
if (RobotManage.dauxiKS107.Distance>0)
lbl_Liquidstatus.Text = crc.GetString("Res0178.bade191d","当前液位距离:") + RobotManage.dauxiKS107.Distance + "mm ," + crc.GetString("Res0179.562122a5","最小液位距离:") + Setting_Init.Device_Liquid_level_distance + "mm";
else
lbl_Liquidstatus.Text = crc.GetString("Res0023", "未成功连接");
}
private void button1_Click_1(object sender, EventArgs e)
......@@ -132,7 +138,7 @@ namespace TheMachine
reelParam.ReeID = "Demo ReelID";
reelParam.PN = "Demo PN";
reelParam.QTY = 999;
var t = RobotManage.printerHelper.PrintLabel(reelParam);
var t = RobotManage.printerHelper.PrintLabel(reelParam, Setting_Init.Printer_Labelname);
t.Wait();
if (!t.Result.Item1)
{
......@@ -155,5 +161,10 @@ namespace TheMachine
cb_labelselect.Items.AddRange(RobotManage.printerHelper.GetLabelList());
cb_labelselect.SelectedItem = Setting_Init.Printer_Labelname.Val;
}
private void tabPage_set_Click(object sender, EventArgs e)
{
}
}
}
\ No newline at end of file
......@@ -35,7 +35,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
<ApplicationIcon>app.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
......@@ -45,7 +45,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\PrintLabel\PrintLabel\bin\Debug\Asa.PrintLabel.dll</HintPath>
</Reference>
<Reference Include="Asa.RFID.PuYue">
<Reference Include="Asa.RFID.PuYue, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\RFID\RFID_PuYue\bin\Debug\Asa.RFID.PuYue.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary, Version=1.0.7703.30209, Culture=neutral, processorArchitecture=MSIL">
......@@ -268,6 +269,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="app.ico" />
<Content Include="icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
此文件类型无法预览
namespace TinLabel
{
partial class AboutBox1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
tableLayoutPanel = new TableLayoutPanel();
labelProductName = new Label();
labelVersion = new Label();
labelCopyright = new Label();
labelCompanyName = new Label();
textBoxDescription = new TextBox();
okButton = new Button();
tableLayoutPanel.SuspendLayout();
SuspendLayout();
//
// tableLayoutPanel
//
tableLayoutPanel.ColumnCount = 2;
tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 16.25F));
tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 83.75F));
tableLayoutPanel.Controls.Add(labelProductName, 1, 0);
tableLayoutPanel.Controls.Add(labelVersion, 1, 1);
tableLayoutPanel.Controls.Add(labelCopyright, 1, 2);
tableLayoutPanel.Controls.Add(labelCompanyName, 1, 3);
tableLayoutPanel.Controls.Add(textBoxDescription, 1, 4);
tableLayoutPanel.Controls.Add(okButton, 1, 5);
tableLayoutPanel.Dock = DockStyle.Fill;
tableLayoutPanel.Location = new Point(12, 13);
tableLayoutPanel.Margin = new Padding(4);
tableLayoutPanel.Name = "tableLayoutPanel";
tableLayoutPanel.RowCount = 6;
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 10F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 10F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 10F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 10F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 10F));
tableLayoutPanel.Size = new Size(556, 388);
tableLayoutPanel.TabIndex = 0;
//
// labelProductName
//
labelProductName.Dock = DockStyle.Fill;
labelProductName.Location = new Point(98, 0);
labelProductName.Margin = new Padding(8, 0, 4, 0);
labelProductName.MaximumSize = new Size(0, 25);
labelProductName.Name = "labelProductName";
labelProductName.Size = new Size(454, 25);
labelProductName.TabIndex = 19;
labelProductName.Text = "产品名称";
labelProductName.TextAlign = ContentAlignment.MiddleLeft;
//
// labelVersion
//
labelVersion.Dock = DockStyle.Fill;
labelVersion.Location = new Point(98, 38);
labelVersion.Margin = new Padding(8, 0, 4, 0);
labelVersion.MaximumSize = new Size(0, 25);
labelVersion.Name = "labelVersion";
labelVersion.Size = new Size(454, 25);
labelVersion.TabIndex = 0;
labelVersion.Text = "版本";
labelVersion.TextAlign = ContentAlignment.MiddleLeft;
labelVersion.Click += labelVersion_Click;
//
// labelCopyright
//
labelCopyright.Dock = DockStyle.Fill;
labelCopyright.Location = new Point(98, 76);
labelCopyright.Margin = new Padding(8, 0, 4, 0);
labelCopyright.MaximumSize = new Size(0, 25);
labelCopyright.Name = "labelCopyright";
labelCopyright.Size = new Size(454, 25);
labelCopyright.TabIndex = 21;
labelCopyright.Text = "版权";
labelCopyright.TextAlign = ContentAlignment.MiddleLeft;
//
// labelCompanyName
//
labelCompanyName.Dock = DockStyle.Fill;
labelCompanyName.Location = new Point(98, 114);
labelCompanyName.Margin = new Padding(8, 0, 4, 0);
labelCompanyName.MaximumSize = new Size(0, 25);
labelCompanyName.Name = "labelCompanyName";
labelCompanyName.Size = new Size(454, 25);
labelCompanyName.TabIndex = 22;
labelCompanyName.Text = "公司名称";
labelCompanyName.TextAlign = ContentAlignment.MiddleLeft;
//
// textBoxDescription
//
textBoxDescription.Dock = DockStyle.Fill;
textBoxDescription.Location = new Point(98, 156);
textBoxDescription.Margin = new Padding(8, 4, 4, 4);
textBoxDescription.Multiline = true;
textBoxDescription.Name = "textBoxDescription";
textBoxDescription.ReadOnly = true;
textBoxDescription.ScrollBars = ScrollBars.Both;
textBoxDescription.Size = new Size(454, 186);
textBoxDescription.TabIndex = 23;
textBoxDescription.TabStop = false;
textBoxDescription.Text = "说明";
//
// okButton
//
okButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
okButton.DialogResult = DialogResult.Cancel;
okButton.Location = new Point(452, 350);
okButton.Margin = new Padding(4);
okButton.Name = "okButton";
okButton.Size = new Size(100, 34);
okButton.TabIndex = 24;
okButton.Text = "确定(&O)";
//
// AboutBox1
//
AcceptButton = okButton;
AutoScaleDimensions = new SizeF(8F, 19F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(580, 414);
Controls.Add(tableLayoutPanel);
FormBorderStyle = FormBorderStyle.FixedDialog;
Margin = new Padding(4);
MaximizeBox = false;
MinimizeBox = false;
Name = "AboutBox1";
Padding = new Padding(12, 13, 12, 13);
ShowIcon = false;
ShowInTaskbar = false;
StartPosition = FormStartPosition.CenterParent;
Text = "AboutBox1";
tableLayoutPanel.ResumeLayout(false);
tableLayoutPanel.PerformLayout();
ResumeLayout(false);
}
#endregion
private TableLayoutPanel tableLayoutPanel;
private Label labelProductName;
private Label labelVersion;
private Label labelCopyright;
private Label labelCompanyName;
private TextBox textBoxDescription;
private Button okButton;
}
}
using OnlineStore;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TinLabel
{
partial class AboutBox1 : Form
{
public AboutBox1()
{
InitializeComponent();
this.Text = String.Format(crc.GetString("Res0180.08da16a1","关于 {0}"), AssemblyTitle);
this.labelProductName.Text = AssemblyProduct;
this.labelVersion.Text = String.Format(crc.GetString("Res0181.2b7a1e58","版本 {0}"), AssemblyVersion);
this.labelCopyright.Text = AssemblyCopyright;
this.labelCompanyName.Text = AssemblyCompany;
this.textBoxDescription.Text = AssemblyDescription;
}
#region 程序集特性访问器
public string AssemblyTitle
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
if (attributes.Length > 0)
{
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
if (titleAttribute.Title != "")
{
return titleAttribute.Title;
}
}
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
}
}
public string AssemblyVersion
{
get
{
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
}
public string AssemblyDescription
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyDescriptionAttribute)attributes[0]).Description;
}
}
public string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyProductAttribute)attributes[0]).Product;
}
}
public string AssemblyCopyright
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
}
public string AssemblyCompany
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCompanyAttribute)attributes[0]).Company;
}
}
#endregion
private void labelVersion_Click(object sender, EventArgs e)
{
ConfigHelper.AdvanceConfigForm.ShowEditDialog(this);
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/TheMachine.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="HCBOARD" type="log4net.Appender.RollingFileAppender">
<file value="logs/HCBOARD.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="LngResource" type="log4net.Appender.RollingFileAppender">
<file value="logs/LngResource.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m%n"/>
</layout>
</appender>
<appender name="HIK.IPCamera" type="log4net.Appender.RollingFileAppender">
<file value="logs/HIK.IPCamera.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m%n"/>
</layout>
</appender>
<logger name="RollingLogFileAppender">
<level value="ALL"/>
<appender-ref ref="RollingLogFileAppender"/>
</logger>
<logger name="HCBOARD" additivity="false">
<level value="ALL"/>
<appender-ref ref="HCBOARD"/>
</logger>
<logger name="LngResource" additivity="false">
<level value="ALL"/>
<appender-ref ref="LngResource"/>
</logger>
<logger name="HIK.IPCamera" additivity="false">
<level value="ALL"/>
<appender-ref ref="HIK.IPCamera"/>
</logger>
<!--<root>
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</root>-->
</log4net>
</configuration>
\ No newline at end of file
namespace TinLabel
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
textBox_qrcode = new TextBox();
label_pleasescan = new Label();
label_codeinfo = new Label();
btn_printlabel = new Button();
label_process = new Label();
cb_autoprint = new CheckBox();
label1 = new Label();
btn_barcodeenter = new Button();
menuStrip1 = new MenuStrip();
操作ToolStripMenuItem = new ToolStripMenuItem();
标签设置ToolStripMenuItem = new ToolStripMenuItem();
关于ToolStripMenuItem = new ToolStripMenuItem();
btn_cancel = new Button();
btn_rewriterfid = new Button();
btn_readrfid = new Button();
timer1 = new System.Windows.Forms.Timer(components);
menuStrip1.SuspendLayout();
SuspendLayout();
//
// textBox_qrcode
//
textBox_qrcode.BorderStyle = BorderStyle.FixedSingle;
textBox_qrcode.Font = new Font("Arial", 21.75F, FontStyle.Regular, GraphicsUnit.Point);
textBox_qrcode.Location = new Point(15, 84);
textBox_qrcode.Margin = new Padding(4, 3, 4, 3);
textBox_qrcode.Name = "textBox_qrcode";
textBox_qrcode.Size = new Size(920, 41);
textBox_qrcode.TabIndex = 0;
//
// label_pleasescan
//
label_pleasescan.AutoSize = true;
label_pleasescan.Location = new Point(17, 54);
label_pleasescan.Name = "label_pleasescan";
label_pleasescan.Size = new Size(115, 22);
label_pleasescan.TabIndex = 1;
label_pleasescan.Text = "请扫描条码:";
//
// label_codeinfo
//
label_codeinfo.Font = new Font("Arial", 21.75F, FontStyle.Regular, GraphicsUnit.Point);
label_codeinfo.Location = new Point(17, 142);
label_codeinfo.Name = "label_codeinfo";
label_codeinfo.Size = new Size(665, 201);
label_codeinfo.TabIndex = 2;
label_codeinfo.Text = "label1";
//
// btn_printlabel
//
btn_printlabel.Location = new Point(736, 195);
btn_printlabel.Name = "btn_printlabel";
btn_printlabel.Size = new Size(216, 70);
btn_printlabel.TabIndex = 3;
btn_printlabel.Text = "打印标签";
btn_printlabel.UseVisualStyleBackColor = true;
btn_printlabel.Click += btn_printlabel_Click;
//
// label_process
//
label_process.Font = new Font("Arial", 21.75F, FontStyle.Regular, GraphicsUnit.Point);
label_process.Location = new Point(17, 346);
label_process.Name = "label_process";
label_process.Size = new Size(665, 230);
label_process.TabIndex = 2;
label_process.Text = "label1";
//
// cb_autoprint
//
cb_autoprint.AutoSize = true;
cb_autoprint.Location = new Point(753, 163);
cb_autoprint.Name = "cb_autoprint";
cb_autoprint.Size = new Size(169, 26);
cb_autoprint.TabIndex = 4;
cb_autoprint.Text = "扫码后自动打印";
cb_autoprint.UseVisualStyleBackColor = true;
//
// label1
//
label1.Location = new Point(829, 36);
label1.Name = "label1";
label1.Size = new Size(34, 25);
label1.TabIndex = 1;
label1.Click += label1_Click;
//
// btn_barcodeenter
//
btn_barcodeenter.Location = new Point(942, 84);
btn_barcodeenter.Name = "btn_barcodeenter";
btn_barcodeenter.Size = new Size(75, 43);
btn_barcodeenter.TabIndex = 5;
btn_barcodeenter.Text = "确认";
btn_barcodeenter.UseVisualStyleBackColor = true;
btn_barcodeenter.Click += btn_barcodeenter_Click;
//
// menuStrip1
//
menuStrip1.Font = new Font("Arial", 15.75F, FontStyle.Regular, GraphicsUnit.Point);
menuStrip1.Items.AddRange(new ToolStripItem[] { 操作ToolStripMenuItem, 关于ToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(1038, 32);
menuStrip1.TabIndex = 6;
menuStrip1.Text = "menuStrip1";
//
// 操作ToolStripMenuItem
//
操作ToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { 标签设置ToolStripMenuItem });
操作ToolStripMenuItem.Name = "操作ToolStripMenuItem";
操作ToolStripMenuItem.Size = new Size(66, 28);
操作ToolStripMenuItem.Text = "操作";
//
// 标签设置ToolStripMenuItem
//
标签设置ToolStripMenuItem.Name = "标签设置ToolStripMenuItem";
标签设置ToolStripMenuItem.Size = new Size(168, 28);
标签设置ToolStripMenuItem.Text = "标签设置";
标签设置ToolStripMenuItem.Click += 标签设置ToolStripMenuItem_Click;
//
// 关于ToolStripMenuItem
//
关于ToolStripMenuItem.Name = "关于ToolStripMenuItem";
关于ToolStripMenuItem.Size = new Size(66, 28);
关于ToolStripMenuItem.Text = "关于";
关于ToolStripMenuItem.Click += 关于ToolStripMenuItem_Click;
//
// btn_cancel
//
btn_cancel.Location = new Point(736, 483);
btn_cancel.Name = "btn_cancel";
btn_cancel.Size = new Size(216, 75);
btn_cancel.TabIndex = 3;
btn_cancel.Text = "取消写入RFID";
btn_cancel.UseVisualStyleBackColor = true;
btn_cancel.Click += btn_cancel_Click;
//
// btn_rewriterfid
//
btn_rewriterfid.Location = new Point(736, 407);
btn_rewriterfid.Name = "btn_rewriterfid";
btn_rewriterfid.Size = new Size(216, 70);
btn_rewriterfid.TabIndex = 3;
btn_rewriterfid.Text = "再次写入RFID";
btn_rewriterfid.UseVisualStyleBackColor = true;
btn_rewriterfid.Click += btn_rewriterfid_Click;
//
// btn_readrfid
//
btn_readrfid.Location = new Point(736, 271);
btn_readrfid.Name = "btn_readrfid";
btn_readrfid.Size = new Size(216, 70);
btn_readrfid.TabIndex = 3;
btn_readrfid.Text = "读取并测试RFID";
btn_readrfid.UseVisualStyleBackColor = true;
btn_readrfid.Click += btn_readrfid_click;
//
// timer1
//
timer1.Enabled = true;
timer1.Interval = 1000;
timer1.Tick += timer1_Tick;
//
// Form1
//
AutoScaleDimensions = new SizeF(11F, 22F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1038, 672);
Controls.Add(label1);
Controls.Add(btn_barcodeenter);
Controls.Add(cb_autoprint);
Controls.Add(btn_cancel);
Controls.Add(btn_rewriterfid);
Controls.Add(btn_readrfid);
Controls.Add(btn_printlabel);
Controls.Add(label_process);
Controls.Add(label_codeinfo);
Controls.Add(label_pleasescan);
Controls.Add(textBox_qrcode);
Controls.Add(menuStrip1);
Font = new Font("Arial", 14.25F, FontStyle.Regular, GraphicsUnit.Point);
Icon = (Icon)resources.GetObject("$this.Icon");
MainMenuStrip = menuStrip1;
Margin = new Padding(4, 3, 4, 3);
Name = "Form1";
Text = "Tin Label";
Load += Form1_Load;
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox textBox_qrcode;
private Label label_pleasescan;
private Label label_codeinfo;
private Button btn_printlabel;
private Label label_process;
private CheckBox cb_autoprint;
private Label label1;
private Button btn_barcodeenter;
private MenuStrip menuStrip1;
private ToolStripMenuItem 操作ToolStripMenuItem;
private ToolStripMenuItem 关于ToolStripMenuItem;
private Button btn_cancel;
private Button btn_rewriterfid;
private ToolStripMenuItem 标签设置ToolStripMenuItem;
private Button btn_readrfid;
private System.Windows.Forms.Timer timer1;
}
}
\ No newline at end of file
此文件的差异被折叠, 点击展开。
此文件的差异太大,无法显示。
namespace TinLabel
{
partial class Frm_LabelEdit
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
groupBox1 = new GroupBox();
label2 = new Label();
btn_printertest = new Button();
btn_labeledit = new Button();
cb_labelselect = new ComboBox();
groupBox1.SuspendLayout();
SuspendLayout();
//
// groupBox1
//
groupBox1.Controls.Add(label2);
groupBox1.Controls.Add(btn_printertest);
groupBox1.Controls.Add(btn_labeledit);
groupBox1.Controls.Add(cb_labelselect);
groupBox1.Location = new Point(13, 14);
groupBox1.Margin = new Padding(4, 5, 4, 5);
groupBox1.Name = "groupBox1";
groupBox1.Padding = new Padding(4, 5, 4, 5);
groupBox1.Size = new Size(453, 200);
groupBox1.TabIndex = 13;
groupBox1.TabStop = false;
groupBox1.Text = "打印设置";
//
// label2
//
label2.Location = new Point(7, 36);
label2.Margin = new Padding(4, 0, 4, 0);
label2.Name = "label2";
label2.Size = new Size(141, 32);
label2.TabIndex = 2;
label2.Text = "标签名";
label2.TextAlign = ContentAlignment.MiddleRight;
//
// btn_printertest
//
btn_printertest.Location = new Point(15, 122);
btn_printertest.Margin = new Padding(4, 5, 4, 5);
btn_printertest.Name = "btn_printertest";
btn_printertest.Size = new Size(143, 49);
btn_printertest.TabIndex = 1;
btn_printertest.Text = "打印测试";
btn_printertest.UseVisualStyleBackColor = true;
btn_printertest.Click += btn_printertest_Click;
//
// btn_labeledit
//
btn_labeledit.Location = new Point(277, 122);
btn_labeledit.Margin = new Padding(4, 5, 4, 5);
btn_labeledit.Name = "btn_labeledit";
btn_labeledit.Size = new Size(143, 49);
btn_labeledit.TabIndex = 1;
btn_labeledit.Text = "标签编辑";
btn_labeledit.UseVisualStyleBackColor = true;
btn_labeledit.Click += btn_labeledit_Click;
//
// cb_labelselect
//
cb_labelselect.FormattingEnabled = true;
cb_labelselect.Location = new Point(156, 38);
cb_labelselect.Margin = new Padding(4, 5, 4, 5);
cb_labelselect.Name = "cb_labelselect";
cb_labelselect.Size = new Size(263, 27);
cb_labelselect.TabIndex = 0;
//
// Frm_LabelEdit
//
AutoScaleDimensions = new SizeF(8F, 19F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(488, 235);
Controls.Add(groupBox1);
FormBorderStyle = FormBorderStyle.FixedDialog;
Margin = new Padding(4, 5, 4, 5);
MaximizeBox = false;
MinimizeBox = false;
Name = "Frm_LabelEdit";
StartPosition = FormStartPosition.CenterParent;
Text = "设置";
Load += Frm_LabelEdit_Load;
groupBox1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private GroupBox groupBox1;
private Label label2;
private Button btn_printertest;
private Button btn_labeledit;
private ComboBox cb_labelselect;
}
}
\ No newline at end of file
using Asa;
using ConfigHelper;
using DeviceLibrary;
using OnlineStore;
using OnlineStore.Common;
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;
namespace TinLabel
{
public partial class Frm_LabelEdit : Form
{
public Frm_LabelEdit()
{
InitializeComponent();
}
private void Frm_LabelEdit_Load(object sender, EventArgs e)
{
Config.PropertyBind(Setting.Printer_Labelname.Key, cb_labelselect, "SelectedItem", "SelectedValueChanged");
loadlabellist();
}
void loadlabellist()
{
cb_labelselect.Items.Clear();
cb_labelselect.Items.AddRange(RobotManage.printerHelper.GetLabelList());
cb_labelselect.SelectedItem = Setting.Printer_Labelname.Val;
}
private void btn_labeledit_Click(object sender, EventArgs e)
{
PrintLabel.FrmLabel frmLabel = new PrintLabel.FrmLabel();
crc.LanguageProcess(frmLabel, "FrmLabel");
frmLabel.ShowDialog();
loadlabellist();
}
private void btn_printertest_Click(object sender, EventArgs e)
{
ReelParam reelParam = new ReelParam();
reelParam.ReeID = "Demo ReelID";
reelParam.PN = "Demo PN";
reelParam.QTY = 999;
var t = RobotManage.printerHelper.PrintLabel(reelParam, Setting.Printer_Labelname);
t.Wait();
if (!t.Result.Item1)
{
MessageBox.Show(t.Result.Item2);
}
else
MessageBox.Show(crc.GetString("Res0024", "打印成功"));
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
using ConfigHelper;
using log4net.Config;
using OnlineStore.Common;
using System.Runtime.InteropServices;
namespace TinLabel
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Config.LoadMyConfig(new Setting().GetType());
_ = new Mutex(true, Application.ProductName, out bool ret);
if (!ret)
{
IntPtr formhwnd = FindWindow(null, Setting.App_Title);
ShowWindow(formhwnd, SW_RESTORE);
SwitchToThisWindow(formhwnd, true);
//MessageBox.Show("该程序已经启动", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
var currnetdrive = System.IO.Path.GetPathRoot(Application.StartupPath);
var drives = System.IO.DriveInfo.GetDrives();
foreach (var drive in drives)
{
if (drive.Name.ToLower() == "c:\\"
|| drive.Name.ToLower() == currnetdrive.ToLower()
)
{
var spacegb = drive.AvailableFreeSpace / 1024 / 1024 / 1024;
if (spacegb <= 2)
{
MessageBox.Show(drive.Name + " is not enough disk space, check it please.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
Application.ThreadException += Application_ThreadException;
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Environment.CurrentDirectory = Application.StartupPath;
XmlConfigurator.Configure();
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
LogUtil.error(e.ToString());
}
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
LogUtil.error(e.ToString());
}
#region Win32函数的声明
/// <summary>
/// 找到某个窗口与给出的类别名和窗口名相同窗口
/// </summary>
/// <param name="lpClassName">类别名</param>
/// <param name="lpWindowName">窗口名</param>
/// <returns>成功找到返回窗口句柄,否则返回null</returns>
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
/// <summary>
/// 切换到窗口并把窗口设入前台,类似 SetForegroundWindow方法的功能
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="fAltTab">True代表窗口正在通过Alt/Ctrl +Tab被切换</param>
[DllImport("user32.dll ", SetLastError = true)]
static extern void SwitchToThisWindow(IntPtr hWnd, bool fAltTab);
/// <summary>
/// 设置窗口的显示状态
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="cmdShow">指示窗口如何被显示</param>
/// <returns>如果窗体之前是可见,返回值为非零;如果窗体之前被隐藏,返回值为零</returns>
[DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)]
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
public const int SW_RESTORE = 9;
#endregion
}
}
\ No newline at end of file
using ConfigHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TinLabel
{
internal class Setting
{
public static MyConfig<string> App_Title = "Tin Label";
[MyConfigComment("打印机IP地址")]
public static MyConfig<string> Printer_IP = "192.168.4.21";
[MyConfigComment("打印机标签模版")]
public static MyConfig<string> Printer_Labelname = "label";
[MyConfigComment("RFID IP")]
public static MyConfig<string> Device_RFID_IP = "192.168.110.21";
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>app.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<None Remove="app.ico" />
</ItemGroup>
<ItemGroup>
<Content Include="app.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.IO.Ports" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" />
<ProjectReference Include="..\DeviceLibrary\DeviceLibrary.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Asa.PrintLabel">
<HintPath>..\..\PrintLabel\PrintLabel\bin\Debug\Asa.PrintLabel.dll</HintPath>
</Reference>
<Reference Include="Asa.RFID.PuYue">
<HintPath>..\..\RFID\RFID_PuYue\bin\Debug\Asa.RFID.PuYue.dll</HintPath>
</Reference>
<Reference Include="ConfigHelper">
<HintPath>..\..\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Update="Frm_LabelEdit.cs" />
</ItemGroup>
</Project>
\ No newline at end of file
此文件类型无法预览
using System.Drawing;
using System.Windows.Forms;
namespace TinLabel
{
partial class AboutBox1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
tableLayoutPanel = new TableLayoutPanel();
labelProductName = new Label();
labelVersion = new Label();
labelCopyright = new Label();
labelCompanyName = new Label();
textBoxDescription = new TextBox();
okButton = new Button();
tableLayoutPanel.SuspendLayout();
SuspendLayout();
//
// tableLayoutPanel
//
tableLayoutPanel.ColumnCount = 2;
tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 16.25F));
tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 83.75F));
tableLayoutPanel.Controls.Add(labelProductName, 1, 0);
tableLayoutPanel.Controls.Add(labelVersion, 1, 1);
tableLayoutPanel.Controls.Add(labelCopyright, 1, 2);
tableLayoutPanel.Controls.Add(labelCompanyName, 1, 3);
tableLayoutPanel.Controls.Add(textBoxDescription, 1, 4);
tableLayoutPanel.Controls.Add(okButton, 1, 5);
tableLayoutPanel.Dock = DockStyle.Fill;
tableLayoutPanel.Location = new Point(12, 13);
tableLayoutPanel.Margin = new Padding(4);
tableLayoutPanel.Name = "tableLayoutPanel";
tableLayoutPanel.RowCount = 6;
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 10F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 10F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 10F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 10F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 10F));
tableLayoutPanel.Size = new Size(556, 388);
tableLayoutPanel.TabIndex = 0;
//
// labelProductName
//
labelProductName.Dock = DockStyle.Fill;
labelProductName.Location = new Point(98, 0);
labelProductName.Margin = new Padding(8, 0, 4, 0);
labelProductName.MaximumSize = new Size(0, 25);
labelProductName.Name = "labelProductName";
labelProductName.Size = new Size(454, 25);
labelProductName.TabIndex = 19;
labelProductName.Text = "产品名称";
labelProductName.TextAlign = ContentAlignment.MiddleLeft;
//
// labelVersion
//
labelVersion.Dock = DockStyle.Fill;
labelVersion.Location = new Point(98, 38);
labelVersion.Margin = new Padding(8, 0, 4, 0);
labelVersion.MaximumSize = new Size(0, 25);
labelVersion.Name = "labelVersion";
labelVersion.Size = new Size(454, 25);
labelVersion.TabIndex = 0;
labelVersion.Text = "版本";
labelVersion.TextAlign = ContentAlignment.MiddleLeft;
labelVersion.Click += labelVersion_Click;
//
// labelCopyright
//
labelCopyright.Dock = DockStyle.Fill;
labelCopyright.Location = new Point(98, 76);
labelCopyright.Margin = new Padding(8, 0, 4, 0);
labelCopyright.MaximumSize = new Size(0, 25);
labelCopyright.Name = "labelCopyright";
labelCopyright.Size = new Size(454, 25);
labelCopyright.TabIndex = 21;
labelCopyright.Text = "版权";
labelCopyright.TextAlign = ContentAlignment.MiddleLeft;
//
// labelCompanyName
//
labelCompanyName.Dock = DockStyle.Fill;
labelCompanyName.Location = new Point(98, 114);
labelCompanyName.Margin = new Padding(8, 0, 4, 0);
labelCompanyName.MaximumSize = new Size(0, 25);
labelCompanyName.Name = "labelCompanyName";
labelCompanyName.Size = new Size(454, 25);
labelCompanyName.TabIndex = 22;
labelCompanyName.Text = "公司名称";
labelCompanyName.TextAlign = ContentAlignment.MiddleLeft;
//
// textBoxDescription
//
textBoxDescription.Dock = DockStyle.Fill;
textBoxDescription.Location = new Point(98, 156);
textBoxDescription.Margin = new Padding(8, 4, 4, 4);
textBoxDescription.Multiline = true;
textBoxDescription.Name = "textBoxDescription";
textBoxDescription.ReadOnly = true;
textBoxDescription.ScrollBars = ScrollBars.Both;
textBoxDescription.Size = new Size(454, 186);
textBoxDescription.TabIndex = 23;
textBoxDescription.TabStop = false;
textBoxDescription.Text = "说明";
//
// okButton
//
okButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
okButton.DialogResult = DialogResult.Cancel;
okButton.Location = new Point(452, 350);
okButton.Margin = new Padding(4);
okButton.Name = "okButton";
okButton.Size = new Size(100, 34);
okButton.TabIndex = 24;
okButton.Text = "确定(&O)";
//
// AboutBox1
//
AcceptButton = okButton;
AutoScaleDimensions = new SizeF(8F, 19F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(580, 414);
Controls.Add(tableLayoutPanel);
FormBorderStyle = FormBorderStyle.FixedDialog;
Margin = new Padding(4);
MaximizeBox = false;
MinimizeBox = false;
Name = "AboutBox1";
Padding = new Padding(12, 13, 12, 13);
ShowIcon = false;
ShowInTaskbar = false;
StartPosition = FormStartPosition.CenterParent;
Text = "AboutBox1";
tableLayoutPanel.ResumeLayout(false);
tableLayoutPanel.PerformLayout();
ResumeLayout(false);
}
#endregion
private TableLayoutPanel tableLayoutPanel;
private Label labelProductName;
private Label labelVersion;
private Label labelCopyright;
private Label labelCompanyName;
private TextBox textBoxDescription;
private Button okButton;
}
}
using OnlineStore;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TinLabel
{
partial class AboutBox1 : Form
{
public AboutBox1()
{
InitializeComponent();
this.Text = String.Format(crc.GetString("Res0180.08da16a1","关于 {0}"), AssemblyTitle);
this.labelProductName.Text = AssemblyProduct;
this.labelVersion.Text = String.Format(crc.GetString("Res0181.2b7a1e58","版本 {0}"), AssemblyVersion);
this.labelCopyright.Text = AssemblyCopyright;
this.labelCompanyName.Text = AssemblyCompany;
this.textBoxDescription.Text = AssemblyDescription;
}
#region 程序集特性访问器
public string AssemblyTitle
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
if (attributes.Length > 0)
{
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
if (titleAttribute.Title != "")
{
return titleAttribute.Title;
}
}
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
}
}
public string AssemblyVersion
{
get
{
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
}
public string AssemblyDescription
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyDescriptionAttribute)attributes[0]).Description;
}
}
public string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyProductAttribute)attributes[0]).Product;
}
}
public string AssemblyCopyright
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
}
public string AssemblyCompany
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCompanyAttribute)attributes[0]).Company;
}
}
#endregion
private void labelVersion_Click(object sender, EventArgs e)
{
ConfigHelper.AdvanceConfigForm.ShowEditDialog(this);
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/TheMachine.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="HCBOARD" type="log4net.Appender.RollingFileAppender">
<file value="logs/HCBOARD.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="LngResource" type="log4net.Appender.RollingFileAppender">
<file value="logs/LngResource.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m%n"/>
</layout>
</appender>
<appender name="HIK.IPCamera" type="log4net.Appender.RollingFileAppender">
<file value="logs/HIK.IPCamera.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m%n"/>
</layout>
</appender>
<logger name="RollingLogFileAppender">
<level value="ALL"/>
<appender-ref ref="RollingLogFileAppender"/>
</logger>
<logger name="HCBOARD" additivity="false">
<level value="ALL"/>
<appender-ref ref="HCBOARD"/>
</logger>
<logger name="LngResource" additivity="false">
<level value="ALL"/>
<appender-ref ref="LngResource"/>
</logger>
<logger name="HIK.IPCamera" additivity="false">
<level value="ALL"/>
<appender-ref ref="HIK.IPCamera"/>
</logger>
<!--<root>
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</root>-->
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
\ No newline at end of file
此文件的差异太大,无法显示。
using System.Drawing;
using System.Windows.Forms;
namespace TinLabel
{
partial class Frm_LabelEdit
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.btn_printertest = new System.Windows.Forms.Button();
this.btn_labeledit = new System.Windows.Forms.Button();
this.cb_labelselect = new System.Windows.Forms.ComboBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.btn_printertest);
this.groupBox1.Controls.Add(this.btn_labeledit);
this.groupBox1.Controls.Add(this.cb_labelselect);
this.groupBox1.Location = new System.Drawing.Point(10, 9);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(340, 126);
this.groupBox1.TabIndex = 13;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "打印设置";
//
// label2
//
this.label2.Location = new System.Drawing.Point(5, 23);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(106, 20);
this.label2.TabIndex = 2;
this.label2.Text = "标签名";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btn_printertest
//
this.btn_printertest.Location = new System.Drawing.Point(11, 77);
this.btn_printertest.Name = "btn_printertest";
this.btn_printertest.Size = new System.Drawing.Size(107, 31);
this.btn_printertest.TabIndex = 1;
this.btn_printertest.Text = "打印测试";
this.btn_printertest.UseVisualStyleBackColor = true;
this.btn_printertest.Click += new System.EventHandler(this.btn_printertest_Click);
//
// btn_labeledit
//
this.btn_labeledit.Location = new System.Drawing.Point(208, 77);
this.btn_labeledit.Name = "btn_labeledit";
this.btn_labeledit.Size = new System.Drawing.Size(107, 31);
this.btn_labeledit.TabIndex = 1;
this.btn_labeledit.Text = "标签编辑";
this.btn_labeledit.UseVisualStyleBackColor = true;
this.btn_labeledit.Click += new System.EventHandler(this.btn_labeledit_Click);
//
// cb_labelselect
//
this.cb_labelselect.FormattingEnabled = true;
this.cb_labelselect.Location = new System.Drawing.Point(117, 24);
this.cb_labelselect.Name = "cb_labelselect";
this.cb_labelselect.Size = new System.Drawing.Size(198, 20);
this.cb_labelselect.TabIndex = 0;
//
// Frm_LabelEdit
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(366, 148);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Frm_LabelEdit";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "设置";
this.Load += new System.EventHandler(this.Frm_LabelEdit_Load);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private GroupBox groupBox1;
private Label label2;
private Button btn_printertest;
private Button btn_labeledit;
private ComboBox cb_labelselect;
}
}
\ No newline at end of file
using Asa;
using ConfigHelper;
using DeviceLibrary;
using OnlineStore;
using OnlineStore.Common;
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;
namespace TinLabel
{
public partial class Frm_LabelEdit : Form
{
public Frm_LabelEdit()
{
InitializeComponent();
}
public PrinterHelper printerHelper;
private void Frm_LabelEdit_Load(object sender, EventArgs e)
{
Config.PropertyBind(Setting.Printer_Labelname.Key, cb_labelselect, "SelectedItem", "SelectedValueChanged");
loadlabellist();
}
void loadlabellist()
{
cb_labelselect.Items.Clear();
cb_labelselect.Items.AddRange(printerHelper.GetLabelList());
cb_labelselect.SelectedItem = Setting.Printer_Labelname.Val;
}
private void btn_labeledit_Click(object sender, EventArgs e)
{
PrintLabel.FrmLabel frmLabel = new PrintLabel.FrmLabel();
crc.LanguageProcess(frmLabel, "FrmLabel");
frmLabel.ShowDialog();
loadlabellist();
}
private void btn_printertest_Click(object sender, EventArgs e)
{
ReelParam reelParam = new ReelParam();
reelParam.ReeID = "Demo ReelID";
reelParam.PN = "Demo PN";
reelParam.QTY = 999;
var t = printerHelper.PrintLabel(reelParam, Setting.Printer_Labelname);
t.Wait();
if (!t.Result.Item1)
{
MessageBox.Show(t.Result.Item2);
}
else
MessageBox.Show(crc.GetString("Res0015.2ede4a07","打印成功"));
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
using CodeLibrary;
using OnlineStore;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
[Serializable]
public class ReelParam
{
public ReelParam(string warecode) {
WareCode = warecode;
}
public ReelParam()
{
}
/// <summary>
/// 物品二维码信息
/// </summary>
public string WareCode { get; set; }
public string ReeID { get; set; }
/// <summary>
/// 库位号
/// </summary>
public string PosID { get; set; }
public string RFID { get; set; }
public string bitmapfilename = "";
public List<CodeInfo> codeInfos { get; set; }
/// <summary>
/// 料盘高度
/// </summary>
public int PlateH { get; set; }
/// <summary>
/// 料盘宽度
/// </summary>
public int PlateW { get; set; }
public int usedCount { get; set; }
/// <summary>
/// 是否是入料NG料
/// </summary>
public bool IsNg = false;
/// <summary>
/// 入料NG消息
/// </summary>
public string NgMsg = "";
/// <summary>
/// 物料编码
/// </summary>
public string PN { get; set; }
public string LOT { get; set; }
public string EXP { get; set; }
public string SN { get; set; }
/// <summary>
/// 数量
/// </summary>
public int QTY { get; set; } = 0;
/// <summary>
/// 厂家代码
/// </summary>
public string FC { get; set; }
/// <summary>
/// 唯一序列号
/// </summary>
public string RI { get; set; }
/// <summary>
/// 批次号
/// </summary>
public string Batch { get; set; }
public bool ReelOnFixture { get; internal set; } = false;
public string OutPosID { get; internal set; }
public DateTime dateTime = DateTime.Now;
public int HeightPos = 0;
public ReelParam clone()
{
ReelParam dstobject;
using (MemoryStream mStream = new MemoryStream())
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(mStream, this);
mStream.Seek(0, SeekOrigin.Begin);//指定当前流的位置为流的开头。
dstobject = (ReelParam)bf.Deserialize(mStream);
mStream.Close();
}
return dstobject;
}
public string ToDetailStr()
{
return $"{RFID},{SN},{LOT},{EXP},{PN},{NgMsg},{WareCode}";
}
}
}
\ No newline at end of file
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DeviceLibrary
{
public class PrinterHelper
{
private Asa.PrintLabel print;
ZebraPrinterHelper.ZebraManger zebraManger;
string Port;
public PrinterHelper() {
print = new Asa.PrintLabel(Application.StartupPath + "\\Label",300);
}
public bool Connection(string port) {
Port = port;
if (port.ToLower()=="usb")
zebraManger = new ZebraPrinterHelper.ZebraManger("", ZebraPrinterHelper.ConnectionType.UsbDirect);
else
zebraManger = new ZebraPrinterHelper.ZebraManger(Port, ZebraPrinterHelper.ConnectionType.Network);
if (!zebraManger.Connection(out string msg))
{
LogUtil.error(msg);
return false;
}
else
return true;
}
public void Close() {
zebraManger.Close();
}
public void EditLabel() {
print.EditLabel();
}
public string[] GetLabelList() {
return print.GetLabelName();
}
public Task<(bool,string)> PrintLabel(ReelParam reel,string labelname)
{
return Task.Run(() =>
{
//string labelname = Setting_Init.Printer_Labelname;
Dictionary<string, string> data = new Dictionary<string, string>();
data.Add("PN", reel.PN);
data.Add("LOT", reel.LOT);
data.Add("EXP", reel.EXP);
data.Add("SN", reel.SN);
data.Add("Time1", DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss"));
data.Add("Time2", DateTime.Now.AddHours(4).ToString("MM-dd-yyyy HH:mm:ss"));
data.Add("Time3", DateTime.Now.AddHours(5*24+4).ToString("MM-dd-yyyy HH:mm:ss"));
data.Add("datetime", DateTime.Now.ToString());
LogUtil.info($"打印标签:{reel.ToDetailStr()}");
var result = Print(labelname, data, out string msg);
//Task.Delay(500).Wait();
return (result,msg);
});
}
bool Print(string labelname,Dictionary<string, string> data,out string msg) {
msg = "";
print.LoadLabel(labelname);
var bmp = print.PrintPreview(data);
//LogUtil.info("标签图像生成");
//bmp.Save("currentlabel.bmp");
try
{
//if (!zebraManger.PrintImage(bmp,bmp.Width*3, bmp.Height * 3, out msg, false))
if (!zebraManger.PrintImage(bmp, out msg, false))
{
LogUtil.error(msg);
return false;
}
}
catch (Exception ex)
{
LogUtil.error(ex.ToString());
return false;
}
finally
{
bmp.Dispose();
}
return true;
}
public Task<(bool, string)> IsLabelOnPeeler()
{
return Task.Run(() =>
{
return (zebraManger.IsLabelOnPeeler,"");
});
}
public Bitmap ConvertTo24bppTo1bpp(Bitmap SrcImg)
{
unsafe
{
byte* SrcPointer, DestPointer;
int Width, Height, SrcStride, DestStride;
int X, Y, Index, Sum; ;
Bitmap DestImg = new Bitmap(SrcImg.Width, SrcImg.Height, PixelFormat.Format1bppIndexed);
BitmapData SrcData = new BitmapData();
SrcImg.LockBits(new Rectangle(0, 0, SrcImg.Width, SrcImg.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb, SrcData);
BitmapData DestData = new BitmapData();
DestImg.LockBits(new Rectangle(0, 0, SrcImg.Width, SrcImg.Height), ImageLockMode.ReadWrite, PixelFormat.Format1bppIndexed, DestData);
Width = SrcImg.Width; Height = SrcImg.Height; SrcStride = SrcData.Stride; DestStride = DestData.Stride;
for (Y = 0; Y < Height; Y++)
{
SrcPointer = (byte*)SrcData.Scan0 + Y * SrcStride;
DestPointer = (byte*)DestData.Scan0 + Y * DestStride;
Index = 7; Sum = 0;
for (X = 0; X < Width; X++)
{
if (*SrcPointer + (*(SrcPointer + 1) << 1) + *(SrcPointer + 2) >= 512) Sum += (1 << Index);
if (Index == 0)
{
*DestPointer = (byte)Sum;
Sum = 0;
Index = 7;
DestPointer++;
}
else
Index--;
SrcPointer += 3;
}
if (Index != 7) *DestPointer = (byte)Sum;
}
SrcImg.UnlockBits(SrcData);
DestImg.UnlockBits(DestData);
return DestImg;
}
}
}
}
using ConfigHelper;
using log4net.Config;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TinLabel;
namespace TinLabelPrinter
{
internal static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
XmlConfigurator.Configure();
Config.LoadMyConfig(new Setting().GetType());
_ = new Mutex(true, Application.ProductName, out bool ret);
if (!ret)
{
IntPtr formhwnd = FindWindow(null, Setting.App_Title);
ShowWindow(formhwnd, SW_RESTORE);
SwitchToThisWindow(formhwnd, true);
//MessageBox.Show("该程序已经启动", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
var currnetdrive = System.IO.Path.GetPathRoot(Application.StartupPath);
var drives = System.IO.DriveInfo.GetDrives();
foreach (var drive in drives)
{
if (drive.Name.ToLower() == "c:\\"
|| drive.Name.ToLower() == currnetdrive.ToLower()
)
{
var spacegb = drive.AvailableFreeSpace / 1024 / 1024 / 1024;
if (spacegb <= 2)
{
MessageBox.Show(drive.Name + " is not enough disk space, check it please.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += Application_ThreadException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Environment.CurrentDirectory = Application.StartupPath;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form2());
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
LogUtil.error(e.ToString());
}
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
LogUtil.error(e.ToString());
}
#region Win32函数的声明
/// <summary>
/// 找到某个窗口与给出的类别名和窗口名相同窗口
/// </summary>
/// <param name="lpClassName">类别名</param>
/// <param name="lpWindowName">窗口名</param>
/// <returns>成功找到返回窗口句柄,否则返回null</returns>
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
/// <summary>
/// 切换到窗口并把窗口设入前台,类似 SetForegroundWindow方法的功能
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="fAltTab">True代表窗口正在通过Alt/Ctrl +Tab被切换</param>
[DllImport("user32.dll ", SetLastError = true)]
static extern void SwitchToThisWindow(IntPtr hWnd, bool fAltTab);
/// <summary>
/// 设置窗口的显示状态
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="cmdShow">指示窗口如何被显示</param>
/// <returns>如果窗体之前是可见,返回值为非零;如果窗体之前被隐藏,返回值为零</returns>
[DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)]
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
public const int SW_RESTORE = 9;
#endregion
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("TinLabelPrinter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TinLabelPrinter")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b563aac1-0875-4106-b16f-8e58f7a14c4f")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace TinLabelPrinter.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TinLabelPrinter.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TinLabelPrinter.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
using ConfigHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TinLabel
{
internal class Setting
{
public static MyConfig<string> App_Title = "Tin Label";
[MyConfigComment("打印机IP地址")]
public static MyConfig<string> Printer_IP = "192.168.4.21";
[MyConfigComment("打印机标签模版")]
public static MyConfig<string> Printer_Labelname = "label";
[MyConfigComment("RFID IP")]
public static MyConfig<string> Device_RFID_IP = "192.168.110.21";
[MyConfigComment("语言")]
public static MyConfig<string> Device_Default_Language = "zh-CN";
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B563AAC1-0875-4106-B16F-8E58F7A14C4F}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>TinLabelPrinter</RootNamespace>
<AssemblyName>TinLabelPrinter</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>app.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Asa.PrintLabel">
<HintPath>..\..\PrintLabel\PrintLabel\bin\Debug\Asa.PrintLabel.dll</HintPath>
</Reference>
<Reference Include="Asa.RFID.PuYue">
<HintPath>..\..\RFID\RFID_PuYue\bin\Debug\Asa.RFID.PuYue.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary, Version=1.0.8557.25436, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="ConfigHelper">
<HintPath>..\..\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="ZebraPrinterHelper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\PrintLabel\ZebraPrinterHelper\bin\Debug\ZebraPrinterHelper.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AboutBox1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AboutBox1.Designer.cs">
<DependentUpon>AboutBox1.cs</DependentUpon>
</Compile>
<Compile Include="Form2.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form2.Designer.cs">
<DependentUpon>Form2.cs</DependentUpon>
</Compile>
<Compile Include="Frm_LabelEdit.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Frm_LabelEdit.Designer.cs">
<DependentUpon>Frm_LabelEdit.cs</DependentUpon>
</Compile>
<Compile Include="LabelParam.cs" />
<Compile Include="PrinterHelper.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Setting.cs" />
<EmbeddedResource Include="AboutBox1.resx">
<DependentUpon>AboutBox1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form2.resx">
<DependentUpon>Form2.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Frm_LabelEdit.resx">
<DependentUpon>Frm_LabelEdit.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{43CDD09E-FCF3-4960-A01D-3BBFE9933122}</Project>
<Name>Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="app.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!