Pos client display device display total price unit price change 0 collection C # SerialPort Method

Source: Internet
Author: User
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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.