I found a bunch of methods on the Internet, such as C ++ or vB DLL calls.
In fact, there is another 2005 SerialPort method.
Download source code
--------------------------- Console program ----------------------
Using system;
Using system. Collections. Generic;
Using system. text;
Using system. Io. ports;
Namespace EAD. Pos
{
Class serialportoutput
{
/// <Summary>
/// Total
/// </Summary>
/// <Param name = "value"> The value. </param>
Public static void sum (string value)
{
Clear ();
// Collect ();
// Change to zero ();
Newdata (value );
Total ();
}
/// <Summary>
/// Unit price
/// </Summary>
/// <Param name = "value"> The value. </param>
Public static void unitprice (string value)
{
Clear ();
Newdata (value );
Unit Price ();
}
/// <Summary>
/// Collect
/// </Summary>
/// <Param name = "value"> The value. </param>
Public static void get (string value)
{
Clear ();
Newdata (value );
Collection ();
}
/// <Summary>
/// Change to zero
/// </Summary>
/// <Param name = "value"> The value. </param>
Public static void change (string value)
{
Clear ();
Newdata (value );
0 ();
}
/// <Summary>
/// All dark. It is the light for the change of the full price collection.
/// </Summary>
Public static void allblack ()
{
SerialPort serialport1 = new SerialPort ();
Serialport1.portname = "COM1 ";
Serialport1.baudrate = 2400;
Serialport1.open ();
Serialport1.writeline (@ "S0 ");
Serialport1.close ();
}
/// <Summary>
/// Clear the screen.
/// </Summary>
Public static void clear ()
{
SerialPort serialport1 = new SerialPort ();
Serialport1.portname = "COM1 ";
Serialport1.baudrate = 2400;
Serialport1.open ();
Serialport1.writeline ("\ f ");
Serialport1.close ();
}
Private Static void unit price ()
{
SerialPort serialport1 = new SerialPort ();
Serialport1.portname = "COM1 ";
Serialport1.baudrate = 2400;
Serialport1.open ();
Serialport1.writeline ("S1"); // the space with data
Serialport1.close ();
}
Total Private Static void ()
{
SerialPort serialport1 = new SerialPort ();
Serialport1.portname = "COM1 ";
Serialport1.baudrate = 2400;
Serialport1.open ();
Serialport1.writeline (@ "S2 ");
Serialport1.close ();
}
Private Static void collection ()
{
SerialPort serialport1 = new SerialPort ();
Serialport1.portname = "COM1 ";
Serialport1.baudrate = 2400;
Serialport1.open ();
Serialport1.writeline (@ "S3 ");
Serialport1.close ();
}
Private Static void ()
{
SerialPort serialport1 = new SerialPort ();
Serialport1.portname = "COM1 ";
Serialport1.baudrate = 2400;
Serialport1.open ();
Serialport1.writeline (@ "S4 ");
Serialport1.close ();
}
Private Static void newdata (string data)
{
SerialPort serialport1 = new SerialPort ();
Serialport1.portname = "COM1 ";
Serialport1.baudrate = 2400;
Serialport1.open ();
Serialport1.writeline (@ "QA" + data );
Serialport1.close ();
}
}
}
--------------------------- Console program ----------------------
Using system;
Using system. Collections. Generic;
Using system. text;
Using EAD. Pos;
Namespace consoleapplication2
{
Class Program
{
Static void main (string [] ARGs)
{
For (;;)
{
Serialportoutput. Clear ();
System. Threading. thread. Sleep (2000 );
Serialportoutput. Change ("21230.34 ");
System. Threading. thread. Sleep (2000 );
Serialportoutput. Get ("230.34 ");
System. Threading. thread. Sleep (2000 );
Serialportoutput. sum ("99230.34 ");
System. Threading. thread. Sleep (2000 );
Serialportoutput. unitprice ("30.34 ");
System. Threading. thread. Sleep (2000 );
}
}
}
}
By the way, how can I reconstruct such a static method?