This commit is contained in:
2026-02-09 15:37:45 -06:00
parent e33a68ac51
commit 9635b84c3e
501 changed files with 106873 additions and 0 deletions

0
ScanBox/.txt Normal file
View File

72
ScanBox/App.config Normal file
View File

@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
</startup>
<appSettings>
<!--Release v5.0.0-->
<!--Configuracion de IP en la PC y el sensor-->
<!--<add key="host_ip" value="192.168.100.99" />-->
<!--<add key="sr2000w_ip" value="192.168.100.100" />-->
<!--<add key="printer" value="192.168.100.101" />-->
<!--<add key="printer" value="192.168.88.100" />-->
<!--Retardo de tiempo en segundos parra borrar la ultima lectura-->
<add key="delay" value="5" />
<!--Configuracion de los programas guardados en el sensor-->
<!--El valor asignado indica el numero de codigos por caja-->
<add key="program1_OPCcodes" value="1" />
<add key="program2_OPCcodes" value="30" />
<add key="program3_OPCcodes" value="35" />
<add key="program4_OPCcodes" value="39" />
<add key="program5_OPCcodes" value="301" /> <!-- Segunda dropsi de 30pzs diferente layout-->
<add key="program6_OPCcodes" value="45" />
<add key="program7_OPCcodes" value="52" />
<add key="program8_OPCcodes" value="1" />
<!--Passwords que habilitan el modo de caja semi llena-->
<!--<add key="password1" value="111111" />
<add key="password2" value="000000014633232000" />
<add key="password3" value="0200212355" />-->
<!--SoloEscaner = 1 para desabilitar el uso del teclado -->
<!--como metodo de entrada en el momento de introducir el-->
<!--el password del supervisor-->
<!--SoloEscaner =0 para habilitar el uso del teclado -->
<add key="SoloEscaner" value="0" />
<!--//////////////////////////////////////////////////-->
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

222
ScanBox/Ayuda.Designer.cs generated Normal file
View File

@@ -0,0 +1,222 @@

namespace ScaBox30
{
partial class Ayuda
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Ayuda));
this.panelBody = new System.Windows.Forms.Panel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.panelButtons = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.panelTitleBar = new System.Windows.Forms.Panel();
this.labelCaption = new System.Windows.Forms.Label();
this.btnClose = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.btnMax = new System.Windows.Forms.Button();
this.panelBody.SuspendLayout();
this.groupBox1.SuspendLayout();
this.panelButtons.SuspendLayout();
this.panelTitleBar.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.SuspendLayout();
//
// panelBody
//
this.panelBody.BackColor = System.Drawing.Color.WhiteSmoke;
this.panelBody.Controls.Add(this.groupBox1);
this.panelBody.Cursor = System.Windows.Forms.Cursors.Default;
this.panelBody.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelBody.Location = new System.Drawing.Point(0, 35);
this.panelBody.Name = "panelBody";
this.panelBody.Padding = new System.Windows.Forms.Padding(10, 10, 0, 0);
this.panelBody.Size = new System.Drawing.Size(822, 373);
this.panelBody.TabIndex = 14;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.BackColor = System.Drawing.Color.White;
this.groupBox1.Controls.Add(this.pictureBox2);
this.groupBox1.Controls.Add(this.pictureBox1);
this.groupBox1.Location = new System.Drawing.Point(12, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(798, 346);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "SR-2000W";
//
// panelButtons
//
this.panelButtons.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.panelButtons.Controls.Add(this.button1);
this.panelButtons.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panelButtons.Location = new System.Drawing.Point(0, 408);
this.panelButtons.Name = "panelButtons";
this.panelButtons.Size = new System.Drawing.Size(822, 55);
this.panelButtons.TabIndex = 13;
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button1.BackColor = System.Drawing.Color.SeaGreen;
this.button1.FlatAppearance.BorderSize = 0;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.ForeColor = System.Drawing.Color.WhiteSmoke;
this.button1.Location = new System.Drawing.Point(710, 8);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 35);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// panelTitleBar
//
this.panelTitleBar.BackColor = System.Drawing.Color.CornflowerBlue;
this.panelTitleBar.Controls.Add(this.btnMax);
this.panelTitleBar.Controls.Add(this.labelCaption);
this.panelTitleBar.Controls.Add(this.btnClose);
this.panelTitleBar.Cursor = System.Windows.Forms.Cursors.Default;
this.panelTitleBar.Dock = System.Windows.Forms.DockStyle.Top;
this.panelTitleBar.Location = new System.Drawing.Point(0, 0);
this.panelTitleBar.Name = "panelTitleBar";
this.panelTitleBar.Size = new System.Drawing.Size(822, 35);
this.panelTitleBar.TabIndex = 12;
this.panelTitleBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelTitleBar_MouseDown);
//
// labelCaption
//
this.labelCaption.AutoSize = true;
this.labelCaption.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelCaption.ForeColor = System.Drawing.Color.White;
this.labelCaption.Location = new System.Drawing.Point(9, 8);
this.labelCaption.Name = "labelCaption";
this.labelCaption.Size = new System.Drawing.Size(86, 17);
this.labelCaption.TabIndex = 4;
this.labelCaption.Text = "labelCaption";
//
// btnClose
//
this.btnClose.Dock = System.Windows.Forms.DockStyle.Right;
this.btnClose.FlatAppearance.BorderSize = 0;
this.btnClose.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(79)))), ((int)(((byte)(95)))));
this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClose.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnClose.ForeColor = System.Drawing.Color.White;
this.btnClose.Location = new System.Drawing.Point(782, 0);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(40, 35);
this.btnClose.TabIndex = 3;
this.btnClose.Text = "X";
this.btnClose.UseVisualStyleBackColor = false;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// pictureBox1
//
this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox1.Image = global::ScaBox30.Properties.Resources.frente;
this.pictureBox1.Location = new System.Drawing.Point(17, 19);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(378, 321);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// pictureBox2
//
this.pictureBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox2.Image = global::ScaBox30.Properties.Resources.superior;
this.pictureBox2.Location = new System.Drawing.Point(401, 19);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(380, 257);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox2.TabIndex = 1;
this.pictureBox2.TabStop = false;
//
// btnMax
//
this.btnMax.Cursor = System.Windows.Forms.Cursors.Default;
this.btnMax.Dock = System.Windows.Forms.DockStyle.Right;
this.btnMax.FlatAppearance.BorderSize = 0;
this.btnMax.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Silver;
this.btnMax.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnMax.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnMax.ForeColor = System.Drawing.Color.White;
this.btnMax.Location = new System.Drawing.Point(742, 0);
this.btnMax.Name = "btnMax";
this.btnMax.Size = new System.Drawing.Size(40, 35);
this.btnMax.TabIndex = 6;
this.btnMax.Text = "[ ]";
this.btnMax.UseVisualStyleBackColor = false;
this.btnMax.Click += new System.EventHandler(this.btnMax_Click);
//
// Ayuda
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(822, 463);
this.Controls.Add(this.panelBody);
this.Controls.Add(this.panelButtons);
this.Controls.Add(this.panelTitleBar);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Ayuda";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Ayuda";
this.panelBody.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.panelButtons.ResumeLayout(false);
this.panelTitleBar.ResumeLayout(false);
this.panelTitleBar.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panelBody;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Panel panelButtons;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Panel panelTitleBar;
private System.Windows.Forms.Label labelCaption;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.Button btnMax;
}
}

84
ScanBox/Ayuda.cs Normal file
View File

@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ScaBox30
{
public partial class Ayuda : Form
{
public Ayuda()
{
InitializeComponent();
InitializeItems();
InitializeButtons();
}
// WINDOW CLOSE BUTTON
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
// WINDOW MAXIMIZE BUTTON
private void btnMax_Click(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
}
else
{
WindowState = FormWindowState.Maximized;
}
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
private void InitializeItems()
{
this.FormBorderStyle = FormBorderStyle.None;
this.Padding = new Padding(Globals.borderSize);//Set border size
this.btnClose.DialogResult = DialogResult.Cancel;
this.labelCaption.Text = this.Text;
this.panelTitleBar.BackColor = Globals.primaryColor;
this.panelTitleBar.Padding = new Padding(0, 0, 0, Globals.borderSize);
this.BackColor = Globals.primaryColor;
}
private void InitializeButtons()
{
int xCenter = (this.panelButtons.Width - button1.Width) / 2;
int yCenter = (this.panelButtons.Height - button1.Height) / 2;
//Cancel Button
button1.Visible = true;
button1.Text = "Salir";
button1.DialogResult = DialogResult.Cancel;//Set DialogResult
button1.BackColor = Globals.colors.retry_cancell;
}
#region -> Drag Form
[DllImport("user32.DLL", EntryPoint = "SendMessage")]
private extern static void SendMessage(System.IntPtr hWnd, int wMsg, int wParam, int lParam);
[DllImport("user32.DLL", EntryPoint = "ReleaseCapture")]
private extern static void ReleaseCapture();
private void panelTitleBar_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, 0x112, 0xf012, 0);
}
#endregion
}
}

3607
ScanBox/Ayuda.resx Normal file

File diff suppressed because it is too large Load Diff

64
ScanBox/ConfigTable.cs Normal file
View File

@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// *************************************
// Angel Ivan 04/Nov/2024
// *************************************
namespace ScaBox30
{
class ConfigTable
{
public String Code { get; set; }
public String Box { get; set; }
public String Program { get; set; }
public static ConfigTable FromCsv(string csvLine, string[] opcs_on_program)
{
string[] csv_text_line = csvLine.Split(',');
if (csv_text_line.Length > 1)
{
//If line on CSV file has more than 2 comma separated values
// csv_text_line[2..n] will be ignored
ConfigTable configtable = new ConfigTable();
configtable.Code = new string(csv_text_line[0].ToCharArray().Where(c => !Char.IsWhiteSpace(c)).ToArray()); //removes spaces from csv_text_line[0]
configtable.Box = new string(csv_text_line[1].ToCharArray().Where(c => !Char.IsWhiteSpace(c)).ToArray()); //removes spaces from csv_text_line[1]
if (configtable.Box == opcs_on_program[1])
configtable.Program = "1";
else if (configtable.Box == opcs_on_program[2])
configtable.Program = "2";
else if (configtable.Box == opcs_on_program[3])
configtable.Program = "3";
else if (configtable.Box == opcs_on_program[4])
configtable.Program = "4";
else if (configtable.Box == opcs_on_program[5])
configtable.Program = "5";
else if (configtable.Box == opcs_on_program[6])
configtable.Program = "6";
else if (configtable.Box == opcs_on_program[7])
configtable.Program = "7";
else if (configtable.Box == opcs_on_program[8])
configtable.Program = "8";
else
configtable.Program = "1";
return configtable;
}
else
{
ConfigTable configtable = new ConfigTable();
configtable.Code = null; // ignore lines with less than 1 comma separated value
configtable.Box = null;
configtable.Program = null;
return configtable;
}
}
}
}

539
ScanBox/Configuracion.Designer.cs generated Normal file
View File

@@ -0,0 +1,539 @@

namespace ScaBox30
{
partial class Configuracion
{
/// <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.panelBody = new System.Windows.Forms.Panel();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.label5 = new System.Windows.Forms.Label();
this.textBoxHostIp = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.radioButtonEthernet = new System.Windows.Forms.RadioButton();
this.radioButtonUsb = new System.Windows.Forms.RadioButton();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.TextBoxImpresoraIp = new System.Windows.Forms.TextBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.comboPrinters = new System.Windows.Forms.ComboBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.TextBoxScannerIp = new System.Windows.Forms.TextBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.radioButton3 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.numericLimpieza = new System.Windows.Forms.NumericUpDown();
this.numericRespuesta = new System.Windows.Forms.NumericUpDown();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.panelButtons = new System.Windows.Forms.Panel();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.panelTitleBar = new System.Windows.Forms.Panel();
this.labelCaption = new System.Windows.Forms.Label();
this.btnClose = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.panelBody.SuspendLayout();
this.groupBox7.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox6.SuspendLayout();
this.groupBox5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericLimpieza)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericRespuesta)).BeginInit();
this.panelButtons.SuspendLayout();
this.panelTitleBar.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// panelBody
//
this.panelBody.BackColor = System.Drawing.Color.WhiteSmoke;
this.panelBody.Controls.Add(this.groupBox7);
this.panelBody.Controls.Add(this.groupBox2);
this.panelBody.Controls.Add(this.groupBox1);
this.panelBody.Cursor = System.Windows.Forms.Cursors.Default;
this.panelBody.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelBody.Location = new System.Drawing.Point(0, 35);
this.panelBody.Name = "panelBody";
this.panelBody.Padding = new System.Windows.Forms.Padding(10, 10, 0, 0);
this.panelBody.Size = new System.Drawing.Size(422, 479);
this.panelBody.TabIndex = 11;
//
// groupBox7
//
this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox7.Controls.Add(this.label5);
this.groupBox7.Controls.Add(this.textBoxHostIp);
this.groupBox7.Location = new System.Drawing.Point(12, 388);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(398, 87);
this.groupBox7.TabIndex = 5;
this.groupBox7.TabStop = false;
this.groupBox7.Text = "IP Host";
//
// label5
//
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(6, 48);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(324, 37);
this.label5.TabIndex = 1;
this.label5.Text = "La configuración no se aplica a este equipo, La configuración solo le indica a Sc" +
"anBox que este equipo tiene configurada esta ip.\r\n";
//
// textBoxHostIp
//
this.textBoxHostIp.Location = new System.Drawing.Point(6, 21);
this.textBoxHostIp.Name = "textBoxHostIp";
this.textBoxHostIp.Size = new System.Drawing.Size(188, 20);
this.textBoxHostIp.TabIndex = 0;
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.radioButtonEthernet);
this.groupBox2.Controls.Add(this.radioButtonUsb);
this.groupBox2.Controls.Add(this.groupBox4);
this.groupBox2.Controls.Add(this.groupBox3);
this.groupBox2.Location = new System.Drawing.Point(12, 204);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(398, 182);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Impresión";
//
// radioButtonEthernet
//
this.radioButtonEthernet.AutoSize = true;
this.radioButtonEthernet.Location = new System.Drawing.Point(228, 30);
this.radioButtonEthernet.Name = "radioButtonEthernet";
this.radioButtonEthernet.Size = new System.Drawing.Size(153, 17);
this.radioButtonEthernet.TabIndex = 6;
this.radioButtonEthernet.TabStop = true;
this.radioButtonEthernet.Text = "Habilitar impresión Ethernet";
this.radioButtonEthernet.UseVisualStyleBackColor = true;
this.radioButtonEthernet.CheckedChanged += new System.EventHandler(this.radioButtonEthernet_CheckedChanged);
//
// radioButtonUsb
//
this.radioButtonUsb.AutoSize = true;
this.radioButtonUsb.Location = new System.Drawing.Point(25, 30);
this.radioButtonUsb.Name = "radioButtonUsb";
this.radioButtonUsb.Size = new System.Drawing.Size(135, 17);
this.radioButtonUsb.TabIndex = 5;
this.radioButtonUsb.TabStop = true;
this.radioButtonUsb.Text = "Habilitar impresión USB";
this.radioButtonUsb.UseVisualStyleBackColor = true;
this.radioButtonUsb.CheckedChanged += new System.EventHandler(this.radioButtonUsb_CheckedChanged);
//
// groupBox4
//
this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox4.Controls.Add(this.TextBoxImpresoraIp);
this.groupBox4.Location = new System.Drawing.Point(6, 119);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(386, 55);
this.groupBox4.TabIndex = 4;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "IP de la impresora";
//
// TextBoxImpresoraIp
//
this.TextBoxImpresoraIp.Location = new System.Drawing.Point(6, 21);
this.TextBoxImpresoraIp.Name = "TextBoxImpresoraIp";
this.TextBoxImpresoraIp.Size = new System.Drawing.Size(188, 20);
this.TextBoxImpresoraIp.TabIndex = 0;
//
// groupBox3
//
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox3.Controls.Add(this.comboPrinters);
this.groupBox3.Location = new System.Drawing.Point(6, 61);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(386, 55);
this.groupBox3.TabIndex = 3;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Seleccion de impresora";
//
// comboPrinters
//
this.comboPrinters.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.comboPrinters.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboPrinters.FormattingEnabled = true;
this.comboPrinters.Location = new System.Drawing.Point(6, 20);
this.comboPrinters.Name = "comboPrinters";
this.comboPrinters.Size = new System.Drawing.Size(374, 21);
this.comboPrinters.TabIndex = 1;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.pictureBox1);
this.groupBox1.Controls.Add(this.groupBox6);
this.groupBox1.Controls.Add(this.groupBox5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.numericLimpieza);
this.groupBox1.Controls.Add(this.numericRespuesta);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(12, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(398, 194);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "SR-2000W";
//
// groupBox6
//
this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6.Controls.Add(this.TextBoxScannerIp);
this.groupBox6.Location = new System.Drawing.Point(6, 133);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(386, 55);
this.groupBox6.TabIndex = 7;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "IP del scanner";
//
// TextBoxScannerIp
//
this.TextBoxScannerIp.Location = new System.Drawing.Point(6, 21);
this.TextBoxScannerIp.Name = "TextBoxScannerIp";
this.TextBoxScannerIp.Size = new System.Drawing.Size(188, 20);
this.TextBoxScannerIp.TabIndex = 0;
//
// groupBox5
//
this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox5.Controls.Add(this.radioButton3);
this.groupBox5.Controls.Add(this.radioButton2);
this.groupBox5.Controls.Add(this.radioButton1);
this.groupBox5.Location = new System.Drawing.Point(6, 76);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(386, 55);
this.groupBox5.TabIndex = 6;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Resultado visual";
//
// radioButton3
//
this.radioButton3.AutoSize = true;
this.radioButton3.Location = new System.Drawing.Point(284, 23);
this.radioButton3.Name = "radioButton3";
this.radioButton3.Size = new System.Drawing.Size(96, 17);
this.radioButton3.TabIndex = 2;
this.radioButton3.TabStop = true;
this.radioButton3.Text = "Región + X,OK";
this.radioButton3.UseVisualStyleBackColor = true;
this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged);
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(142, 23);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(59, 17);
this.radioButton2.TabIndex = 1;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "Ragión";
this.radioButton2.UseVisualStyleBackColor = true;
this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(9, 23);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(50, 17);
this.radioButton1.TabIndex = 0;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "X,OK";
this.radioButton1.UseVisualStyleBackColor = true;
this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(365, 43);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(27, 13);
this.label4.TabIndex = 5;
this.label4.Text = "seg.";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(139, 41);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(23, 13);
this.label3.TabIndex = 4;
this.label3.Text = "ms.";
//
// numericLimpieza
//
this.numericLimpieza.Location = new System.Drawing.Point(239, 39);
this.numericLimpieza.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
this.numericLimpieza.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericLimpieza.Name = "numericLimpieza";
this.numericLimpieza.Size = new System.Drawing.Size(120, 20);
this.numericLimpieza.TabIndex = 3;
this.numericLimpieza.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// numericRespuesta
//
this.numericRespuesta.Location = new System.Drawing.Point(13, 39);
this.numericRespuesta.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.numericRespuesta.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericRespuesta.Name = "numericRespuesta";
this.numericRespuesta.Size = new System.Drawing.Size(120, 20);
this.numericRespuesta.TabIndex = 2;
this.numericRespuesta.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(236, 23);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(131, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Limpieza de última lectura.";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(10, 23);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(142, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Tiempo de espera en lectura";
//
// panelButtons
//
this.panelButtons.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.panelButtons.Controls.Add(this.button2);
this.panelButtons.Controls.Add(this.button1);
this.panelButtons.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panelButtons.Location = new System.Drawing.Point(0, 514);
this.panelButtons.Name = "panelButtons";
this.panelButtons.Size = new System.Drawing.Size(422, 55);
this.panelButtons.TabIndex = 10;
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button2.BackColor = System.Drawing.Color.SeaGreen;
this.button2.FlatAppearance.BorderSize = 0;
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button2.ForeColor = System.Drawing.Color.WhiteSmoke;
this.button2.Location = new System.Drawing.Point(310, 10);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(100, 35);
this.button2.TabIndex = 2;
this.button2.Text = "button2";
this.button2.UseVisualStyleBackColor = false;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button1.BackColor = System.Drawing.Color.SeaGreen;
this.button1.FlatAppearance.BorderSize = 0;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.ForeColor = System.Drawing.Color.WhiteSmoke;
this.button1.Location = new System.Drawing.Point(204, 9);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 35);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// panelTitleBar
//
this.panelTitleBar.BackColor = System.Drawing.Color.CornflowerBlue;
this.panelTitleBar.Controls.Add(this.labelCaption);
this.panelTitleBar.Controls.Add(this.btnClose);
this.panelTitleBar.Cursor = System.Windows.Forms.Cursors.Default;
this.panelTitleBar.Dock = System.Windows.Forms.DockStyle.Top;
this.panelTitleBar.Location = new System.Drawing.Point(0, 0);
this.panelTitleBar.Name = "panelTitleBar";
this.panelTitleBar.Size = new System.Drawing.Size(422, 35);
this.panelTitleBar.TabIndex = 9;
this.panelTitleBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelTitleBar_MouseDown);
//
// labelCaption
//
this.labelCaption.AutoSize = true;
this.labelCaption.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelCaption.ForeColor = System.Drawing.Color.White;
this.labelCaption.Location = new System.Drawing.Point(9, 8);
this.labelCaption.Name = "labelCaption";
this.labelCaption.Size = new System.Drawing.Size(86, 17);
this.labelCaption.TabIndex = 4;
this.labelCaption.Text = "labelCaption";
//
// btnClose
//
this.btnClose.Dock = System.Windows.Forms.DockStyle.Right;
this.btnClose.FlatAppearance.BorderSize = 0;
this.btnClose.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(79)))), ((int)(((byte)(95)))));
this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClose.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnClose.ForeColor = System.Drawing.Color.White;
this.btnClose.Location = new System.Drawing.Point(382, 0);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(40, 35);
this.btnClose.TabIndex = 3;
this.btnClose.Text = "X";
this.btnClose.UseVisualStyleBackColor = false;
//
// pictureBox1
//
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox1.Image = global::ScaBox30.Properties.Resources.SR_2000W;
this.pictureBox1.Location = new System.Drawing.Point(178, 19);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(41, 50);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 8;
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
//
// Configuracion
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(422, 569);
this.Controls.Add(this.panelBody);
this.Controls.Add(this.panelButtons);
this.Controls.Add(this.panelTitleBar);
this.Cursor = System.Windows.Forms.Cursors.Hand;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "Configuracion";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Configuración";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Configuracion_FormClosing);
this.Load += new System.EventHandler(this.Configuracion_Load);
this.panelBody.ResumeLayout(false);
this.groupBox7.ResumeLayout(false);
this.groupBox7.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericLimpieza)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericRespuesta)).EndInit();
this.panelButtons.ResumeLayout(false);
this.panelTitleBar.ResumeLayout(false);
this.panelTitleBar.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panelBody;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.RadioButton radioButtonEthernet;
private System.Windows.Forms.RadioButton radioButtonUsb;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.ComboBox comboPrinters;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.NumericUpDown numericLimpieza;
private System.Windows.Forms.NumericUpDown numericRespuesta;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panelButtons;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Panel panelTitleBar;
private System.Windows.Forms.Label labelCaption;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.TextBox TextBoxImpresoraIp;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.TextBox TextBoxScannerIp;
private System.Windows.Forms.GroupBox groupBox7;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textBoxHostIp;
private System.Windows.Forms.RadioButton radioButton3;
private System.Windows.Forms.PictureBox pictureBox1;
}
}

199
ScanBox/Configuracion.cs Normal file
View File

@@ -0,0 +1,199 @@
using ScaBox30.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ScaBox30
{
public partial class Configuracion : Form
{
List<string> printers = new List<string>();
public Configuracion()
{
InitializeComponent();
InitializeItems();
InitializeButtons();
}
private void Configuracion_Load(object sender, EventArgs e)
{
ListPrinters();
LoadConfigJson(Globals.config_json);
switch (Globals.cfg.printertype)
{
case "usb":
radioButtonUsb.Checked = true;
break;
case "eth":
radioButtonEthernet.Checked = true;
break;
}
switch (Globals.cfg.resultado)
{
case "label":
radioButton1.Checked = true;
break;
case "number":
radioButton2.Checked = true;
break;
case "numberlabel":
radioButton3.Checked = true;
break;
}
}
private void ListPrinters()
{
foreach (string printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
{
printers.Add(printer);
}
comboPrinters.Items.AddRange(printers.ToArray());
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
Globals.cfg.resultado = "label";
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
Globals.cfg.resultado = "number";
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
Globals.cfg.resultado = "numberlabel";
}
private void pictureBox1_Click(object sender, EventArgs e)
{
Ayuda help = new Ayuda();
help.ShowDialog();
}
private void radioButtonUsb_CheckedChanged(object sender, EventArgs e)
{
Globals.cfg.printertype = "usb";
comboPrinters.Enabled = true;
TextBoxImpresoraIp.Enabled = false;
}
private void radioButtonEthernet_CheckedChanged(object sender, EventArgs e)
{
Globals.cfg.printertype = "eth";
comboPrinters.Enabled = false;
TextBoxImpresoraIp.Enabled = true;
}
private void LoadConfigJson(string jsonfile)
{
if (File.Exists(jsonfile))
{
string jsoncontent = File.ReadAllText(jsonfile);
Globals.config = JsonSerializer.Deserialize<List<Config>>(jsoncontent);
numericLimpieza.Value = Globals.config[0].cleardelay;
numericRespuesta.Value = Globals.config[0].interval;
TextBoxScannerIp.Text = Globals.config[0].ipscanner;
comboPrinters.SelectedItem = Globals.config[0].usbprinter;
TextBoxImpresoraIp.Text = Globals.config[0].ipprinter;
textBoxHostIp.Text = Globals.config[0].iphost;
}
}
private void button1_Click(object sender, EventArgs e)
{
Globals.cfg.cleardelay = (int)numericLimpieza.Value;
Globals.cfg.interval = (int)numericRespuesta.Value;
Globals.cfg.ipscanner = TextBoxScannerIp.Text;
Globals.cfg.usbprinter = comboPrinters.SelectedItem == null?"none":comboPrinters.SelectedItem.ToString();
Globals.cfg.ipprinter = TextBoxImpresoraIp.Text;
Globals.cfg.iphost = textBoxHostIp.Text;
Globals.config.Clear();
Globals.config.Add(Globals.cfg);
var json = JsonSerializer.Serialize<List<Config>>(Globals.config);
File.WriteAllText(Globals.config_json, json);
RJMessageBox.Show("Configuración actualizada correctamente", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void Configuracion_FormClosing(object sender, FormClosingEventArgs e)
{
Globals.valid_user = false;
}
private void InitializeItems()
{
this.FormBorderStyle = FormBorderStyle.None;
this.Padding = new Padding(Globals.borderSize);//Set border size
this.btnClose.DialogResult = DialogResult.Cancel;
this.labelCaption.Text = this.Text;
this.panelTitleBar.BackColor = Globals.primaryColor;
this.panelTitleBar.Padding = new Padding(0, 0, 0, Globals.borderSize);
this.BackColor = Globals.primaryColor;
}
private void InitializeButtons()
{
int xCenter = (this.panelButtons.Width - button1.Width) / 2;
int yCenter = (this.panelButtons.Height - button1.Height) / 2;
//OK Button
button1.Visible = true;
//button1.Location = new Point(xCenter - (button1.Width / 2) - 5, yCenter);
button1.Text = "Guardar";
//button1.DialogResult = DialogResult.OK;//Set DialogResult
//Cancel Button
button2.Visible = true;
//button2.Location = new Point(xCenter + (button2.Width / 2) + 5, yCenter);
button2.Text = "Salir";
button2.DialogResult = DialogResult.Cancel;//Set DialogResult
button2.BackColor = Globals.colors.retry_cancell;
}
#region -> Drag Form
[DllImport("user32.DLL", EntryPoint = "SendMessage")]
private extern static void SendMessage(System.IntPtr hWnd, int wMsg, int wParam, int lParam);
[DllImport("user32.DLL", EntryPoint = "ReleaseCapture")]
private extern static void ReleaseCapture();
private void panelTitleBar_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, 0x112, 0xf012, 0);
}
#endregion
}
}

120
ScanBox/Configuracion.resx Normal file
View File

@@ -0,0 +1,120 @@
<?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>

View File

@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ScaBox30.Controller
{
internal class DbController
{
private string _path;
private OleDbConnection _connection;
private OleDbCommand _command;
private OleDbDataReader _reader;
public void SetWorkingDb(string path)
{
_path = path;
}
public void Open()
{
_connection = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" + "Data Source=" + _path);
try
{
_connection.Open();
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
public void Close()
{
try
{
_connection.Close();
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
public OleDbDataReader Query(string query)
{
try
{
_command = new OleDbCommand(query, _connection);
_reader = _command.ExecuteReader();
}
catch (Exception e)
{
Console.WriteLine(e);
}
return _reader;
}
public void InsertQuery(String query)
{
try
{
_command = new OleDbCommand(query, _connection);
_command.ExecuteNonQuery();
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
}
}

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zebra.Sdk.Printer.Discovery;
namespace ScaBox30
{
//CLASE ZEBRA PARA LA BUSQUEDA DE IMPRESORAS EN LA RED
class NetworkDiscoveryHandler : DiscoveryHandler
{
private bool discoveryComplete = false;
public List<DiscoveredPrinter> printers = new List<DiscoveredPrinter>();
public void DiscoveryError(string message)
{
Console.WriteLine($"An error occurred during discovery: {message}.");
discoveryComplete = true;
}
public void DiscoveryFinished()
{
foreach (DiscoveredPrinter printer in printers)
{
Console.WriteLine(printer);
}
Console.WriteLine($"Discovered {printers.Count} Link-OS(TM) printers.");
discoveryComplete = true;
}
public void FoundPrinter(DiscoveredPrinter printer)
{
printers.Add(printer);
}
public bool DiscoveryComplete
{
get => discoveryComplete;
}
}
}

View File

@@ -0,0 +1,174 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Printer.Discovery;
// *************************************
// * Angel Ivan 07/Nov/2024
// *************************************
namespace ScaBox30.Controller
{
class ZebraController
{
String prnfile = "";
String prnpath = Application.StartupPath + "\\";
string etiqueta;
StreamReader reader;
public ZebraController(String prnpath)
{
this.prnpath += prnpath;
}
#region ZEBRA -> initDiscovery()
public void initDiscovery()
{
NetworkDiscoveryHandler discoveryHandler = new NetworkDiscoveryHandler();
try
{
Console.WriteLine("Starting printer discovery.");
NetworkDiscoverer.FindPrinters(discoveryHandler);
while (!discoveryHandler.DiscoveryComplete)
{
System.Threading.Thread.Sleep(10);
}
}
catch (DiscoveryException e)
{
Console.WriteLine(e.ToString());
}
}
#endregion
#region ZEBRA -> buildPrn()
public void buildPrn(String v1, String v2, String v3, String barcode)
{
try
{
etiqueta = "";
reader = new StreamReader(prnpath);
prnfile = reader.ReadToEnd();
reader.Close();
}
catch (IOException)
{
MessageBox.Show("No se ha podido abrir la plantilla de impresión\n" + prnpath, "Error de impresión", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
string[] lines = prnfile.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
foreach (string line in lines)
{
if (line.Contains("$V1$"))
{
/*Falta el dato desde master_codigos.csv posiblemente*/
etiqueta += v1 != null ? line.Replace("$V1$", v1) : line.Replace("$V1$", "null");
}
else if (line.Contains("$V2$"))
{
etiqueta += v2 != null ? line.Replace("$V2$", v2) : line.Replace("$V2$", "null" + " / " + "null");
}
else if (line.Contains("0000000000"))
{
etiqueta += !barcode.Contains("-") ? line.Replace("0000000000", barcode) : line.Replace("0000000000", "0000000000");
}
else if (line.Contains("$V3$"))
{
etiqueta += line.Replace("$V3$", v3);
}
else
{
etiqueta += line;
}
}
}
#endregion
#region ZEBRA -> SendZplOverTcp(string theIpAddress)
public void SendZplOverTcp(string theIpAddress)
{
// Instantiate connection for ZPL TCP port at given address
Connection thePrinterConn = new TcpConnection(theIpAddress, TcpConnection.DEFAULT_ZPL_TCP_PORT);
try
{
// Open the connection - physical connection is established here.
thePrinterConn.Open();
//se obtiene la plantilla de la etiqueta y se reemplazan los valores
//readprn();
// This example prints "This is a ZPL test." near the top of the label.
//string zplData = "^XA^FO20,20^A0N,25,25^FDThis is a ZPL test.^FS^XZ";
string zplData = etiqueta;
// Send the data to printer as a byte array.
thePrinterConn.Write(Encoding.UTF8.GetBytes(zplData));
}
catch (ConnectionException e)
{
Console.WriteLine(e.ToString());
}
finally
{
// Close the connection to release resources.
thePrinterConn.Close();
}
}
#endregion
#region SendZplOverUsb(string usbDriverName)
public void SendZplOverUsb(string usbDriverName)
{
Connection thePrinterConn = null;
try
{
// Instantiate USB connection for ZPL printer through its driver
thePrinterConn = ConnectionBuilder.Build($"USB:{usbDriverName}");
// Open the connection - physical connection is established here.
thePrinterConn.Open();
//se obtiene la plantilla de la etiqueta y se reemplazan los valores
//readprn();
// This example prints "This is a ZPL test." near the top of the label.
string zplData = "^XA^FO20,20^A0N,25,25^FDThis is a ZPL test.^FS^XZ";
//string zplData = etiqueta;
// Send the data to printer as a byte array.
thePrinterConn.Write(Encoding.UTF8.GetBytes(zplData));
}
catch (ConnectionException e)
{
// Handle communications error here.
Console.WriteLine(e.ToString());
}
finally
{
// Close the connection to release resources.
if (thePrinterConn != null)
{
thePrinterConn.Close();
}
}
}
#endregion
}
}

592
ScanBox/DataUI.cs Normal file
View File

@@ -0,0 +1,592 @@
using ScaBox30.Controller;
using ScaBox30.Model;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ScaBox30
{
public partial class DataUI : Form
{
private List<Char> _barcode = new List<char> { };
private DbController _db = new DbController();
private OleDbDataReader _reader;
private List<Data> _new_data = new List<Data>();
private string _data_json = Application.StartupPath + "\\data.json";
private string _db_mdb = "";
// AZUL SELECTOR BLANCO
/*Color header = Color.FromArgb(52, 73, 94);
Color selector = Color.White;
Color primary = Color.FromArgb(84, 153, 199);
Color secondary = Color.FromArgb(174, 214, 241);*/
// AZUL SELECTOR GRIS AZUL
Color header = Color.FromArgb(52, 93, 200);
Color selector = Color.Silver;
Color primary = Color.FromArgb(84, 153, 199);
Color secondary = Color.FromArgb(174, 214, 241);
// ROJO SELECTOR CRIMSON
/*Color header = Color.Firebrick;
Color selector = Color.Crimson;
Color primary = Color.FromArgb(255, 128, 128);
Color secondary = Color.FromArgb(255, 192, 192);*/
// ROJO SELECTOR BLANCO
/*Color header = Color.Firebrick;
Color selector = Color.White;
Color primary = Color.FromArgb(255, 128, 128);
Color secondary = Color.FromArgb(255, 192, 192);*/
public DataUI()
{
InitializeComponent();
InitializeItems();
this.SetStyle(ControlStyles.ResizeRedraw, true);
LoadUsers();
LoadJson(_data_json);
ActiveControl = textBoxCCE;
SetGridStyle(header, selector, primary, secondary);
}
private void SetGridStyle(Color _header, Color _selector, Color _primary, Color _secundary)
{
if (true)
{
// CONFIGURACION GENERAL DEL DATAGRIDVIEW
dataGridView1.BackgroundColor = _secundary; // ESTABLECE EL COLOR DE FONDO
dataGridView1.EnableHeadersVisualStyles = false; // HABILITA O DESHABILITA EL BORDE DEL HEADER
dataGridView1.ScrollBars = ScrollBars.Both; // HABILITA EL SCROLLBAR DE MANERA VERTICAL Y HORIZONTAL
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells; // AJUSTA DE MANRA AUTOMATICA EL TAMAÑO DE LAS COLUMNAS
dataGridView1.GridColor = Color.White; // ESTABLECE EL COLOR DE LAS LINEAS DE LA CUADRICULA
// SELECTOR DE FILAS
dataGridView1.RowHeadersVisible = false; // DESHABILITA LA VISUALIZACION DEL HEADER DE LAS FILAS
dataGridView1.AllowUserToResizeRows = false; // DESHABILITA LA POSIBILIDAD DE CAMBIAR DE TAMAÑO LAS FILAS
// ESTILO DE COLUMNAS
dataGridView1.ColumnHeadersHeight = 23; // ESTABLECE EL ALTO DE LAS FILAS
dataGridView1.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = header;
dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("Microsoft Sans Serif", 10F, style:FontStyle.Bold , GraphicsUnit.Pixel);
dataGridView1.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
dataGridView1.ColumnHeadersDefaultCellStyle.SelectionBackColor = _selector;
dataGridView1.ColumnHeadersDefaultCellStyle.SelectionForeColor = Color.White;
// ESTILO DE CELDAS
//dataGridView1.CellBorderStyle = DataGridViewCellBorderStyle.None;
dataGridView1.DefaultCellStyle.BackColor = _primary;
dataGridView1.DefaultCellStyle.Font = new Font("Microsoft Sans Serif", 10F, GraphicsUnit.Pixel);
dataGridView1.DefaultCellStyle.ForeColor = Color.Black;
dataGridView1.DefaultCellStyle.SelectionBackColor = _selector;
dataGridView1.DefaultCellStyle.SelectionForeColor = Color.Black;
dataGridView1.DefaultCellStyle.ForeColor = Color.Black;
// ESTILO CELDAS ALTERNADAS
dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = _secundary;
dataGridView1.AlternatingRowsDefaultCellStyle.Font = new Font("Microsoft Sans Serif", 10F, GraphicsUnit.Pixel);
dataGridView1.AlternatingRowsDefaultCellStyle.ForeColor = Color.Black;
dataGridView1.AlternatingRowsDefaultCellStyle.SelectionBackColor = _selector;
dataGridView1.AlternatingRowsDefaultCellStyle.SelectionForeColor = Color.Black;
}
}
// CARGA EL ARCHIVO DATA.JSON EXISTENTE
private void LoadJson(String jsonfile)
{
if (File.Exists(jsonfile))
{
Globals.actual_data.Clear();
this.Cursor = Cursors.WaitCursor;
string jscontent = File.ReadAllText(jsonfile);
Globals.actual_data = JsonSerializer.Deserialize<List<Data>>(jscontent);
dataGridView1.DataSource = Globals.actual_data;
labelRegistros.Text = "Registros: " + Globals.actual_data.Count.ToString();
jscontent = "";
this.Cursor = Cursors.Default;
}
}
private void LoadUsers()
{
CreateUserJson(Globals.auth_json);
LoadUserJson(Globals.auth_json);
}
private void CreateUserJson(string jsonfile)
{
if (!File.Exists(jsonfile))
{
List<User> users = new List<User> { };
users.Add(new User() { user = "admin", password = "admin123" });
var json = JsonSerializer.Serialize<List<User>>(users);
File.WriteAllText(jsonfile, json);
users.Clear();
}
}
private void LoadUserJson(string jsonfile)
{
if (File.Exists(jsonfile))
{
Globals.users.Clear();
string jsoncontent = File.ReadAllText(jsonfile);
Globals.users = JsonSerializer.Deserialize<List<User>>(jsoncontent);
jsoncontent = "";
}
}
// OBTIENE EL BOX_CAPACITY EXISTENTE
private String FindBoxCapacity(List<Data> actual, OleDbDataReader nueva)
{
// String capacity = "";
/*foreach (var item in actual)
{
if (item.CCE == nueva.GetValue(0).ToString()){ capacity = item.Box_Capacity; }
}*/
var capacity = (from item in actual where item.CCE == nueva.GetValue(0).ToString() select item.Box_Capacity).FirstOrDefault();
return capacity;
}
// CARGA LOS ELEMENTOS DE LA FILA SELECCIONADA A LA INTERFAZ
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex > -1)
{
//textBoxCCE.Text = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
}
}
// GUARDA LOS CAMBIOS REALIZADOS AL DATAGRIDVIEW
private void buttonSave_Click(object sender, EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
List<Data> records = new List<Data> { };
// OBTIENE LA INFORMACION DEL DATAGRIDVIEW Y LA PASA A UNA INSTANCIA DE LA CLASE DB
foreach (DataGridViewRow row in dataGridView1.Rows)
{
Data rowd = row.DataBoundItem as Data;
if (rowd != null){ records.Add(rowd); }
}
var json = JsonSerializer.Serialize<List<Data>>(records);
File.WriteAllText(_data_json, json);
this.Cursor = Cursors.Default;
// SE REALIZAN TAREAS DE LIMPIEZA DE MEMORIA
records.Clear();
GC.Collect();
GC.WaitForPendingFinalizers();
//******************************************
RJMessageBox.Show("Actualizada correctamente", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void textBoxCCE_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Enter)
{
int rowIndex = -1;
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if (row.Cells[0].Value.ToString().Equals(textBoxCCE.Text))
{
rowIndex = row.Index;
break;
}
}
if (rowIndex > -1)
{
dataGridView1.ClearSelection();
dataGridView1.Rows[rowIndex].Selected = true;
dataGridView1.FirstDisplayedScrollingRowIndex = rowIndex;
}
else
{
RJMessageBox.Show("OPC No encontrdao", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
textBoxCCE.Clear();
}
}
private String OpenDbFileDialog()
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "Access File (*.mdb)|*.mdb|All files (*.*)|*.*";
openFileDialog.ShowDialog();
return openFileDialog.FileName;
}
private async void buttonOpenFile_Click(object sender, EventArgs e)
{
Usuario usuario = new Usuario();
DialogResult result = usuario.ShowDialog();
if (Globals.valid_user && result != DialogResult.Cancel)
{
_db_mdb = OpenDbFileDialog();
textPathFile.Text = _db_mdb;
await Task.Delay(500);
// SI EL ARCHIVO DATA.JSON EXISTE SE OBTIENEN LOS REGISTROS ACTUALES
if (File.Exists(_data_json))
{
this.Cursor = Cursors.WaitCursor;
string filecontent = File.ReadAllText(_data_json);
Globals.actual_data = JsonSerializer.Deserialize<List<Data>>(filecontent);
filecontent = "";
this.Cursor = Cursors.Default;
}
if (File.Exists(_db_mdb))
{
this.Cursor = Cursors.WaitCursor;
_db.SetWorkingDb(_db_mdb);
_db.Open();
try
{
// POR MEDIO DEL QUERY NOS ASEGURAMOS DE TRAER LA DATA EN EL ORDEN CORRECTO
string base_columns = "CCE,VERSION,ETAT,MARQUE,TEINTE,PS1,PS2,DIAM,SPHM,CYLM,Ref_Etiquette,code_epc,oeil,base,addition,epc,indice,dec,diam1,diam2,ref_coque,ref_cond,nom_1,nom_2,matiere_fr,matiere_us,couleur_fr,couleur_us,vernis,traitement_1,traitement_2,traitement_3,signom,sig1,sig2,code_upc,code_jan1,code_jan2,Reserve1,Reserve2,reserve_art_1,reserve_art_2,Ref_NiceLabel";
// SE REALIZA UNA CONSULTA DE PRUEBA PARA DETERMINAR LA CANTIDAD DE COLUMNAS A IMPORTAR
_reader = _db.Query("SELECT * FROM Standard");
if (_reader != null)
{
Globals.boxcapacity = _reader.FieldCount == 44 ? true : false;
}
_reader = Globals.boxcapacity ? ( _db.Query("SELECT " + base_columns + ", Box_Capacity FROM Standard" )) : (_db.Query("SELECT " + base_columns + " FROM Standard"));
if (_reader != null && !_reader.IsClosed) // Si la consulta no retornó un valor null y si el reader no es null y no está cerrado
{
while (_reader.Read())
{
_new_data.Add(
new Data
{
CCE = _reader.GetValue(0).ToString().Replace(" ", ""),
VERSION = _reader.GetValue(1).ToString().Replace(" ", ""),
ETAT = _reader.GetValue(2).ToString().Replace(" ", ""),
MARQUE = _reader.GetValue(3).ToString().Replace(" ", ""),
TEINTE = _reader.GetValue(4).ToString().Replace(" ", ""),
PS1 = _reader.GetValue(5).ToString().Replace(" ", ""),
PS2 = _reader.GetValue(6).ToString().Replace(" ", ""),
DIAM = _reader.GetValue(7).ToString().Replace(" ", ""),
SPHM = _reader.GetValue(8).ToString().Replace(" ", ""),
CYLM = _reader.GetValue(9).ToString().Replace(" ", ""),
Ref_Etiquette = _reader.GetValue(10).ToString().Replace(" ", ""),
code_epc = _reader.GetValue(11).ToString().Replace(" ", ""),
oeil = _reader.GetValue(12).ToString().Replace(" ", ""),
@base = _reader.GetValue(13).ToString().Replace(" ", ""),
addition = _reader.GetValue(14).ToString().Replace(" ", ""),
epc = _reader.GetValue(15).ToString().Replace(" ", ""),
indice = _reader.GetValue(16).ToString().Replace(" ", ""),
dec = _reader.GetValue(17).ToString().Replace(" ", ""),
diam1 = _reader.GetValue(18).ToString().Replace(" ", ""),
diam2 = _reader.GetValue(19).ToString().Replace(" ", ""),
ref_coque = _reader.GetValue(20).ToString().Replace(" ", ""),
ref_cond = _reader.GetValue(21).ToString().Replace(" ", ""),
nom_1 = _reader.GetValue(22).ToString(),
nom_2 = _reader.GetValue(23).ToString(),
matiere_fr = _reader.GetValue(24).ToString().Replace(" ", ""),
matiere_us = _reader.GetValue(25).ToString().Replace(" ", ""),
couleur_fr = _reader.GetValue(26).ToString().Replace(" ", ""),
couleur_us = _reader.GetValue(27).ToString().Replace(" ", ""),
vernis = _reader.GetValue(28).ToString().Replace(" ", ""),
traitement_1 = _reader.GetValue(29).ToString().Replace(" ", ""),
traitement_2 = _reader.GetValue(30).ToString().Replace(" ", ""),
traitement_3 = _reader.GetValue(31).ToString().Replace(" ", ""),
signom = _reader.GetValue(32).ToString().Replace(" ", ""),
sig1 = _reader.GetValue(33).ToString().Replace(" ", ""),
sig2 = _reader.GetValue(34).ToString().Replace(" ", ""),
code_upc = _reader.GetValue(35).ToString().Replace(" ", ""),
code_jan1 = _reader.GetValue(36).ToString().Replace(" ", ""),
code_jan2 = _reader.GetValue(37).ToString().Replace(" ", ""),
Reserve1 = _reader.GetValue(38).ToString().Replace(" ", ""),
Reserve2 = _reader.GetValue(39).ToString().Replace(" ", ""),
reserve_art_1 = _reader.GetValue(40).ToString().Replace(" ", ""),
reserve_art_2 = _reader.GetValue(41).ToString().Replace(" ", ""),
Ref_NiceLabel = _reader.GetValue(42).ToString().Replace(" ", ""),
Box_Capacity = Globals.boxcapacity? _reader.GetValue(43).ToString().Replace(" ", "") : FindBoxCapacity(Globals.actual_data, _reader),
} // new db
); // new_records
}
_reader.Close();
_db.Close();
labelRegistros.Text = "Registros: " + _new_data.Count();
var json = JsonSerializer.Serialize<List<Data>>(_new_data);
File.WriteAllText(_data_json, json);
// SE REALIZAN TAREAS DE LIMPIEZA DE MEMORIA
_new_data.Clear();
Globals.actual_data.Clear();
GC.Collect();
GC.WaitForPendingFinalizers();
// *****************************************
LoadJson(_data_json);
RJMessageBox.Show("Base de datos importada correctamente", "ScanBox", MessageBoxButtons.OK,MessageBoxIcon.Information);
}
else
{
RJMessageBox.Show("No fue posible importar la base de datos. Asegurese de que la tabla Standard existe.", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
this.Cursor = Cursors.Default;
}
catch (Exception ex)
{
this.Cursor = Cursors.Default;
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
// Reset login
Globals.valid_user = false;
}
else
{
if (result != DialogResult.Cancel)
{
RJMessageBox.Show("No tiene permiso para realizar esta acción", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
if (!Globals.valid_user)
{
Usuario usuario = new Usuario();
DialogResult result = usuario.ShowDialog();
if (Globals.valid_user)
{
RJMessageBox.Show("Ya puede editar la tabla", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Information);
dataGridView1.ReadOnly = false;
}
else
{
if (result != DialogResult.Cancel)
{
RJMessageBox.Show("No tiene permiso para realizar esta acción", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Warning);
dataGridView1.ReadOnly = true;
}
}
}
}
// VALIDACIONES DE LA COLUMNA BOX_CAPACITY
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
var value = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
string colname = "Box_Capacity";
if (value != null && dataGridView1.Columns[e.ColumnIndex].Name == colname)
{
if (Int32.TryParse(value.ToString(), out int x))
{
//Restrucción de 3 dígitos
//if (x > 99)
//{
// RJMessageBox.Show("BoxCapacity no puede ser mayor a dos dígitos", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "";
//}
//Restriccion de cero
if (!(x > 1))
{
RJMessageBox.Show("BoxCapacity debe ser mayor a cero", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Warning);
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "";
}
}
else
{
RJMessageBox.Show("Solo se permiten números", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Warning);
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "";
}
}
}
private void btnEdit_Click(object sender, EventArgs e)
{
Usuario usuario = new Usuario();
usuario.ShowDialog();
if (Globals.valid_user)
{
RJMessageBox.Show("Ya puede editar la tabla", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Information);
dataGridView1.ReadOnly = false;
}else
{
RJMessageBox.Show("No tiene permiso para realizar esta acción", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Warning);
dataGridView1.ReadOnly = true;
}
}
private void DataUI_FormClosing(object sender, FormClosingEventArgs e)
{
// Reset login
Globals.valid_user = false;
}
private void InitializeItems()
{
this.FormBorderStyle = FormBorderStyle.None;
this.Padding = new Padding(Globals.borderSize);//Set border size
this.btnClose.DialogResult = DialogResult.Cancel;
this.labelCaption.Text = this.Text;
this.panelTitleBar.BackColor = Globals.primaryColor;
this.panelTitleBar.Padding = new Padding(0, 0, 0, Globals.borderSize);
this.BackColor = Globals.primaryColor;
}
#region -> Maximizar
private void btnMax_Click(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
}
else
{
WindowState = FormWindowState.Maximized;
}
}
#endregion
#region -> Minimizar
private void btnMin_Click(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Normal || WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Minimized;
}
else
{
WindowState = FormWindowState.Normal;
}
}
#endregion
#region -> Drag Form
[DllImport("user32.DLL", EntryPoint = "SendMessage")]
private extern static void SendMessage(System.IntPtr hWnd, int wMsg, int wParam, int lParam);
[DllImport("user32.DLL", EntryPoint = "ReleaseCapture")]
private extern static void ReleaseCapture();
private void panelTitleBar_MouseDown(object sender, MouseEventArgs e)
{
if (e.Clicks == 2)
{
WindowState = WindowState == FormWindowState.Maximized ? FormWindowState.Normal: FormWindowState.Maximized;
}
else
{
ReleaseCapture();
SendMessage(this.Handle, 0x112, 0xf012, 0);
}
}
#endregion
#region -> Resize Form
private const int cGrip = 16;
private const int cCaption = 32;
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x84)
{
Point pos = new Point(m.LParam.ToInt32());
pos = this.PointToClient(pos);
if (pos.Y < cCaption)
{
m.Result = (IntPtr)2;
return;
}
if (pos.X >= this.ClientSize.Width - cGrip && pos.Y >= this.ClientSize.Height - cGrip)
{
m.Result = (IntPtr)17;
return;
}
}
base.WndProc(ref m);
}
#endregion
}
}

298
ScanBox/DataUI.designer.cs generated Normal file
View File

@@ -0,0 +1,298 @@
namespace ScaBox30
{
partial class DataUI
{
/// <summary>
/// Variable del diseñador necesaria.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Limpiar los recursos que se estén usando.
/// </summary>
/// <param name="disposing">true si los recursos administrados se deben desechar; false en caso contrario.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Código generado por el Diseñador de Windows Forms
/// <summary>
/// Método necesario para admitir el Diseñador. No se puede modificar
/// el contenido de este método con el editor de código.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DataUI));
this.textBoxCCE = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.buttonSave = new System.Windows.Forms.Button();
this.labelRegistros = new System.Windows.Forms.Label();
this.buttonOpenFile = new System.Windows.Forms.Button();
this.textPathFile = new System.Windows.Forms.TextBox();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.panelBody = new System.Windows.Forms.Panel();
this.panelButtons = new System.Windows.Forms.Panel();
this.panelTitleBar = new System.Windows.Forms.Panel();
this.btnMin = new System.Windows.Forms.Button();
this.btnMax = new System.Windows.Forms.Button();
this.labelCaption = new System.Windows.Forms.Label();
this.btnClose = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.panelBody.SuspendLayout();
this.panelButtons.SuspendLayout();
this.panelTitleBar.SuspendLayout();
this.SuspendLayout();
//
// textBoxCCE
//
this.textBoxCCE.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.textBoxCCE.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBoxCCE.Location = new System.Drawing.Point(595, 411);
this.textBoxCCE.Name = "textBoxCCE";
this.textBoxCCE.Size = new System.Drawing.Size(157, 29);
this.textBoxCCE.TabIndex = 15;
this.textBoxCCE.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBoxCCE_KeyDown);
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(439, 414);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(150, 24);
this.label1.TabIndex = 14;
this.label1.Text = "Buscar código:";
//
// buttonSave
//
this.buttonSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonSave.BackColor = System.Drawing.Color.SteelBlue;
this.buttonSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonSave.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.buttonSave.ForeColor = System.Drawing.Color.WhiteSmoke;
this.buttonSave.Location = new System.Drawing.Point(759, 408);
this.buttonSave.Name = "buttonSave";
this.buttonSave.Size = new System.Drawing.Size(100, 35);
this.buttonSave.TabIndex = 13;
this.buttonSave.Text = "Guardar";
this.buttonSave.UseVisualStyleBackColor = false;
this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
//
// labelRegistros
//
this.labelRegistros.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelRegistros.AutoSize = true;
this.labelRegistros.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelRegistros.Location = new System.Drawing.Point(13, 408);
this.labelRegistros.Name = "labelRegistros";
this.labelRegistros.Size = new System.Drawing.Size(103, 24);
this.labelRegistros.TabIndex = 12;
this.labelRegistros.Text = "Registros:";
//
// buttonOpenFile
//
this.buttonOpenFile.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
this.buttonOpenFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOpenFile.BackColor = System.Drawing.Color.SeaGreen;
this.buttonOpenFile.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonOpenFile.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.buttonOpenFile.ForeColor = System.Drawing.Color.WhiteSmoke;
this.buttonOpenFile.Location = new System.Drawing.Point(759, 14);
this.buttonOpenFile.Name = "buttonOpenFile";
this.buttonOpenFile.Size = new System.Drawing.Size(100, 35);
this.buttonOpenFile.TabIndex = 13;
this.buttonOpenFile.Text = "Open File";
this.buttonOpenFile.UseVisualStyleBackColor = false;
this.buttonOpenFile.Click += new System.EventHandler(this.buttonOpenFile_Click);
//
// textPathFile
//
this.textPathFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textPathFile.BackColor = System.Drawing.Color.White;
this.textPathFile.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textPathFile.Location = new System.Drawing.Point(11, 19);
this.textPathFile.Name = "textPathFile";
this.textPathFile.ReadOnly = true;
this.textPathFile.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.textPathFile.Size = new System.Drawing.Size(742, 26);
this.textPathFile.TabIndex = 12;
//
// dataGridView1
//
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(13, 13);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.dataGridView1.Size = new System.Drawing.Size(846, 389);
this.dataGridView1.TabIndex = 18;
this.dataGridView1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit);
this.dataGridView1.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView1_CellMouseDoubleClick);
//
// panelBody
//
this.panelBody.BackColor = System.Drawing.Color.WhiteSmoke;
this.panelBody.Controls.Add(this.dataGridView1);
this.panelBody.Controls.Add(this.labelRegistros);
this.panelBody.Controls.Add(this.textBoxCCE);
this.panelBody.Controls.Add(this.buttonSave);
this.panelBody.Controls.Add(this.label1);
this.panelBody.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelBody.Location = new System.Drawing.Point(0, 35);
this.panelBody.Name = "panelBody";
this.panelBody.Padding = new System.Windows.Forms.Padding(10, 10, 0, 0);
this.panelBody.Size = new System.Drawing.Size(871, 457);
this.panelBody.TabIndex = 21;
//
// panelButtons
//
this.panelButtons.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.panelButtons.Controls.Add(this.label2);
this.panelButtons.Controls.Add(this.textPathFile);
this.panelButtons.Controls.Add(this.buttonOpenFile);
this.panelButtons.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panelButtons.Location = new System.Drawing.Point(0, 492);
this.panelButtons.Name = "panelButtons";
this.panelButtons.Size = new System.Drawing.Size(871, 60);
this.panelButtons.TabIndex = 20;
//
// panelTitleBar
//
this.panelTitleBar.BackColor = System.Drawing.Color.CornflowerBlue;
this.panelTitleBar.Controls.Add(this.btnMin);
this.panelTitleBar.Controls.Add(this.btnMax);
this.panelTitleBar.Controls.Add(this.labelCaption);
this.panelTitleBar.Controls.Add(this.btnClose);
this.panelTitleBar.Dock = System.Windows.Forms.DockStyle.Top;
this.panelTitleBar.Location = new System.Drawing.Point(0, 0);
this.panelTitleBar.Name = "panelTitleBar";
this.panelTitleBar.Size = new System.Drawing.Size(871, 35);
this.panelTitleBar.TabIndex = 19;
this.panelTitleBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelTitleBar_MouseDown);
//
// btnMin
//
this.btnMin.Dock = System.Windows.Forms.DockStyle.Right;
this.btnMin.FlatAppearance.BorderSize = 0;
this.btnMin.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Silver;
this.btnMin.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnMin.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnMin.ForeColor = System.Drawing.Color.White;
this.btnMin.Location = new System.Drawing.Point(751, 0);
this.btnMin.Name = "btnMin";
this.btnMin.Size = new System.Drawing.Size(40, 35);
this.btnMin.TabIndex = 6;
this.btnMin.Text = "-";
this.btnMin.UseVisualStyleBackColor = false;
this.btnMin.Visible = false;
this.btnMin.Click += new System.EventHandler(this.btnMin_Click);
//
// btnMax
//
this.btnMax.Cursor = System.Windows.Forms.Cursors.Default;
this.btnMax.Dock = System.Windows.Forms.DockStyle.Right;
this.btnMax.FlatAppearance.BorderSize = 0;
this.btnMax.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Silver;
this.btnMax.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnMax.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnMax.ForeColor = System.Drawing.Color.White;
this.btnMax.Location = new System.Drawing.Point(791, 0);
this.btnMax.Name = "btnMax";
this.btnMax.Size = new System.Drawing.Size(40, 35);
this.btnMax.TabIndex = 5;
this.btnMax.Text = "[ ]";
this.btnMax.UseVisualStyleBackColor = false;
this.btnMax.Click += new System.EventHandler(this.btnMax_Click);
//
// labelCaption
//
this.labelCaption.AutoSize = true;
this.labelCaption.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelCaption.ForeColor = System.Drawing.Color.White;
this.labelCaption.Location = new System.Drawing.Point(9, 8);
this.labelCaption.Name = "labelCaption";
this.labelCaption.Size = new System.Drawing.Size(86, 17);
this.labelCaption.TabIndex = 4;
this.labelCaption.Text = "labelCaption";
//
// btnClose
//
this.btnClose.Dock = System.Windows.Forms.DockStyle.Right;
this.btnClose.FlatAppearance.BorderSize = 0;
this.btnClose.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(79)))), ((int)(((byte)(95)))));
this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClose.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnClose.ForeColor = System.Drawing.Color.White;
this.btnClose.Location = new System.Drawing.Point(831, 0);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(40, 35);
this.btnClose.TabIndex = 3;
this.btnClose.Text = "X";
this.btnClose.UseVisualStyleBackColor = false;
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(13, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(182, 18);
this.label2.TabIndex = 19;
this.label2.Text = "Importar base de datos";
//
// DataUI
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(871, 552);
this.Controls.Add(this.panelBody);
this.Controls.Add(this.panelButtons);
this.Controls.Add(this.panelTitleBar);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "DataUI";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Data";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DataUI_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.panelBody.ResumeLayout(false);
this.panelBody.PerformLayout();
this.panelButtons.ResumeLayout(false);
this.panelButtons.PerformLayout();
this.panelTitleBar.ResumeLayout(false);
this.panelTitleBar.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TextBox textBoxCCE;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button buttonSave;
private System.Windows.Forms.Label labelRegistros;
private System.Windows.Forms.Button buttonOpenFile;
private System.Windows.Forms.TextBox textPathFile;
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.Panel panelBody;
private System.Windows.Forms.Panel panelButtons;
private System.Windows.Forms.Panel panelTitleBar;
private System.Windows.Forms.Label labelCaption;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button btnMin;
private System.Windows.Forms.Button btnMax;
private System.Windows.Forms.Label label2;
}
}

3607
ScanBox/DataUI.resx Normal file

File diff suppressed because it is too large Load Diff

216
ScanBox/FormMessageBox.Designer.cs generated Normal file
View File

@@ -0,0 +1,216 @@

namespace ScaBox30.Private
{
partial class FormMessageBox
{
/// <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.panelTitleBar = new System.Windows.Forms.Panel();
this.labelCaption = new System.Windows.Forms.Label();
this.btnClose = new System.Windows.Forms.Button();
this.panelButtons = new System.Windows.Forms.Panel();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.panelBody = new System.Windows.Forms.Panel();
this.labelMessage = new System.Windows.Forms.Label();
this.pictureBoxIcon = new System.Windows.Forms.PictureBox();
this.panelTitleBar.SuspendLayout();
this.panelButtons.SuspendLayout();
this.panelBody.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxIcon)).BeginInit();
this.SuspendLayout();
//
// panelTitleBar
//
this.panelTitleBar.BackColor = System.Drawing.Color.CornflowerBlue;
this.panelTitleBar.Controls.Add(this.labelCaption);
this.panelTitleBar.Controls.Add(this.btnClose);
this.panelTitleBar.Dock = System.Windows.Forms.DockStyle.Top;
this.panelTitleBar.Location = new System.Drawing.Point(2, 2);
this.panelTitleBar.Name = "panelTitleBar";
this.panelTitleBar.Size = new System.Drawing.Size(346, 35);
this.panelTitleBar.TabIndex = 0;
this.panelTitleBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelTitleBar_MouseDown);
//
// labelCaption
//
this.labelCaption.AutoSize = true;
this.labelCaption.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelCaption.ForeColor = System.Drawing.Color.White;
this.labelCaption.Location = new System.Drawing.Point(9, 8);
this.labelCaption.Name = "labelCaption";
this.labelCaption.Size = new System.Drawing.Size(86, 17);
this.labelCaption.TabIndex = 4;
this.labelCaption.Text = "labelCaption";
//
// btnClose
//
this.btnClose.Dock = System.Windows.Forms.DockStyle.Right;
this.btnClose.FlatAppearance.BorderSize = 0;
this.btnClose.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(79)))), ((int)(((byte)(95)))));
this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClose.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnClose.ForeColor = System.Drawing.Color.White;
this.btnClose.Location = new System.Drawing.Point(306, 0);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(40, 35);
this.btnClose.TabIndex = 3;
this.btnClose.Text = "X";
this.btnClose.UseVisualStyleBackColor = false;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// panelButtons
//
this.panelButtons.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.panelButtons.Controls.Add(this.button3);
this.panelButtons.Controls.Add(this.button2);
this.panelButtons.Controls.Add(this.button1);
this.panelButtons.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panelButtons.Location = new System.Drawing.Point(2, 93);
this.panelButtons.Name = "panelButtons";
this.panelButtons.Size = new System.Drawing.Size(346, 60);
this.panelButtons.TabIndex = 1;
//
// button3
//
this.button3.BackColor = System.Drawing.Color.SeaGreen;
this.button3.FlatAppearance.BorderSize = 0;
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button3.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button3.ForeColor = System.Drawing.Color.WhiteSmoke;
this.button3.Location = new System.Drawing.Point(231, 12);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(100, 35);
this.button3.TabIndex = 2;
this.button3.Text = "button3";
this.button3.UseVisualStyleBackColor = false;
//
// button2
//
this.button2.BackColor = System.Drawing.Color.SeaGreen;
this.button2.FlatAppearance.BorderSize = 0;
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button2.ForeColor = System.Drawing.Color.WhiteSmoke;
this.button2.Location = new System.Drawing.Point(125, 12);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(100, 35);
this.button2.TabIndex = 1;
this.button2.Text = "button2";
this.button2.UseVisualStyleBackColor = false;
//
// button1
//
this.button1.BackColor = System.Drawing.Color.SeaGreen;
this.button1.FlatAppearance.BorderSize = 0;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.ForeColor = System.Drawing.Color.WhiteSmoke;
this.button1.Location = new System.Drawing.Point(19, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 35);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = false;
//
// panelBody
//
this.panelBody.BackColor = System.Drawing.Color.WhiteSmoke;
this.panelBody.Controls.Add(this.labelMessage);
this.panelBody.Controls.Add(this.pictureBoxIcon);
this.panelBody.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelBody.Location = new System.Drawing.Point(2, 37);
this.panelBody.Name = "panelBody";
this.panelBody.Padding = new System.Windows.Forms.Padding(10, 10, 0, 0);
this.panelBody.Size = new System.Drawing.Size(346, 56);
this.panelBody.TabIndex = 2;
//
// labelMessage
//
this.labelMessage.AutoSize = true;
this.labelMessage.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelMessage.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelMessage.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(85)))), ((int)(((byte)(85)))));
this.labelMessage.Location = new System.Drawing.Point(50, 10);
this.labelMessage.MaximumSize = new System.Drawing.Size(600, 0);
this.labelMessage.Name = "labelMessage";
this.labelMessage.Padding = new System.Windows.Forms.Padding(5, 5, 10, 15);
this.labelMessage.Size = new System.Drawing.Size(154, 44);
this.labelMessage.TabIndex = 1;
this.labelMessage.Text = "labelMessage";
this.labelMessage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pictureBoxIcon
//
this.pictureBoxIcon.Dock = System.Windows.Forms.DockStyle.Left;
this.pictureBoxIcon.Image = global::ScaBox30.Properties.Resources.chat;
this.pictureBoxIcon.Location = new System.Drawing.Point(10, 10);
this.pictureBoxIcon.Name = "pictureBoxIcon";
this.pictureBoxIcon.Size = new System.Drawing.Size(40, 46);
this.pictureBoxIcon.TabIndex = 0;
this.pictureBoxIcon.TabStop = false;
//
// FormMessageBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.CornflowerBlue;
this.ClientSize = new System.Drawing.Size(350, 155);
this.Controls.Add(this.panelBody);
this.Controls.Add(this.panelButtons);
this.Controls.Add(this.panelTitleBar);
this.MinimumSize = new System.Drawing.Size(350, 150);
this.Name = "FormMessageBox";
this.Padding = new System.Windows.Forms.Padding(2);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Form1";
this.panelTitleBar.ResumeLayout(false);
this.panelTitleBar.PerformLayout();
this.panelButtons.ResumeLayout(false);
this.panelBody.ResumeLayout(false);
this.panelBody.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxIcon)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panelTitleBar;
private System.Windows.Forms.Panel panelButtons;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Panel panelBody;
private System.Windows.Forms.Label labelMessage;
private System.Windows.Forms.PictureBox pictureBoxIcon;
private System.Windows.Forms.Label labelCaption;
}
}

300
ScanBox/FormMessageBox.cs Normal file
View File

@@ -0,0 +1,300 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ScaBox30.Private
{
public partial class FormMessageBox : Form
{
//Fields
//private Color primaryColor = Color.CornflowerBlue;
private Color primaryColor = Globals.primaryColor;
//private int borderSize = 2;
//Properties
public Color PrimaryColor
{
get { return primaryColor; }
set
{
primaryColor = value;
this.BackColor = primaryColor;//Form Border Color
this.panelTitleBar.BackColor = PrimaryColor;//Title Bar Back Color
}
}
//Constructors
public FormMessageBox(string text)
{
InitializeComponent();
InitializeItems();
this.PrimaryColor = primaryColor;
this.labelMessage.Text = text;
this.labelCaption.Text = "";
SetFormSize();
SetButtons(MessageBoxButtons.OK, MessageBoxDefaultButton.Button1);//Set Default Buttons
}
public FormMessageBox(string text, string caption)
{
InitializeComponent();
InitializeItems();
this.PrimaryColor = primaryColor;
this.labelMessage.Text = text;
this.labelCaption.Text = caption;
SetFormSize();
SetButtons(MessageBoxButtons.OK, MessageBoxDefaultButton.Button1);//Set Default Buttons
}
public FormMessageBox(string text, string caption, MessageBoxButtons buttons)
{
InitializeComponent();
InitializeItems();
this.PrimaryColor = primaryColor;
this.labelMessage.Text = text;
this.labelCaption.Text = caption;
SetFormSize();
SetButtons(buttons, MessageBoxDefaultButton.Button1);//Set [Default Button 1]
}
public FormMessageBox(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
{
InitializeComponent();
InitializeItems();
this.PrimaryColor = primaryColor;
this.labelMessage.Text = text;
this.labelCaption.Text = caption;
SetFormSize();
SetButtons(buttons, MessageBoxDefaultButton.Button1);//Set [Default Button 1]
SetIcon(icon);
}
public FormMessageBox(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
{
InitializeComponent();
InitializeItems();
this.PrimaryColor = primaryColor;
this.labelMessage.Text = text;
this.labelCaption.Text = caption;
SetFormSize();
SetButtons(buttons, defaultButton);
SetIcon(icon);
}
//-> Private Methods
private void InitializeItems()
{
this.FormBorderStyle = FormBorderStyle.None;
this.Padding = new Padding(Globals.borderSize);//Set border size
this.panelTitleBar.Padding = new Padding(0, 0, 0, Globals.borderSize);
this.labelMessage.MaximumSize = new Size(550, 0);
this.btnClose.DialogResult = DialogResult.Cancel;
this.button1.DialogResult = DialogResult.OK;
this.button1.Visible = false;
this.button2.Visible = false;
this.button3.Visible = false;
}
private void SetFormSize()
{
int widht = this.labelMessage.Width + this.pictureBoxIcon.Width + this.panelBody.Padding.Left;
int height = this.panelTitleBar.Height + this.labelMessage.Height + this.panelButtons.Height + this.panelBody.Padding.Top;
this.Size = new Size(widht, height);
}
private void SetButtons(MessageBoxButtons buttons, MessageBoxDefaultButton defaultButton)
{
int xCenter = (this.panelButtons.Width - button1.Width) / 2;
int yCenter = (this.panelButtons.Height - button1.Height) / 2;
switch (buttons)
{
case MessageBoxButtons.OK:
//OK Button
button1.Visible = true;
button1.Location = new Point(xCenter, yCenter);
button1.Text = "Ok";
button1.DialogResult = DialogResult.OK;//Set DialogResult
//Set Default Button
SetDefaultButton(defaultButton);
break;
case MessageBoxButtons.OKCancel:
//OK Button
button1.Visible = true;
button1.Location = new Point(xCenter - (button1.Width / 2) - 5, yCenter);
button1.Text = "Ok";
button1.DialogResult = DialogResult.OK;//Set DialogResult
//Cancel Button
button2.Visible = true;
button2.Location = new Point(xCenter + (button2.Width / 2) + 5, yCenter);
button2.Text = "Cancel";
button2.DialogResult = DialogResult.Cancel;//Set DialogResult
button2.BackColor = Color.DimGray;
//Set Default Button
if (defaultButton != MessageBoxDefaultButton.Button3)//There are only 2 buttons, so the Default Button cannot be Button3
SetDefaultButton(defaultButton);
else SetDefaultButton(MessageBoxDefaultButton.Button1);
break;
case MessageBoxButtons.RetryCancel:
//Retry Button
button1.Visible = true;
button1.Location = new Point(xCenter - (button1.Width / 2) - 5, yCenter);
button1.Text = "Retry";
button1.DialogResult = DialogResult.Retry;//Set DialogResult
//Cancel Button
button2.Visible = true;
button2.Location = new Point(xCenter + (button2.Width / 2) + 5, yCenter);
button2.Text = "Cancel";
button2.DialogResult = DialogResult.Cancel;//Set DialogResult
button2.BackColor = Color.DimGray;
//Set Default Button
if (defaultButton != MessageBoxDefaultButton.Button3)//There are only 2 buttons, so the Default Button cannot be Button3
SetDefaultButton(defaultButton);
else SetDefaultButton(MessageBoxDefaultButton.Button1);
break;
case MessageBoxButtons.YesNo:
//Yes Button
button1.Visible = true;
button1.Location = new Point(xCenter - (button1.Width / 2) - 5, yCenter);
button1.Text = "Yes";
button1.DialogResult = DialogResult.Yes;//Set DialogResult
//No Button
button2.Visible = true;
button2.Location = new Point(xCenter + (button2.Width / 2) + 5, yCenter);
button2.Text = "No";
button2.DialogResult = DialogResult.No;//Set DialogResult
button2.BackColor = Color.IndianRed;
//Set Default Button
if (defaultButton != MessageBoxDefaultButton.Button3)//There are only 2 buttons, so the Default Button cannot be Button3
SetDefaultButton(defaultButton);
else SetDefaultButton(MessageBoxDefaultButton.Button1);
break;
case MessageBoxButtons.YesNoCancel:
//Yes Button
button1.Visible = true;
button1.Location = new Point(xCenter - button1.Width - 5, yCenter);
button1.Text = "Yes";
button1.DialogResult = DialogResult.Yes;//Set DialogResult
//No Button
button2.Visible = true;
button2.Location = new Point(xCenter, yCenter);
button2.Text = "No";
button2.DialogResult = DialogResult.No;//Set DialogResult
button2.BackColor = Color.IndianRed;
//Cancel Button
button3.Visible = true;
button3.Location = new Point(xCenter + button2.Width + 5, yCenter);
button3.Text = "Cancel";
button3.DialogResult = DialogResult.Cancel;//Set DialogResult
button3.BackColor = Color.DimGray;
//Set Default Button
SetDefaultButton(defaultButton);
break;
case MessageBoxButtons.AbortRetryIgnore:
//Abort Button
button1.Visible = true;
button1.Location = new Point(xCenter - button1.Width - 5, yCenter);
button1.Text = "Abort";
button1.DialogResult = DialogResult.Abort;//Set DialogResult
button1.BackColor = Color.Goldenrod;
//Retry Button
button2.Visible = true;
button2.Location = new Point(xCenter, yCenter);
button2.Text = "Retry";
button2.DialogResult = DialogResult.Retry;//Set DialogResult
//Ignore Button
button3.Visible = true;
button3.Location = new Point(xCenter + button2.Width + 5, yCenter);
button3.Text = "Ignore";
button3.DialogResult = DialogResult.Ignore;//Set DialogResult
button3.BackColor = Color.IndianRed;
//Set Default Button
SetDefaultButton(defaultButton);
break;
}
}
private void SetDefaultButton(MessageBoxDefaultButton defaultButton)
{
switch (defaultButton)
{
case MessageBoxDefaultButton.Button1://Focus button 1
button1.Select();
button1.ForeColor = Color.White;
button1.Font = new Font(button1.Font, FontStyle.Underline);
break;
case MessageBoxDefaultButton.Button2://Focus button 2
button2.Select();
button2.ForeColor = Color.White;
button2.Font = new Font(button2.Font, FontStyle.Underline);
break;
case MessageBoxDefaultButton.Button3://Focus button 3
button3.Select();
button3.ForeColor = Color.White;
button3.Font = new Font(button3.Font, FontStyle.Underline);
break;
}
}
private void SetIcon(MessageBoxIcon icon)
{
switch (icon)
{
case MessageBoxIcon.Error: //Error
this.pictureBoxIcon.Image = Properties.Resources.error;
//PrimaryColor = Color.FromArgb(224, 79, 95);
this.btnClose.FlatAppearance.MouseOverBackColor = Color.Crimson;
break;
case MessageBoxIcon.Information: //Information
this.pictureBoxIcon.Image = Properties.Resources.information;
//PrimaryColor = Color.FromArgb(38, 191, 166);
break;
case MessageBoxIcon.Question://Question
this.pictureBoxIcon.Image = Properties.Resources.question;
//PrimaryColor = Color.FromArgb(10, 119, 232);
break;
case MessageBoxIcon.Exclamation://Exclamation
this.pictureBoxIcon.Image = Properties.Resources.exclamation;
//PrimaryColor = Color.FromArgb(255, 140, 0);
break;
case MessageBoxIcon.None: //None
this.pictureBoxIcon.Image = Properties.Resources.chat;
//PrimaryColor = Color.CornflowerBlue;
break;
}
}
//-> Events Methods
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
#region -> Drag Form
[DllImport("user32.DLL", EntryPoint = "SendMessage")]
private extern static void SendMessage(System.IntPtr hWnd, int wMsg, int wParam, int lParam);
[DllImport("user32.DLL", EntryPoint = "ReleaseCapture")]
private extern static void ReleaseCapture();
private void panelTitleBar_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, 0x112, 0xf012, 0);
}
#endregion
}
}

120
ScanBox/FormMessageBox.resx Normal file
View File

@@ -0,0 +1,120 @@
<?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>

145
ScanBox/Globals.cs Normal file
View File

@@ -0,0 +1,145 @@
using ScaBox30.Model;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ScaBox30
{
class Globals
{
public static List<Programas> scaner_config = new List<Programas>();
public static string auth_json = Application.StartupPath + "\\auth.json";
public static string config_json = Application.StartupPath + "\\config.json";
public static List<Data> actual_data = new List<Data>();
public static Data found_element = new Data();
public static List<User> users = new List<User>();
public static List<Config> config = new List<Config>();
public static Boolean valid_user = false;
public static Boolean debug = false;
public static Boolean boxcapacity = false;
public static Config cfg = new Config();
//Fields
public struct colors
{
//ICONOS
public static Color primary = Color.CornflowerBlue; // AZUL
public static Color question = Color.FromArgb(10, 119, 232); // AZUL
public static Color warning = Color.DarkOrange; // NARANJA OSCURO
public static Color error = Color.FromArgb(224, 79, 95); // ROJO CLARO
public static Color information = Color.FromArgb(38, 191, 166); // AZUL VERDE
//BOTONES
public static Color ok = Color.SeaGreen; // VERDE
public static Color ok_cancell = Color.DarkSeaGreen; // VERDE CLARO
public static Color abort_retry_ignore = Color.MediumVioletRed; // VIOLETA-ROJO
public static Color yes_no = Color.MediumOrchid; // MORADO CLARO
public static Color yes_no_cancell = Color.BlueViolet; // MORADO AZULADO
public static Color retry_cancell = Color.DimGray; // GRIS CLARO
}
public static Color primaryColor = colors.retry_cancell;
public static int borderSize = 2;
// VARIABLES UNICAMENTE PARA PRUEBAS
// private static string codigo = "0123456789"; // 30
// private static string codigo = "0200212355"; // 45
// private static string codigo = "0199170978"; // 30
// private static string codigo = "0406130195"; // 30
// private static string codigo = "0037766904"; // 45
// private static string codigo = "0197320989"; // 0
// private static string codigo = "0199682105"; // 15
private static string codigo = "0037613825"; // 30
//Resultado real
//0037614674:001:26/583,0037614674:002:182/471,0037614674:003:281/474,0037614674:004:383/466,0037614674:005:487/463,0037614674:006:593/464,0037614674:007:695/461,0037614674:008:806/464,0037614674:009:913/476,0037614674:010:1021/479,0037614674:011:1136/487,0037614674:012:1231/486,0037614674:013:1337/484,0037614674:014:1441/489,0037614674:015:1545/482,0037614674:016:1653/488,0037614674:017:109/739,0037614674:018:440/731,0037614674:019:794/742,0037614674:020:1152/750,0037614674:021:1499/755,0037614674:022:51/1050,0037614674:023:201/948,0037614674:024:297/952,0037614674:025:402/954,0037614674:026:503/950,0037614674:027:605/957,0037614674:028:711/949,0037614674:029:817/955,0037614674:030:922/957,0037614674:031:1023/955,0037614674:032:1129/952,0037614674:033:1236/956,0037614674:034:1337/957,0037614674:035:1442/955,0037614674:036:1542/958,0037614674:037:1645/962,0037614674:038:1787/372,0037614674:039:1796/479,0037614674:040:1806/591,0037614674:041:1847/689,0037614674:042:1849/791,0037614674:043:1798/905,0037614674:044:1786/1018,0037614674:045:1784/1129
/*public static string testdata = codigo + ":001:1138/525," +
codigo + ":002:1138/525," +
codigo + ":003:1138/525," +
codigo + ":004:1138/525," +
codigo + ":005:1138/525," +
codigo + ":006:1138/525," +
codigo + ":007:1138/525," +
codigo + ":008:1138/525," +
codigo + ":009:1138/525," +
codigo + ":010:1138/525," +
codigo + ":011:1138/525," +
codigo + ":012:1138/525," +
codigo + ":013:1138/525," +
codigo + ":014:1138/525," +
codigo + ":015:1138/525," +
codigo + ":016:1138/525," +
codigo + ":017:1138/525," +
codigo + ":018:1138/525," +
codigo + ":019:1138/525," +
codigo + ":020:1138/525," +
codigo + ":021:1138/525," +
codigo + ":022:1138/525," +
codigo + ":023:1138/525," +
codigo + ":024:1138/525," +
codigo + ":025:1138/525," +
codigo + ":026:1138/525," +
codigo + ":027:1138/525," +
codigo + ":028:1138/525," +
codigo + ":029:1138/525," +
codigo + ":030:1138/525," +
codigo + ":031:1138/525," +
codigo + ":032:1138/525," +
codigo + ":033:1138/525," +
codigo + ":034:1138/525," +
//"ERROR," + // ERROR DE LECTURA
//codigo.Replace("02","03") + ":035:1138/525," + // ERROR POSICION 035
codigo + ":035:1138/525," + // OK POSICION 035
codigo + ":036:1138/525," +
codigo + ":037:1138/525," +
codigo + ":038:1138/525," +
codigo + ":039:1138/525," +
codigo + ":040:1138/525," +
codigo + ":041:1138/525," +
codigo + ":042:1138/525," +
codigo + ":043:1138/525," +
//codigo + ":044:1138/525," +
codigo + ":045:1138/525";*/
public static string testdata = codigo + ":001," +
codigo + ":002," +
codigo + ":003," +
codigo + ":004," +
codigo + ":005," +
codigo + ":006," +
codigo + ":007," +
codigo + ":008," +
codigo + ":009," +
codigo + ":010," +
codigo + ":011," +
codigo + ":012," +
codigo + ":013," +
codigo + ":014," +
codigo + ":015," +
codigo + ":016," +
codigo + ":017," +
codigo + ":018," +
codigo + ":019," +
codigo + ":020," +
codigo + ":021," +
codigo + ":022," +
codigo + ":023," +
codigo + ":024," +
codigo + ":025," +
codigo + ":026," +
codigo + ":027," +
codigo + ":028," +
codigo + ":029," +
codigo + ":030";
//"0199170978" + ":030";
//"ERROR";
}
}

21
ScanBox/Model/Config.cs Normal file
View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ScaBox30.Model
{
class Config
{
public string iphost { get; set; }
public int cleardelay { get; set; }
public int interval { get; set; }
public string ipscanner { get; set; }
public string usbprinter { get; set; }
public string ipprinter { get; set; }
public string printertype { get; set; }
public string resultado { get; set; }
public Boolean printerenabled { get; set; }
}
}

56
ScanBox/Model/Data.cs Normal file
View File

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ScaBox30.Model
{
class Data
{
public string CCE { get; set; }
public string VERSION { get; set; }
public string ETAT { get; set; }
public string MARQUE { get; set; }
public string TEINTE { get; set; }
public string PS1 { get; set; }
public string PS2 { get; set; }
public string DIAM { get; set; }
public string SPHM { get; set; }
public string CYLM { get; set; }
public string Ref_Etiquette { get; set; }
public string code_epc { get; set; }
public string oeil { get; set; }
public string @base { get; set; }
public string addition { get; set; }
public string epc { get; set; }
public string indice { get; set; }
public string dec { get; set; }
public string diam1 { get; set; }
public string diam2 { get; set; }
public string ref_coque { get; set; }
public string ref_cond { get; set; }
public string nom_1 { get; set; }
public string nom_2 { get; set; }
public string matiere_fr { get; set; }
public string matiere_us { get; set; }
public string couleur_fr { get; set; }
public string couleur_us { get; set; }
public string vernis { get; set; }
public string traitement_1 { get; set; }
public string traitement_2 { get; set; }
public string traitement_3 { get; set; }
public string signom { get; set; }
public string sig1 { get; set; }
public string sig2 { get; set; }
public string code_upc { get; set; }
public string code_jan1 { get; set; }
public string code_jan2 { get; set; }
public string Reserve1 { get; set; }
public string Reserve2 { get; set; }
public string reserve_art_1 { get; set; }
public string reserve_art_2 { get; set; }
public string Ref_NiceLabel { get; set; }
public string Box_Capacity { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ScaBox30.Model
{
class Programas
{
public string Box_Capacity { get; set; }
public string Program { get; set; }
}
}

14
ScanBox/Model/User.cs Normal file
View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ScaBox30.Model
{
class User
{
public string user { get; set; }
public string password { get; set; }
}
}

612
ScanBox/Principal.Designer.cs generated Normal file
View File

@@ -0,0 +1,612 @@
namespace ScaBox30
{
partial class Principal
{
/// <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.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Principal));
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.panelTitleBar = new System.Windows.Forms.Panel();
this.label9 = new System.Windows.Forms.Label();
this.btnMin = new System.Windows.Forms.Button();
this.btnMax = new System.Windows.Forms.Button();
this.labelCaption = new System.Windows.Forms.Label();
this.btnClose = new System.Windows.Forms.Button();
this.panelBody = new System.Windows.Forms.Panel();
this.labelRate = new System.Windows.Forms.Label();
this.barcode_lbl = new System.Windows.Forms.Label();
this.btnPrinter = new System.Windows.Forms.Button();
this.labelCapacity = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.btnBD = new System.Windows.Forms.Button();
this.btnToogleMode = new System.Windows.Forms.Button();
this.utr_count_lbl = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.op_ID_lbl = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.bad_count_lbl = new System.Windows.Forms.Label();
this.bad_lbl = new System.Windows.Forms.Label();
this.ok_count_lbl = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.DataText = new System.Windows.Forms.TextBox();
this.TgrBtn = new System.Windows.Forms.Button();
this.liveviewForm1 = new Keyence.AutoID.SDK.LiveviewForm();
this.panelButtons = new System.Windows.Forms.Panel();
this.host_ip_lbl = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.sr2000w_ip_lbl = new System.Windows.Forms.Label();
this.version = new System.Windows.Forms.Label();
this.reader_connector = new System.Windows.Forms.Timer(this.components);
this.btnConfiguración = new System.Windows.Forms.Button();
this.blackimg_picbx = new System.Windows.Forms.PictureBox();
this.panelTitleBar.SuspendLayout();
this.panelBody.SuspendLayout();
this.panelButtons.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.blackimg_picbx)).BeginInit();
this.SuspendLayout();
//
// timer1
//
this.timer1.Interval = 5000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// panelTitleBar
//
this.panelTitleBar.BackColor = System.Drawing.Color.CornflowerBlue;
this.panelTitleBar.Controls.Add(this.label9);
this.panelTitleBar.Controls.Add(this.btnMin);
this.panelTitleBar.Controls.Add(this.btnMax);
this.panelTitleBar.Controls.Add(this.labelCaption);
this.panelTitleBar.Controls.Add(this.btnClose);
this.panelTitleBar.Dock = System.Windows.Forms.DockStyle.Top;
this.panelTitleBar.Location = new System.Drawing.Point(0, 0);
this.panelTitleBar.Name = "panelTitleBar";
this.panelTitleBar.Size = new System.Drawing.Size(1050, 35);
this.panelTitleBar.TabIndex = 89;
this.panelTitleBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelTitleBar_MouseDown);
//
// label9
//
this.label9.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label9.ForeColor = System.Drawing.Color.White;
this.label9.Location = new System.Drawing.Point(427, 9);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(202, 17);
this.label9.TabIndex = 7;
this.label9.Text = "Abenco Advantage Tecnología";
//
// btnMin
//
this.btnMin.Dock = System.Windows.Forms.DockStyle.Right;
this.btnMin.FlatAppearance.BorderSize = 0;
this.btnMin.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Silver;
this.btnMin.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnMin.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnMin.ForeColor = System.Drawing.Color.White;
this.btnMin.Location = new System.Drawing.Point(930, 0);
this.btnMin.Name = "btnMin";
this.btnMin.Size = new System.Drawing.Size(40, 35);
this.btnMin.TabIndex = 6;
this.btnMin.Text = "-";
this.btnMin.UseVisualStyleBackColor = false;
this.btnMin.Click += new System.EventHandler(this.btnMin_Click);
//
// btnMax
//
this.btnMax.Cursor = System.Windows.Forms.Cursors.Default;
this.btnMax.Dock = System.Windows.Forms.DockStyle.Right;
this.btnMax.FlatAppearance.BorderSize = 0;
this.btnMax.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Silver;
this.btnMax.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnMax.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnMax.ForeColor = System.Drawing.Color.White;
this.btnMax.Location = new System.Drawing.Point(970, 0);
this.btnMax.Name = "btnMax";
this.btnMax.Size = new System.Drawing.Size(40, 35);
this.btnMax.TabIndex = 5;
this.btnMax.Text = "[ ]";
this.btnMax.UseVisualStyleBackColor = false;
this.btnMax.Click += new System.EventHandler(this.btnMax_Click);
//
// labelCaption
//
this.labelCaption.AutoSize = true;
this.labelCaption.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelCaption.ForeColor = System.Drawing.Color.White;
this.labelCaption.Location = new System.Drawing.Point(9, 8);
this.labelCaption.Name = "labelCaption";
this.labelCaption.Size = new System.Drawing.Size(86, 17);
this.labelCaption.TabIndex = 4;
this.labelCaption.Text = "labelCaption";
//
// btnClose
//
this.btnClose.Dock = System.Windows.Forms.DockStyle.Right;
this.btnClose.FlatAppearance.BorderSize = 0;
this.btnClose.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(79)))), ((int)(((byte)(95)))));
this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClose.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnClose.ForeColor = System.Drawing.Color.White;
this.btnClose.Location = new System.Drawing.Point(1010, 0);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(40, 35);
this.btnClose.TabIndex = 3;
this.btnClose.Text = "X";
this.btnClose.UseVisualStyleBackColor = false;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// panelBody
//
this.panelBody.BackColor = System.Drawing.Color.WhiteSmoke;
this.panelBody.Controls.Add(this.labelRate);
this.panelBody.Controls.Add(this.btnConfiguración);
this.panelBody.Controls.Add(this.barcode_lbl);
this.panelBody.Controls.Add(this.btnPrinter);
this.panelBody.Controls.Add(this.labelCapacity);
this.panelBody.Controls.Add(this.label8);
this.panelBody.Controls.Add(this.btnBD);
this.panelBody.Controls.Add(this.blackimg_picbx);
this.panelBody.Controls.Add(this.btnToogleMode);
this.panelBody.Controls.Add(this.utr_count_lbl);
this.panelBody.Controls.Add(this.label6);
this.panelBody.Controls.Add(this.label5);
this.panelBody.Controls.Add(this.op_ID_lbl);
this.panelBody.Controls.Add(this.label4);
this.panelBody.Controls.Add(this.bad_count_lbl);
this.panelBody.Controls.Add(this.bad_lbl);
this.panelBody.Controls.Add(this.ok_count_lbl);
this.panelBody.Controls.Add(this.label2);
this.panelBody.Controls.Add(this.DataText);
this.panelBody.Controls.Add(this.TgrBtn);
this.panelBody.Controls.Add(this.liveviewForm1);
this.panelBody.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelBody.Location = new System.Drawing.Point(0, 35);
this.panelBody.Name = "panelBody";
this.panelBody.Padding = new System.Windows.Forms.Padding(10, 10, 0, 0);
this.panelBody.Size = new System.Drawing.Size(1050, 673);
this.panelBody.TabIndex = 91;
//
// labelRate
//
this.labelRate.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.labelRate.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelRate.Location = new System.Drawing.Point(883, 6);
this.labelRate.Name = "labelRate";
this.labelRate.Size = new System.Drawing.Size(96, 13);
this.labelRate.TabIndex = 113;
this.labelRate.Text = "0 Seg.";
this.labelRate.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// barcode_lbl
//
this.barcode_lbl.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.barcode_lbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.barcode_lbl.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.barcode_lbl.Location = new System.Drawing.Point(508, 420);
this.barcode_lbl.MaximumSize = new System.Drawing.Size(257, 39);
this.barcode_lbl.Name = "barcode_lbl";
this.barcode_lbl.Size = new System.Drawing.Size(215, 39);
this.barcode_lbl.TabIndex = 97;
this.barcode_lbl.Text = "----------";
this.barcode_lbl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// btnPrinter
//
this.btnPrinter.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnPrinter.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(69)))), ((int)(((byte)(74)))));
this.btnPrinter.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F);
this.btnPrinter.ForeColor = System.Drawing.Color.White;
this.btnPrinter.Location = new System.Drawing.Point(69, 466);
this.btnPrinter.Name = "btnPrinter";
this.btnPrinter.Size = new System.Drawing.Size(219, 117);
this.btnPrinter.TabIndex = 111;
this.btnPrinter.Text = "Impresora Desctivada";
this.btnPrinter.UseVisualStyleBackColor = false;
this.btnPrinter.Click += new System.EventHandler(this.button1_Click);
//
// labelCapacity
//
this.labelCapacity.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.labelCapacity.AutoEllipsis = true;
this.labelCapacity.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelCapacity.ForeColor = System.Drawing.Color.Black;
this.labelCapacity.Location = new System.Drawing.Point(916, 420);
this.labelCapacity.MaximumSize = new System.Drawing.Size(84, 42);
this.labelCapacity.Name = "labelCapacity";
this.labelCapacity.Size = new System.Drawing.Size(84, 42);
this.labelCapacity.TabIndex = 110;
this.labelCapacity.Text = "--";
//
// label8
//
this.label8.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label8.ForeColor = System.Drawing.Color.Black;
this.label8.Location = new System.Drawing.Point(736, 422);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(180, 37);
this.label8.TabIndex = 109;
this.label8.Text = "Capacidad";
//
// btnBD
//
this.btnBD.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnBD.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(10)))), ((int)(((byte)(119)))), ((int)(((byte)(232)))));
this.btnBD.CausesValidation = false;
this.btnBD.ForeColor = System.Drawing.Color.White;
this.btnBD.Location = new System.Drawing.Point(1001, 609);
this.btnBD.Name = "btnBD";
this.btnBD.Size = new System.Drawing.Size(44, 58);
this.btnBD.TabIndex = 107;
this.btnBD.Text = "DB";
this.btnBD.UseVisualStyleBackColor = false;
this.btnBD.MouseClick += new System.Windows.Forms.MouseEventHandler(this.btnBD_MouseClick);
//
// btnToogleMode
//
this.btnToogleMode.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnToogleMode.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(69)))), ((int)(((byte)(74)))));
this.btnToogleMode.Cursor = System.Windows.Forms.Cursors.Default;
this.btnToogleMode.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnToogleMode.ForeColor = System.Drawing.Color.White;
this.btnToogleMode.Location = new System.Drawing.Point(289, 466);
this.btnToogleMode.Name = "btnToogleMode";
this.btnToogleMode.Size = new System.Drawing.Size(171, 117);
this.btnToogleMode.TabIndex = 103;
this.btnToogleMode.Text = "Scanbox";
this.btnToogleMode.UseVisualStyleBackColor = false;
this.btnToogleMode.Click += new System.EventHandler(this.btnToogleMode_Click);
//
// utr_count_lbl
//
this.utr_count_lbl.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.utr_count_lbl.AutoEllipsis = true;
this.utr_count_lbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.utr_count_lbl.ForeColor = System.Drawing.Color.Orange;
this.utr_count_lbl.Location = new System.Drawing.Point(916, 546);
this.utr_count_lbl.MaximumSize = new System.Drawing.Size(84, 42);
this.utr_count_lbl.Name = "utr_count_lbl";
this.utr_count_lbl.Size = new System.Drawing.Size(84, 42);
this.utr_count_lbl.TabIndex = 102;
this.utr_count_lbl.Text = "--";
//
// label6
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label6.ForeColor = System.Drawing.Color.Orange;
this.label6.Location = new System.Drawing.Point(736, 549);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(53, 37);
this.label6.TabIndex = 101;
this.label6.Text = "¿?";
//
// label5
//
this.label5.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.label5.Location = new System.Drawing.Point(422, 421);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(99, 37);
this.label5.TabIndex = 100;
this.label5.Text = "OPC:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// op_ID_lbl
//
this.op_ID_lbl.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.op_ID_lbl.AutoEllipsis = true;
this.op_ID_lbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.op_ID_lbl.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.op_ID_lbl.Location = new System.Drawing.Point(264, 420);
this.op_ID_lbl.MaximumSize = new System.Drawing.Size(141, 39);
this.op_ID_lbl.Name = "op_ID_lbl";
this.op_ID_lbl.Size = new System.Drawing.Size(141, 39);
this.op_ID_lbl.TabIndex = 99;
this.op_ID_lbl.Text = "------";
this.op_ID_lbl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label4
//
this.label4.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.label4.Location = new System.Drawing.Point(62, 421);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(214, 37);
this.label4.TabIndex = 98;
this.label4.Text = "Operador ID:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// bad_count_lbl
//
this.bad_count_lbl.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.bad_count_lbl.AutoEllipsis = true;
this.bad_count_lbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.bad_count_lbl.ForeColor = System.Drawing.Color.Red;
this.bad_count_lbl.Location = new System.Drawing.Point(916, 507);
this.bad_count_lbl.MaximumSize = new System.Drawing.Size(84, 42);
this.bad_count_lbl.Name = "bad_count_lbl";
this.bad_count_lbl.Size = new System.Drawing.Size(84, 42);
this.bad_count_lbl.TabIndex = 96;
this.bad_count_lbl.Text = "--";
//
// bad_lbl
//
this.bad_lbl.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.bad_lbl.AutoSize = true;
this.bad_lbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.bad_lbl.ForeColor = System.Drawing.Color.Red;
this.bad_lbl.Location = new System.Drawing.Point(736, 507);
this.bad_lbl.Name = "bad_lbl";
this.bad_lbl.Size = new System.Drawing.Size(90, 37);
this.bad_lbl.TabIndex = 95;
this.bad_lbl.Text = "NOK";
//
// ok_count_lbl
//
this.ok_count_lbl.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.ok_count_lbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ok_count_lbl.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
this.ok_count_lbl.Location = new System.Drawing.Point(916, 465);
this.ok_count_lbl.MaximumSize = new System.Drawing.Size(84, 42);
this.ok_count_lbl.Name = "ok_count_lbl";
this.ok_count_lbl.Size = new System.Drawing.Size(84, 42);
this.ok_count_lbl.TabIndex = 94;
this.ok_count_lbl.Text = "--";
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
this.label2.Location = new System.Drawing.Point(736, 465);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 37);
this.label2.TabIndex = 93;
this.label2.Text = "OK";
//
// DataText
//
this.DataText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.DataText.BackColor = System.Drawing.SystemColors.Control;
this.DataText.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.DataText.ForeColor = System.Drawing.Color.White;
this.DataText.Location = new System.Drawing.Point(12, 609);
this.DataText.MaxLength = 10;
this.DataText.Multiline = true;
this.DataText.Name = "DataText";
this.DataText.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.DataText.Size = new System.Drawing.Size(983, 58);
this.DataText.TabIndex = 91;
//
// TgrBtn
//
this.TgrBtn.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.TgrBtn.BackColor = System.Drawing.SystemColors.ButtonFace;
this.TgrBtn.Cursor = System.Windows.Forms.Cursors.Default;
this.TgrBtn.Enabled = false;
this.TgrBtn.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.TgrBtn.ForeColor = System.Drawing.Color.White;
this.TgrBtn.Location = new System.Drawing.Point(462, 466);
this.TgrBtn.Name = "TgrBtn";
this.TgrBtn.Size = new System.Drawing.Size(245, 117);
this.TgrBtn.TabIndex = 90;
this.TgrBtn.Text = "Ejecutar\r\nLectura";
this.TgrBtn.UseVisualStyleBackColor = false;
this.TgrBtn.Click += new System.EventHandler(this.TgrBtn_Click);
//
// liveviewForm1
//
this.liveviewForm1.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.liveviewForm1.BackColor = System.Drawing.Color.Black;
this.liveviewForm1.BinningType = Keyence.AutoID.SDK.LiveviewForm.ImageBinningType.OneQuarter;
this.liveviewForm1.ImageFormat = Keyence.AutoID.SDK.LiveviewForm.ImageFormatType.Jpeg;
this.liveviewForm1.ImageQuality = 5;
this.liveviewForm1.IpAddress = "192.168.100.100";
this.liveviewForm1.Location = new System.Drawing.Point(69, 24);
this.liveviewForm1.MaximumSize = new System.Drawing.Size(910, 395);
this.liveviewForm1.Name = "liveviewForm1";
this.liveviewForm1.PullTimeSpan = 100;
this.liveviewForm1.Size = new System.Drawing.Size(910, 395);
this.liveviewForm1.TabIndex = 89;
this.liveviewForm1.TimeoutMs = 2000;
//
// panelButtons
//
this.panelButtons.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.panelButtons.Controls.Add(this.host_ip_lbl);
this.panelButtons.Controls.Add(this.label1);
this.panelButtons.Controls.Add(this.label3);
this.panelButtons.Controls.Add(this.sr2000w_ip_lbl);
this.panelButtons.Controls.Add(this.version);
this.panelButtons.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panelButtons.Location = new System.Drawing.Point(0, 708);
this.panelButtons.Name = "panelButtons";
this.panelButtons.Size = new System.Drawing.Size(1050, 32);
this.panelButtons.TabIndex = 90;
//
// host_ip_lbl
//
this.host_ip_lbl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.host_ip_lbl.AutoSize = true;
this.host_ip_lbl.Location = new System.Drawing.Point(63, 10);
this.host_ip_lbl.Name = "host_ip_lbl";
this.host_ip_lbl.Size = new System.Drawing.Size(40, 13);
this.host_ip_lbl.TabIndex = 91;
this.host_ip_lbl.Text = "0.0.0.0";
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 10);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(45, 13);
this.label1.TabIndex = 90;
this.label1.Text = "Host_IP";
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(863, 10);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(73, 13);
this.label3.TabIndex = 89;
this.label3.Text = "SR2000W_IP";
//
// sr2000w_ip_lbl
//
this.sr2000w_ip_lbl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.sr2000w_ip_lbl.AutoSize = true;
this.sr2000w_ip_lbl.Location = new System.Drawing.Point(942, 10);
this.sr2000w_ip_lbl.Name = "sr2000w_ip_lbl";
this.sr2000w_ip_lbl.Size = new System.Drawing.Size(40, 13);
this.sr2000w_ip_lbl.TabIndex = 88;
this.sr2000w_ip_lbl.Text = "0.0.0.0";
//
// version
//
this.version.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.version.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.version.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.version.Location = new System.Drawing.Point(493, 6);
this.version.Name = "version";
this.version.Size = new System.Drawing.Size(64, 21);
this.version.TabIndex = 87;
this.version.Text = "5.0.1";
this.version.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// reader_connector
//
this.reader_connector.Enabled = true;
this.reader_connector.Interval = 5000;
this.reader_connector.Tick += new System.EventHandler(this.reader_connector_Tick);
//
// btnConfiguración
//
this.btnConfiguración.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnConfiguración.Image = global::ScaBox30.Properties.Resources.gear16;
this.btnConfiguración.Location = new System.Drawing.Point(505, 1);
this.btnConfiguración.Name = "btnConfiguración";
this.btnConfiguración.Size = new System.Drawing.Size(37, 23);
this.btnConfiguración.TabIndex = 112;
this.btnConfiguración.UseVisualStyleBackColor = true;
this.btnConfiguración.Click += new System.EventHandler(this.btnConfiguracion_Click);
//
// blackimg_picbx
//
this.blackimg_picbx.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.blackimg_picbx.Image = ((System.Drawing.Image)(resources.GetObject("blackimg_picbx.Image")));
this.blackimg_picbx.Location = new System.Drawing.Point(69, 24);
this.blackimg_picbx.MaximumSize = new System.Drawing.Size(910, 395);
this.blackimg_picbx.Name = "blackimg_picbx";
this.blackimg_picbx.Size = new System.Drawing.Size(910, 395);
this.blackimg_picbx.TabIndex = 104;
this.blackimg_picbx.TabStop = false;
this.blackimg_picbx.Visible = false;
//
// Principal
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(1050, 740);
this.Controls.Add(this.panelBody);
this.Controls.Add(this.panelButtons);
this.Controls.Add(this.panelTitleBar);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.Name = "Principal";
this.Text = "ScanBox";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load);
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress);
this.panelTitleBar.ResumeLayout(false);
this.panelTitleBar.PerformLayout();
this.panelBody.ResumeLayout(false);
this.panelBody.PerformLayout();
this.panelButtons.ResumeLayout(false);
this.panelButtons.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.blackimg_picbx)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Panel panelTitleBar;
private System.Windows.Forms.Button btnMin;
private System.Windows.Forms.Button btnMax;
private System.Windows.Forms.Label labelCaption;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Panel panelBody;
private System.Windows.Forms.Button btnBD;
private System.Windows.Forms.PictureBox blackimg_picbx;
private System.Windows.Forms.Button btnToogleMode;
private System.Windows.Forms.Label utr_count_lbl;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label op_ID_lbl;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label barcode_lbl;
private System.Windows.Forms.Label bad_count_lbl;
private System.Windows.Forms.Label bad_lbl;
private System.Windows.Forms.Label ok_count_lbl;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox DataText;
private System.Windows.Forms.Button TgrBtn;
private Keyence.AutoID.SDK.LiveviewForm liveviewForm1;
private System.Windows.Forms.Panel panelButtons;
private System.Windows.Forms.Label host_ip_lbl;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label sr2000w_ip_lbl;
private System.Windows.Forms.Label version;
private System.Windows.Forms.Timer reader_connector;
private System.Windows.Forms.Label labelCapacity;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Button btnPrinter;
private System.Windows.Forms.Button btnConfiguración;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label labelRate;
}
}

1261
ScanBox/Principal.cs Normal file

File diff suppressed because it is too large Load Diff

3640
ScanBox/Principal.resx Normal file

File diff suppressed because it is too large Load Diff

23
ScanBox/Program.cs Normal file
View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ScaBox30
{
static class Program
{
/// <summary>
/// The main entry point for the application. Menu comment
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(new start_menu());
Application.Run(new Principal());
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Scanbox")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Abenco Advantage Tecnologia")]
[assembly: AssemblyProduct("Scanbox")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("efa18e35-d7e1-407d-83a8-cb8cab5c812c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.0.0")]
[assembly: AssemblyFileVersion("5.0.0")]

163
ScanBox/Properties/Resources.Designer.cs generated Normal file
View File

@@ -0,0 +1,163 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Este código fue generado por una herramienta.
// Versión de runtime:4.0.30319.42000
//
// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
// se vuelve a generar el código.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ScaBox30.Properties {
using System;
/// <summary>
/// Clase de recurso fuertemente tipado, para buscar cadenas traducidas, etc.
/// </summary>
// StronglyTypedResourceBuilder generó automáticamente esta clase
// a través de una herramienta como ResGen o Visual Studio.
// Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen
// con la opción /str o recompile su proyecto de VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.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>
/// Devuelve la instancia de ResourceManager almacenada en caché utilizada por esta clase.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ScaBox30.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Reemplaza la propiedad CurrentUICulture del subproceso actual para todas las
/// búsquedas de recursos mediante esta clase de recurso fuertemente tipado.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Busca un recurso adaptado de tipo System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap chat {
get {
object obj = ResourceManager.GetObject("chat", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Busca un recurso adaptado de tipo System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap error {
get {
object obj = ResourceManager.GetObject("error", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Busca un recurso adaptado de tipo System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap exclamation {
get {
object obj = ResourceManager.GetObject("exclamation", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Busca un recurso adaptado de tipo System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap frente {
get {
object obj = ResourceManager.GetObject("frente", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Busca un recurso adaptado de tipo System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap gear {
get {
object obj = ResourceManager.GetObject("gear", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Busca un recurso adaptado de tipo System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap gear16 {
get {
object obj = ResourceManager.GetObject("gear16", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Busca un recurso adaptado de tipo System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap information {
get {
object obj = ResourceManager.GetObject("information", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Busca un recurso adaptado de tipo System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap question {
get {
object obj = ResourceManager.GetObject("question", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Busca un recurso adaptado de tipo System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap SR_2000W {
get {
object obj = ResourceManager.GetObject("SR-2000W", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Busca un recurso adaptado de tipo System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap superior {
get {
object obj = ResourceManager.GetObject("superior", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@@ -0,0 +1,151 @@
<?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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="gear" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\gear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="gear16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\gear16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="chat" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\chat.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="exclamation" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\exclamation.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="question" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\question.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="error" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="superior" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\superior.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="information" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\information.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SR-2000W" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SR-2000W.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="frente" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\frente.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

26
ScanBox/Properties/Settings.Designer.cs generated Normal file
View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Este código fue generado por una herramienta.
// Versión de runtime:4.0.30319.42000
//
// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
// se vuelve a generar el código.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ScaBox30.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.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;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?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>

88
ScanBox/RJMessageBox.cs Normal file
View File

@@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ScaBox30.Private;
namespace ScaBox30
{
public abstract class RJMessageBox
{
public static DialogResult Show(string text)
{
DialogResult result;
using (var msgForm = new FormMessageBox(text))
result = msgForm.ShowDialog();
return result;
}
public static DialogResult Show(string text, string caption)
{
DialogResult result;
using (var msgForm = new FormMessageBox(text, caption))
result = msgForm.ShowDialog();
return result;
}
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons)
{
DialogResult result;
using (var msgForm = new FormMessageBox(text, caption, buttons))
result = msgForm.ShowDialog();
return result;
}
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
{
DialogResult result;
using (var msgForm = new FormMessageBox(text, caption, buttons, icon))
result = msgForm.ShowDialog();
return result;
}
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
{
DialogResult result;
using (var msgForm = new FormMessageBox(text, caption, buttons, icon, defaultButton))
result = msgForm.ShowDialog();
return result;
}
/*-> IWin32Window Owner:
* Displays a message box in front of the specified object and with the other specified parameters.
* An implementation of IWin32Window that will own the modal dialog box.*/
public static DialogResult Show(IWin32Window owner, string text)
{
DialogResult result;
using (var msgForm = new FormMessageBox(text))
result = msgForm.ShowDialog(owner);
return result;
}
public static DialogResult Show(IWin32Window owner, string text, string caption)
{
DialogResult result;
using (var msgForm = new FormMessageBox(text, caption))
result = msgForm.ShowDialog(owner);
return result;
}
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons)
{
DialogResult result;
using (var msgForm = new FormMessageBox(text, caption, buttons))
result = msgForm.ShowDialog(owner);
return result;
}
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
{
DialogResult result;
using (var msgForm = new FormMessageBox(text, caption, buttons, icon))
result = msgForm.ShowDialog(owner);
return result;
}
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
{
DialogResult result;
using (var msgForm = new FormMessageBox(text, caption, buttons, icon, defaultButton))
result = msgForm.ShowDialog(owner);
return result;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
ScanBox/Resources/chat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
ScanBox/Resources/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
ScanBox/Resources/gear.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

345
ScanBox/ScanBox.csproj Normal file
View File

@@ -0,0 +1,345 @@
<?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>{EFA18E35-D7E1-407D-83A8-CB8CAB5C812C}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>ScaBox30</RootNamespace>
<AssemblyName>ScanBox</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
<PublishUrl>C:\Users\Usuario\Desktop\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>5.0.1.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</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>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>198190EC70C5821E24EE5ED54D567069F95B781D</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>ScanBox30_2_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>scanbox.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.2.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.2\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="Communication">
<HintPath>..\SR_SDK\SDK\Communication.dll</HintPath>
</Reference>
<Reference Include="Csv, Version=1.0.31.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Csv.1.0.31\lib\net40\Csv.dll</HintPath>
</Reference>
<Reference Include="CsvHelper, Version=33.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL">
<HintPath>..\packages\CsvHelper.33.0.1\lib\net48\CsvHelper.dll</HintPath>
</Reference>
<Reference Include="FluentFTP, Version=19.2.2.0, Culture=neutral, PublicKeyToken=f4af092b1d8df44f, processorArchitecture=MSIL">
<HintPath>..\packages\FluentFTP.19.2.2\lib\net45\FluentFTP.dll</HintPath>
</Reference>
<Reference Include="Keyence.AutoID.SDK">
<HintPath>..\SR_SDK\SDK\Keyence.AutoID.SDK.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.9.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.HashCode.1.1.1\lib\net461\Microsoft.Bcl.HashCode.dll</HintPath>
</Reference>
<Reference Include="Microsoft.DotNet.PlatformAbstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.DotNet.PlatformAbstractions.2.1.0\lib\net45\Microsoft.DotNet.PlatformAbstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyModel, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyModel.2.1.0\lib\net451\Microsoft.Extensions.DependencyModel.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SdkApi.Core, Version=2.15.2634.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Zebra.Printer.SDK.2.15.2634\lib\net471\SdkApi.Core.dll</HintPath>
</Reference>
<Reference Include="SdkApi.Desktop, Version=2.15.2634.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Zebra.Printer.SDK.2.15.2634\lib\net471\SdkApi.Desktop.dll</HintPath>
</Reference>
<Reference Include="SdkApi.Desktop.Usb, Version=2.15.2634.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Zebra.Printer.SDK.2.15.2634\lib\net471\SdkApi.Desktop.Usb.dll</HintPath>
</Reference>
<Reference Include="SharpSnmpLib, Version=10.0.9.0, Culture=neutral, PublicKeyToken=4c00852d3788e005, processorArchitecture=MSIL">
<HintPath>..\packages\Lextm.SharpSnmpLib.10.0.9\lib\net452\SharpSnmpLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Collections.Specialized, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Specialized.4.3.0\lib\net46\System.Collections.Specialized.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Pipelines, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.9.0.0\lib\net462\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.NameResolution, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.NameResolution.4.3.0\lib\net46\System.Net.NameResolution.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Sockets, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.0.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Text.Encodings.Web, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.9.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.9.0.0\lib\net462\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<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="System.Xml.XmlDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="VncClientControlCommon">
<HintPath>..\SR_SDK\SDK\VncClientControlCommon.dll</HintPath>
</Reference>
<Reference Include="VncClientControlCommonLib">
<HintPath>..\SR_SDK\SDK\VncClientControlCommonLib.dll</HintPath>
</Reference>
<Reference Include="ZebraPrinterSdk, Version=2.15.2634.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Zebra.Printer.SDK.2.15.2634\lib\net471\ZebraPrinterSdk.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Ayuda.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Ayuda.Designer.cs">
<DependentUpon>Ayuda.cs</DependentUpon>
</Compile>
<Compile Include="ConfigTable.cs" />
<Compile Include="Controller\DbController.cs" />
<Compile Include="Controller\ZebraController.cs" />
<Compile Include="Configuracion.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Configuracion.Designer.cs">
<DependentUpon>Configuracion.cs</DependentUpon>
</Compile>
<Compile Include="FormMessageBox.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormMessageBox.designer.cs">
<DependentUpon>FormMessageBox.cs</DependentUpon>
</Compile>
<Compile Include="Globals.cs" />
<Compile Include="Model\Config.cs" />
<Compile Include="Model\Data.cs" />
<Compile Include="Model\Programas.cs" />
<Compile Include="Model\User.cs" />
<Compile Include="Controller\NetworkDiscoveryHandler.cs" />
<Compile Include="Principal.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Principal.Designer.cs">
<DependentUpon>Principal.cs</DependentUpon>
</Compile>
<Compile Include="operatorDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="operatorDialog.Designer.cs">
<DependentUpon>operatorDialog.cs</DependentUpon>
</Compile>
<Compile Include="DataUI.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DataUI.designer.cs">
<DependentUpon>DataUI.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RJMessageBox.cs" />
<Compile Include="TcpReaderAccessor.cs" />
<Compile Include="TcpReaderSearcher.cs" />
<Compile Include="Usuario.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Usuario.designer.cs">
<DependentUpon>Usuario.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="Ayuda.resx">
<DependentUpon>Ayuda.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Configuracion.resx">
<DependentUpon>Configuracion.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Principal.resx">
<DependentUpon>Principal.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="FormMessageBox.resx">
<DependentUpon>FormMessageBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="operatorDialog.resx">
<DependentUpon>operatorDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DataUI.resx">
<DependentUpon>DataUI.cs</DependentUpon>
<SubType>Designer</SubType>
</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>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="Usuario.resx">
<DependentUpon>Usuario.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<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">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="Resources\chat.png" />
<None Include="Resources\error.png" />
<None Include="Resources\exclamation.png" />
<None Include="Resources\information.png" />
<None Include="Resources\question.png" />
<None Include="Resources\gear.png" />
<None Include="Resources\gear16.png" />
<None Include="Resources\SR-2000W.png" />
<None Include="Resources\superior.png" />
<None Include="Resources\frente.png" />
<Content Include="scanbox.ico" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,319 @@
using System;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ScaBox30.Controller
{
/// <summary>
/// Reemplazo del ReaderAccessor del SDK de Keyence
/// Implementa conexión TCP/IP directa para SR-X300W
/// </summary>
public class TcpReaderAccessor : IDisposable
{
private TcpClient client;
private NetworkStream stream;
private bool isConnected = false;
private CancellableBackgroundWorker receiverWorker;
private Action<byte[]> onDataReceived;
// Propiedades compatibles con el SDK original
public string IpAddress { get; set; }
public int Port { get; set; } = 9004; // Puerto TCP de comandos SR-X300W
public ErrorCode LastErrorInfo { get; private set; } = ErrorCode.None;
public int ReceiveTimeout { get; set; } = 30000; // 5 segundos
public TcpReaderAccessor()
{
receiverWorker = new CancellableBackgroundWorker();
}
/// <summary>
/// Conecta al sensor SR-X300W y registra callback para datos recibidos
/// Compatible con: m_reader.Connect((data) => { ... })
/// </summary>
public bool Connect(Action<byte[]> dataReceivedCallback)
{
if (string.IsNullOrEmpty(IpAddress))
{
LastErrorInfo = ErrorCode.InvalidParameter;
Console.WriteLine("ERROR: IpAddress no configurada");
return false;
}
try
{
Console.WriteLine($"[TCP] Conectando a {IpAddress}:{Port}...");
// Crear y conectar TcpClient
client = new TcpClient();
client.Connect(IpAddress, Port);
stream = client.GetStream();
stream.ReadTimeout = ReceiveTimeout;
isConnected = true;
onDataReceived = dataReceivedCallback;
LastErrorInfo = ErrorCode.None;
Console.WriteLine($"[TCP] Conectado exitosamente a {IpAddress}:{Port}");
// Iniciar listener asíncrono (similar al SDK)
//StartAsyncReceiver();
return true;
}
catch (SocketException ex)
{
Console.WriteLine($"[TCP] Error de conexión: {ex.Message}");
LastErrorInfo = ErrorCode.OpenFailed;
isConnected = false;
return false;
}
catch (Exception ex)
{
Console.WriteLine($"[TCP] Error inesperado: {ex.Message}");
LastErrorInfo = ErrorCode.OpenFailed;
isConnected = false;
return false;
}
}
/// <summary>
/// Ejecuta un comando y espera respuesta COMPLETA usando async/await
/// BASADO EN LA APP DE PRUEBA QUE FUNCIONA CORRECTAMENTE
/// </summary>
public string ExecCommand(string command)
{
if (!isConnected || stream == null)
{
LastErrorInfo = ErrorCode.Closed;
Console.WriteLine($"[TCP] ERROR: No conectado al ejecutar '{command}'");
return string.Empty;
}
try
{
// Agregar terminador de línea si no lo tiene
string fullCommand = command.EndsWith("\r") ? command : command + "\r";
byte[] cmdBytes = Encoding.ASCII.GetBytes(fullCommand);
Console.WriteLine($"[TCP] Enviando comando: '{command}' ({cmdBytes.Length} bytes)");
Console.WriteLine($"[TCP] Bytes a enviar: [{BitConverter.ToString(cmdBytes)}]");
// Enviar comando (SÍNCRONO como en tu app original)
stream.Write(cmdBytes, 0, cmdBytes.Length);
stream.Flush();
Console.WriteLine("[TCP] Bytes escritos ✓");
// **CAMBIO CRÍTICO**: Usar el patrón de la app de prueba
Console.WriteLine($"[TCP] Leyendo respuesta (timeout {ReceiveTimeout}ms)...");
byte[] buffer = new byte[8192];
StringBuilder responseBuilder = new StringBuilder();
// Crear task de lectura asíncrona
Task<int> readTask = stream.ReadAsync(buffer, 0, buffer.Length);
// Esperar con timeout (igual que la app de prueba)
if (readTask.Wait(ReceiveTimeout))
{
int bytesRead = readTask.Result;
Console.WriteLine($"[TCP] Primera lectura: {bytesRead} bytes");
if (bytesRead > 0)
{
string chunk = Encoding.ASCII.GetString(buffer, 0, bytesRead);
responseBuilder.Append(chunk);
// Si contiene \r, ya terminó
if (chunk.Contains("\r"))
{
string response = responseBuilder.ToString();
Console.WriteLine($"[TCP] Respuesta completa en primer paquete: {response.Length} bytes");
Console.WriteLine($"[TCP] Respuesta HEX: [{BitConverter.ToString(buffer, 0, bytesRead)}]");
string preview = response.Length > 100
? response.Substring(0, 50) + "..." + response.Substring(response.Length - 50)
: response.TrimEnd('\r', '\n');
Console.WriteLine($"[TCP] Preview: '{preview}'");
LastErrorInfo = ErrorCode.None;
return response;
}
// Si NO terminó, leer más paquetes
Console.WriteLine("[TCP] Respuesta incompleta, leyendo más paquetes...");
DateTime startTime = DateTime.Now;
int packetsRead = 1;
while ((DateTime.Now - startTime).TotalMilliseconds < ReceiveTimeout)
{
if (stream.DataAvailable)
{
readTask = stream.ReadAsync(buffer, 0, buffer.Length);
if (readTask.Wait(5000)) // 5s para paquetes adicionales
{
bytesRead = readTask.Result;
if (bytesRead > 0)
{
packetsRead++;
chunk = Encoding.ASCII.GetString(buffer, 0, bytesRead);
responseBuilder.Append(chunk);
Console.WriteLine($"[TCP] Paquete {packetsRead}: {bytesRead} bytes");
if (chunk.Contains("\r"))
{
break; // Terminador encontrado
}
}
}
}
else
{
System.Threading.Thread.Sleep(50); // Esperar más datos
}
}
string finalResponse = responseBuilder.ToString();
Console.WriteLine($"[TCP] Respuesta COMPLETA: {finalResponse.Length} bytes en {packetsRead} paquetes");
string finalPreview = finalResponse.Length > 100
? finalResponse.Substring(0, 50) + "..." + finalResponse.Substring(finalResponse.Length - 50)
: finalResponse.TrimEnd('\r', '\n');
Console.WriteLine($"[TCP] Preview final: '{finalPreview}'");
LastErrorInfo = ErrorCode.None;
return finalResponse;
}
else
{
Console.WriteLine("[TCP] Primera lectura devolvió 0 bytes");
LastErrorInfo = ErrorCode.None;
return string.Empty;
}
}
else
{
Console.WriteLine($"[TCP] TIMEOUT esperando respuesta de '{command}'");
LastErrorInfo = ErrorCode.Timeout;
return string.Empty;
}
}
catch (Exception ex)
{
Console.WriteLine($"[TCP] Error en ExecCommand '{command}': {ex.Message}");
Console.WriteLine($"[TCP] StackTrace: {ex.StackTrace}");
LastErrorInfo = ErrorCode.SendFailed;
return string.Empty;
}
}
/// <summary>
/// Inicia un worker en background para recibir datos asíncronos
/// Esto simula el comportamiento del SDK cuando hay lecturas continuas
/// </summary>
private void StartAsyncReceiver()
{
receiverWorker.DoWork += (sender, e) =>
{
byte[] buffer = new byte[8192];
while (!receiverWorker.CancellationPending && isConnected)
{
try
{
if (stream != null && stream.DataAvailable)
{
int bytesRead = stream.Read(buffer, 0, buffer.Length);
if (bytesRead > 0)
{
byte[] data = new byte[bytesRead];
Array.Copy(buffer, data, bytesRead);
// Llamar al callback registrado
onDataReceived?.Invoke(data);
}
}
else
{
Thread.Sleep(50); // Pequeña pausa para no saturar CPU
}
}
catch (Exception ex)
{
Console.WriteLine($"[TCP] Error en receiver: {ex.Message}");
LastErrorInfo = ErrorCode.BeginReceiveFailed;
break;
}
}
};
receiverWorker.RunWorkerAsync();
}
/// <summary>
/// Cierra la conexión TCP
/// </summary>
public void Disconnect()
{
try
{
Console.WriteLine("[TCP] Desconectando...");
isConnected = false;
// Detener receiver
if (receiverWorker != null && receiverWorker.IsBusy)
{
receiverWorker.CancelAsync();
Thread.Sleep(100); // Dar tiempo para que termine
}
stream?.Close();
client?.Close();
LastErrorInfo = ErrorCode.None;
Console.WriteLine("[TCP] Desconectado correctamente");
}
catch (Exception ex)
{
Console.WriteLine($"[TCP] Error al desconectar: {ex.Message}");
}
}
public void Dispose()
{
Disconnect();
stream?.Dispose();
client?.Dispose();
receiverWorker?.Dispose();
}
}
/// <summary>
/// Enumeración de códigos de error compatible con el SDK
/// </summary>
public enum ErrorCode
{
None = 0,
AlreadyOpen = 1,
Closed = 2,
OpenFailed = 3,
Timeout = 4,
SendFailed = 5,
BeginReceiveFailed = 6,
InvalidParameter = 7
}
/// <summary>
/// BackgroundWorker con soporte para cancelación
/// </summary>
public class CancellableBackgroundWorker : System.ComponentModel.BackgroundWorker
{
public CancellableBackgroundWorker()
{
WorkerSupportsCancellation = true;
}
}
}

View File

@@ -0,0 +1,248 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Threading.Tasks;
namespace ScaBox30.Controller
{
/// <summary>
/// Reemplazo del ReaderSearcher del SDK
/// Busca sensores SR-X300W en la red mediante escaneo TCP
/// </summary>
public class TcpReaderSearcher : IDisposable
{
private bool isSearching = false;
private List<NicSearchResult> nicList = new List<NicSearchResult>();
public bool IsSearching => isSearching;
public NicSearchResult SelectedNicSearchResult { get; set; }
/// <summary>
/// Lista las interfaces de red disponibles en el equipo
/// Compatible con: m_nicList = m_searcher.ListUpNic()
/// </summary>
public List<NicSearchResult> ListUpNic()
{
nicList.Clear();
try
{
foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces())
{
// Filtrar solo interfaces activas y Ethernet/Wi-Fi
if (ni.OperationalStatus == OperationalStatus.Up &&
(ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet ||
ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211))
{
IPInterfaceProperties ipProps = ni.GetIPProperties();
foreach (UnicastIPAddressInformation ip in ipProps.UnicastAddresses)
{
// Solo IPv4
if (ip.Address.AddressFamily == AddressFamily.InterNetwork)
{
var nicResult = new NicSearchResult
{
NicIpAddr = ip.Address.ToString(),
NicName = ni.Name,
NicDescription = ni.Description
};
nicList.Add(nicResult);
Console.WriteLine($"[NIC] Encontrada: {nicResult.NicIpAddr} ({nicResult.NicName})");
}
}
}
}
}
catch (Exception ex)
{
Console.WriteLine($"[NIC] Error listando interfaces: {ex.Message}");
}
return nicList;
}
/// <summary>
/// Inicia búsqueda de sensores en la red
/// Compatible con: m_searcher.Start((res) => { ... })
/// </summary>
public void Start(Action<SearchResult> onSensorFound)
{
if (isSearching)
{
Console.WriteLine("[SEARCH] Ya hay una búsqueda en curso");
return;
}
if (SelectedNicSearchResult == null)
{
Console.WriteLine("[SEARCH] ERROR: No se ha seleccionado una NIC");
return;
}
isSearching = true;
Console.WriteLine($"[SEARCH] Iniciando búsqueda desde {SelectedNicSearchResult.NicIpAddr}...");
// Ejecutar búsqueda en background
Task.Run(() => SearchSensorsInNetwork(onSensorFound));
}
/// <summary>
/// Busca sensores SR-X300W en la red local
/// Prueba conectar al puerto 9004 (puerto de comandos SR-X300W)
/// </summary>
private async void SearchSensorsInNetwork(Action<SearchResult> onSensorFound)
{
try
{
string localIP = SelectedNicSearchResult.NicIpAddr;
string subnet = GetSubnet(localIP);
int port = 9004; // Puerto TCP comandos SR-X300W
Console.WriteLine($"[SEARCH] Escaneando subnet {subnet}.x en puerto {port}");
// Escanear rango de IPs (ejemplo: 192.168.100.1 - 192.168.100.254)
List<Task> scanTasks = new List<Task>();
for (int i = 1; i <= 254; i++)
{
string testIP = $"{subnet}.{i}";
// No probar la IP local
if (testIP == localIP)
continue;
// Lanzar escaneo asíncrono
scanTasks.Add(Task.Run(async () =>
{
if (await TryConnectToSensor(testIP, port, 500)) // 500ms timeout
{
Console.WriteLine($"[SEARCH] ✓ Sensor encontrado en {testIP}:{port}");
var result = new SearchResult
{
IpAddress = testIP,
Port = port,
IsResponding = true
};
onSensorFound?.Invoke(result);
}
}));
// Limitar concurrencia para no saturar la red
if (scanTasks.Count >= 20)
{
await Task.WhenAll(scanTasks);
scanTasks.Clear();
}
}
// Esperar tareas restantes
await Task.WhenAll(scanTasks);
Console.WriteLine("[SEARCH] Búsqueda completada");
}
catch (Exception ex)
{
Console.WriteLine($"[SEARCH] Error en búsqueda: {ex.Message}");
}
finally
{
isSearching = false;
}
}
/// <summary>
/// Intenta conectar a una IP:Puerto con timeout
/// </summary>
private async Task<bool> TryConnectToSensor(string ip, int port, int timeoutMs)
{
try
{
using (var client = new TcpClient())
{
var connectTask = client.ConnectAsync(ip, port);
var timeoutTask = Task.Delay(timeoutMs);
if (await Task.WhenAny(connectTask, timeoutTask) == connectTask)
{
// Conexión exitosa
if (client.Connected)
{
// Verificar que responda a un comando básico
using (var stream = client.GetStream())
{
stream.ReadTimeout = 500;
byte[] testCmd = System.Text.Encoding.ASCII.GetBytes("NUM\r");
await stream.WriteAsync(testCmd, 0, testCmd.Length);
byte[] buffer = new byte[256];
int bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length);
return bytesRead > 0; // Si responde, es un sensor válido
}
}
}
}
}
catch
{
// Silenciosamente ignorar fallos (IP no responde)
}
return false;
}
/// <summary>
/// Obtiene la subred de una IP (ejemplo: 192.168.100.1 -> 192.168.100)
/// </summary>
private string GetSubnet(string ip)
{
string[] parts = ip.Split('.');
if (parts.Length == 4)
{
return $"{parts[0]}.{parts[1]}.{parts[2]}";
}
return "192.168.100"; // Fallback
}
/// <summary>
/// Detiene la búsqueda
/// </summary>
public void Stop()
{
isSearching = false;
Console.WriteLine("[SEARCH] Búsqueda detenida");
}
public void Dispose()
{
Stop();
}
}
/// <summary>
/// Resultado de búsqueda de NIC (compatible con SDK)
/// </summary>
public class NicSearchResult
{
public string NicIpAddr { get; set; }
public string NicName { get; set; }
public string NicDescription { get; set; }
}
/// <summary>
/// Resultado de búsqueda de sensor
/// </summary>
public class SearchResult
{
public string IpAddress { get; set; }
public int Port { get; set; }
public bool IsResponding { get; set; }
}
}

219
ScanBox/Usuario.Designer.cs generated Normal file
View File

@@ -0,0 +1,219 @@
namespace ScaBox30
{
partial class Usuario
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Usuario));
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.comboUser = new System.Windows.Forms.ComboBox();
this.textPassword = new System.Windows.Forms.TextBox();
this.panelBody = new System.Windows.Forms.Panel();
this.panelButtons = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.panelTitleBar = new System.Windows.Forms.Panel();
this.labelCaption = new System.Windows.Forms.Label();
this.btnClose = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.panelBody.SuspendLayout();
this.panelButtons.SuspendLayout();
this.panelTitleBar.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(83, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(45, 16);
this.label1.TabIndex = 0;
this.label1.Text = "User:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(83, 66);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(80, 16);
this.label2.TabIndex = 1;
this.label2.Text = "Password:";
//
// comboUser
//
this.comboUser.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboUser.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.comboUser.FormattingEnabled = true;
this.comboUser.Location = new System.Drawing.Point(86, 34);
this.comboUser.Name = "comboUser";
this.comboUser.Size = new System.Drawing.Size(198, 28);
this.comboUser.TabIndex = 2;
//
// textPassword
//
this.textPassword.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textPassword.Location = new System.Drawing.Point(86, 85);
this.textPassword.Name = "textPassword";
this.textPassword.PasswordChar = '*';
this.textPassword.Size = new System.Drawing.Size(198, 26);
this.textPassword.TabIndex = 3;
//
// panelBody
//
this.panelBody.BackColor = System.Drawing.Color.WhiteSmoke;
this.panelBody.Controls.Add(this.comboUser);
this.panelBody.Controls.Add(this.textPassword);
this.panelBody.Controls.Add(this.label1);
this.panelBody.Controls.Add(this.label2);
this.panelBody.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelBody.Location = new System.Drawing.Point(0, 35);
this.panelBody.Name = "panelBody";
this.panelBody.Padding = new System.Windows.Forms.Padding(10, 10, 0, 0);
this.panelBody.Size = new System.Drawing.Size(357, 129);
this.panelBody.TabIndex = 8;
//
// panelButtons
//
this.panelButtons.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.panelButtons.Controls.Add(this.button2);
this.panelButtons.Controls.Add(this.button1);
this.panelButtons.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panelButtons.Location = new System.Drawing.Point(0, 164);
this.panelButtons.Name = "panelButtons";
this.panelButtons.Size = new System.Drawing.Size(357, 60);
this.panelButtons.TabIndex = 7;
//
// button1
//
this.button1.BackColor = System.Drawing.Color.SeaGreen;
this.button1.FlatAppearance.BorderSize = 0;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.ForeColor = System.Drawing.Color.WhiteSmoke;
this.button1.Location = new System.Drawing.Point(19, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 35);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// panelTitleBar
//
this.panelTitleBar.BackColor = System.Drawing.Color.CornflowerBlue;
this.panelTitleBar.Controls.Add(this.labelCaption);
this.panelTitleBar.Controls.Add(this.btnClose);
this.panelTitleBar.Dock = System.Windows.Forms.DockStyle.Top;
this.panelTitleBar.Location = new System.Drawing.Point(0, 0);
this.panelTitleBar.Name = "panelTitleBar";
this.panelTitleBar.Size = new System.Drawing.Size(357, 35);
this.panelTitleBar.TabIndex = 6;
this.panelTitleBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelTitleBar_MouseDown);
//
// labelCaption
//
this.labelCaption.AutoSize = true;
this.labelCaption.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelCaption.ForeColor = System.Drawing.Color.White;
this.labelCaption.Location = new System.Drawing.Point(9, 8);
this.labelCaption.Name = "labelCaption";
this.labelCaption.Size = new System.Drawing.Size(86, 17);
this.labelCaption.TabIndex = 4;
this.labelCaption.Text = "labelCaption";
//
// btnClose
//
this.btnClose.Dock = System.Windows.Forms.DockStyle.Right;
this.btnClose.FlatAppearance.BorderSize = 0;
this.btnClose.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(79)))), ((int)(((byte)(95)))));
this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClose.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnClose.ForeColor = System.Drawing.Color.White;
this.btnClose.Location = new System.Drawing.Point(317, 0);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(40, 35);
this.btnClose.TabIndex = 3;
this.btnClose.Text = "X";
this.btnClose.UseVisualStyleBackColor = false;
//
// button2
//
this.button2.BackColor = System.Drawing.Color.SeaGreen;
this.button2.FlatAppearance.BorderSize = 0;
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button2.ForeColor = System.Drawing.Color.WhiteSmoke;
this.button2.Location = new System.Drawing.Point(125, 13);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(100, 35);
this.button2.TabIndex = 2;
this.button2.Text = "button2";
this.button2.UseVisualStyleBackColor = false;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Usuario
//
this.AcceptButton = this.button1;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(357, 224);
this.Controls.Add(this.panelBody);
this.Controls.Add(this.panelButtons);
this.Controls.Add(this.panelTitleBar);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "Usuario";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "User";
this.TopMost = true;
this.panelBody.ResumeLayout(false);
this.panelBody.PerformLayout();
this.panelButtons.ResumeLayout(false);
this.panelTitleBar.ResumeLayout(false);
this.panelTitleBar.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox comboUser;
private System.Windows.Forms.TextBox textPassword;
private System.Windows.Forms.Panel panelBody;
private System.Windows.Forms.Panel panelButtons;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Panel panelTitleBar;
private System.Windows.Forms.Label labelCaption;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button button2;
}
}

161
ScanBox/Usuario.cs Normal file
View File

@@ -0,0 +1,161 @@
using ScaBox30.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ScaBox30
{
public partial class Usuario : Form
{
public Usuario()
{
InitializeComponent();
InitializeItems();
InitializeButtons();
LoadUsers();
}
private void LoadUsers()
{
CreateUserJson(Globals.auth_json);
LoadUserJson(Globals.auth_json);
if (Globals.users.Count > 0)
{
foreach (var user in Globals.users)
{
comboUser.Items.Add(user.user);
}
comboUser.SelectedIndex = 0;
}
}
private void CreateUserJson(string jsonfile)
{
if (!File.Exists(jsonfile))
{
List<User> users = new List<User> { };
users.Add(new User() { user = "admin", password = "admin123" });
var json = JsonSerializer.Serialize<List<User>>(users);
File.WriteAllText(jsonfile, json);
users.Clear();
}
}
private void LoadUserJson(string jsonfile)
{
if (File.Exists(jsonfile))
{
Globals.users.Clear();
string jsoncontent = File.ReadAllText(jsonfile);
Globals.users = JsonSerializer.Deserialize<List<User>>(jsoncontent);
jsoncontent = "";
}
}
private void buttonOk_Click(object sender, EventArgs e)
{
if (Globals.users.Count() > 0)
{
var res = Globals.users.Find(u => u.password == textPassword.Text);
if (res != null) {
Globals.valid_user = true;
Globals.users.Clear();
this.Close();
} else
{
textPassword.Text = "";
Globals.valid_user = false;
Globals.users.Clear();
this.Close();
}
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
if (Globals.users.Count() > 0)
{
var res = Globals.users.Find(u => u.password == textPassword.Text);
if (res != null)
{
Globals.valid_user = true;
Globals.users.Clear();
this.Close();
}
else
{
textPassword.Text = "";
Globals.valid_user = false;
Globals.users.Clear();
this.Close();
}
}
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void InitializeItems()
{
this.FormBorderStyle = FormBorderStyle.None;
this.Padding = new Padding(Globals.borderSize);//Set border size
this.btnClose.DialogResult = DialogResult.Cancel;
this.button1.DialogResult = DialogResult.OK;
this.labelCaption.Text = this.Text;
this.panelTitleBar.BackColor = Globals.primaryColor;
this.panelTitleBar.Padding = new Padding(0, 0, 0, Globals.borderSize);
this.BackColor = Globals.primaryColor;
}
private void InitializeButtons()
{
int xCenter = (this.panelButtons.Width - button1.Width) / 2;
int yCenter = (this.panelButtons.Height - button1.Height) / 2;
//OK Button
button1.Visible = true;
button1.Location = new Point(xCenter - (button1.Width / 2) - 5, yCenter);
button1.Text = "Ok";
button1.DialogResult = DialogResult.OK;//Set DialogResult
//Cancel Button
button2.Visible = true;
button2.Location = new Point(xCenter + (button2.Width / 2) + 5, yCenter);
button2.Text = "Cancel";
button2.DialogResult = DialogResult.Cancel;//Set DialogResult
button2.BackColor = Globals.colors.retry_cancell;
}
#region -> Drag Form
[DllImport("user32.DLL", EntryPoint = "SendMessage")]
private extern static void SendMessage(System.IntPtr hWnd, int wMsg, int wParam, int lParam);
[DllImport("user32.DLL", EntryPoint = "ReleaseCapture")]
private extern static void ReleaseCapture();
private void panelTitleBar_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, 0x112, 0xf012, 0);
}
#endregion
}
}

3607
ScanBox/Usuario.resx Normal file

File diff suppressed because it is too large Load Diff

BIN
ScanBox/black_image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

1
ScanBox/config.json Normal file
View File

@@ -0,0 +1 @@
[{"cleardelay":"5","interval":"200","usbprinter":"none","ipprinter":"192.168.100.101"}]

182
ScanBox/operatorDialog.Designer.cs generated Normal file
View File

@@ -0,0 +1,182 @@
namespace ScaBox30
{
partial class operatorDialog
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(operatorDialog));
this.txtDialog = new System.Windows.Forms.TextBox();
this.panelBody = new System.Windows.Forms.Panel();
this.labelMessage = new System.Windows.Forms.Label();
this.panelButtons = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.panelTitleBar = new System.Windows.Forms.Panel();
this.labelCaption = new System.Windows.Forms.Label();
this.btnClose = new System.Windows.Forms.Button();
this.panelBody.SuspendLayout();
this.panelButtons.SuspendLayout();
this.panelTitleBar.SuspendLayout();
this.SuspendLayout();
//
// txtDialog
//
this.txtDialog.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtDialog.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtDialog.Location = new System.Drawing.Point(10, 57);
this.txtDialog.Name = "txtDialog";
this.txtDialog.Size = new System.Drawing.Size(365, 47);
this.txtDialog.TabIndex = 1;
this.txtDialog.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// panelBody
//
this.panelBody.BackColor = System.Drawing.Color.WhiteSmoke;
this.panelBody.Controls.Add(this.labelMessage);
this.panelBody.Controls.Add(this.txtDialog);
this.panelBody.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelBody.Location = new System.Drawing.Point(0, 35);
this.panelBody.Name = "panelBody";
this.panelBody.Padding = new System.Windows.Forms.Padding(10, 10, 0, 0);
this.panelBody.Size = new System.Drawing.Size(383, 123);
this.panelBody.TabIndex = 5;
//
// labelMessage
//
this.labelMessage.AutoSize = true;
this.labelMessage.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelMessage.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(85)))), ((int)(((byte)(85)))));
this.labelMessage.Location = new System.Drawing.Point(10, 10);
this.labelMessage.MaximumSize = new System.Drawing.Size(600, 0);
this.labelMessage.Name = "labelMessage";
this.labelMessage.Padding = new System.Windows.Forms.Padding(5, 5, 10, 15);
this.labelMessage.Size = new System.Drawing.Size(154, 44);
this.labelMessage.TabIndex = 2;
this.labelMessage.Text = "labelMessage";
this.labelMessage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// panelButtons
//
this.panelButtons.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.panelButtons.Controls.Add(this.button1);
this.panelButtons.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panelButtons.Location = new System.Drawing.Point(0, 158);
this.panelButtons.Name = "panelButtons";
this.panelButtons.Size = new System.Drawing.Size(383, 60);
this.panelButtons.TabIndex = 4;
//
// button1
//
this.button1.BackColor = System.Drawing.Color.SeaGreen;
this.button1.FlatAppearance.BorderSize = 0;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.ForeColor = System.Drawing.Color.WhiteSmoke;
this.button1.Location = new System.Drawing.Point(19, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 35);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = false;
//
// panelTitleBar
//
this.panelTitleBar.BackColor = System.Drawing.Color.CornflowerBlue;
this.panelTitleBar.Controls.Add(this.labelCaption);
this.panelTitleBar.Controls.Add(this.btnClose);
this.panelTitleBar.Dock = System.Windows.Forms.DockStyle.Top;
this.panelTitleBar.Location = new System.Drawing.Point(0, 0);
this.panelTitleBar.Name = "panelTitleBar";
this.panelTitleBar.Size = new System.Drawing.Size(383, 35);
this.panelTitleBar.TabIndex = 3;
this.panelTitleBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelTitleBar_MouseDown);
//
// labelCaption
//
this.labelCaption.AutoSize = true;
this.labelCaption.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelCaption.ForeColor = System.Drawing.Color.White;
this.labelCaption.Location = new System.Drawing.Point(9, 8);
this.labelCaption.Name = "labelCaption";
this.labelCaption.Size = new System.Drawing.Size(86, 17);
this.labelCaption.TabIndex = 4;
this.labelCaption.Text = "labelCaption";
//
// btnClose
//
this.btnClose.Dock = System.Windows.Forms.DockStyle.Right;
this.btnClose.FlatAppearance.BorderSize = 0;
this.btnClose.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(79)))), ((int)(((byte)(95)))));
this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClose.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnClose.ForeColor = System.Drawing.Color.White;
this.btnClose.Location = new System.Drawing.Point(343, 0);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(40, 35);
this.btnClose.TabIndex = 3;
this.btnClose.Text = "X";
this.btnClose.UseVisualStyleBackColor = false;
//
// operatorDialog
//
this.AcceptButton = this.button1;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(383, 218);
this.Controls.Add(this.panelBody);
this.Controls.Add(this.panelButtons);
this.Controls.Add(this.panelTitleBar);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.Name = "operatorDialog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Operador";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.operatorDialog_FormClosing);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.operatorDialog_KeyDown);
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.operatorDialog_KeyPress);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.operatorDialog_KeyUp);
this.panelBody.ResumeLayout(false);
this.panelBody.PerformLayout();
this.panelButtons.ResumeLayout(false);
this.panelTitleBar.ResumeLayout(false);
this.panelTitleBar.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TextBox txtDialog;
private System.Windows.Forms.Panel panelBody;
private System.Windows.Forms.Panel panelButtons;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Panel panelTitleBar;
private System.Windows.Forms.Label labelCaption;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Label labelMessage;
}
}

163
ScanBox/operatorDialog.cs Normal file
View File

@@ -0,0 +1,163 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ScaBox30
{
public partial class operatorDialog : Form
{
//Key press supporting items
DateTime _lastKeystroke = new DateTime(0);
List<char> _barcode = new List<char>(10);
DateTime _date_down = new DateTime(0);
DateTime timeDelta = new DateTime(0);
int _PressedKey = 0;
//private bool barcodeOnly;
public string OPIDgave { get { return txtDialog.Text; } }
public operatorDialog(bool barcodeOnly)
{
InitializeComponent();
InitializeItems();
InitializeButtons();
if (barcodeOnly)
{
this.KeyPreview = true;
}
else
{
this.KeyPreview = false;
}
ActiveControl = this.txtDialog;
}
private void operatorDialog_KeyPress(object sender, KeyPressEventArgs e)
{
//Key_Preview must be set to True on the form EWQ
// check timing (keystrokes within 100 ms)
TimeSpan elapsed = (DateTime.Now - _lastKeystroke);
if (elapsed.TotalMilliseconds > 20)
{
_barcode.Clear();
txtDialog.Text = "";
}
// record keystroke & timestamp
_barcode.Add(e.KeyChar);
_lastKeystroke = DateTime.Now;
// process barcode
if (e.KeyChar == 13 && _barcode.Count > 0)
{
string msg = new String(_barcode.ToArray());
msg = msg.Replace("\r", "");
if (msg != "")
{
txtDialog.Text = msg;
//btnDialog.Focus();
button1.Focus();
}
_barcode.Clear();
}
}
private void operatorDialog_FormClosing(object sender, FormClosingEventArgs e)
{
switch (txtDialog.Text.Length)
{
case 6:
e.Cancel = false;
break;
case 0:
e.Cancel = true;
RJMessageBox.Show("El ID es obligatorio.", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Stop);
break;
default:
e.Cancel = true;
RJMessageBox.Show("El ID debe ser de 6 dígitos", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Stop);
break;
}
}
private void operatorDialog_KeyDown(object sender, KeyEventArgs e)
{
_PressedKey = e.KeyValue;
_date_down = DateTime.Now;
e.Handled = true;
}
private void operatorDialog_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyValue == _PressedKey)
{
var timeDelta = DateTime.Now - _date_down;
_PressedKey = e.KeyValue;
if (timeDelta.TotalMilliseconds > 20)
{
_barcode.Clear();
txtDialog.Text = "";
}
}
}
private void InitializeItems()
{
this.FormBorderStyle = FormBorderStyle.None;
this.Padding = new Padding(Globals.borderSize);//Set border size
this.btnClose.DialogResult = DialogResult.Cancel;
this.button1.DialogResult = DialogResult.OK;
this.labelCaption.Text = this.Text;
this.panelTitleBar.BackColor = Globals.primaryColor;
this.panelTitleBar.Padding = new Padding(0, 0, 0, Globals.borderSize);
this.BackColor = Globals.primaryColor;
this.labelMessage.Text = "Ingrese su ID";
int xCenter = (this.panelButtons.Width - labelMessage.Width) / 2;
int yCenter = (this.panelButtons.Height - labelMessage.Height) / 2;
labelMessage.Location = new Point(xCenter, labelMessage.Location.Y);
}
private void InitializeButtons()
{
int xCenter = (this.panelButtons.Width - button1.Width) / 2;
int yCenter = (this.panelButtons.Height - button1.Height) / 2;
button1.Location = new Point(xCenter, yCenter);
button1.Text = "Aceptar";
}
#region -> Drag Form
[DllImport("user32.DLL", EntryPoint = "SendMessage")]
private extern static void SendMessage(System.IntPtr hWnd, int wMsg, int wParam, int lParam);
[DllImport("user32.DLL", EntryPoint = "ReleaseCapture")]
private extern static void ReleaseCapture();
private void panelTitleBar_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, 0x112, 0xf012, 0);
}
#endregion
}
}

3607
ScanBox/operatorDialog.resx Normal file

File diff suppressed because it is too large Load Diff

29
ScanBox/packages.config Normal file
View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Csv" version="1.0.31" targetFramework="net481" />
<package id="CsvHelper" version="33.0.1" targetFramework="net481" />
<package id="FluentFTP" version="19.2.2" targetFramework="net481" />
<package id="Lextm.SharpSnmpLib" version="10.0.9" targetFramework="net481" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="9.0.0" targetFramework="net481" />
<package id="Microsoft.Bcl.HashCode" version="1.1.1" targetFramework="net481" />
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="net481" />
<package id="Microsoft.DotNet.PlatformAbstractions" version="2.1.0" targetFramework="net481" />
<package id="Microsoft.Extensions.DependencyModel" version="2.1.0" targetFramework="net481" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net481" />
<package id="Portable.BouncyCastle" version="1.8.2" targetFramework="net481" />
<package id="System.Buffers" version="4.5.1" targetFramework="net481" />
<package id="System.Collections.Specialized" version="4.3.0" targetFramework="net481" />
<package id="System.IO.Pipelines" version="9.0.0" targetFramework="net481" />
<package id="System.Memory" version="4.5.5" targetFramework="net481" />
<package id="System.Net.NameResolution" version="4.3.0" targetFramework="net481" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net481" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net481" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net481" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.0.0" targetFramework="net481" />
<package id="System.Text.Encodings.Web" version="9.0.0" targetFramework="net481" />
<package id="System.Text.Json" version="9.0.0" targetFramework="net481" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net481" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net481" />
<package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="net481" />
<package id="Zebra.Printer.SDK" version="2.15.2634" targetFramework="net481" />
</packages>

BIN
ScanBox/scanbox.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB