Search code examples
c#point-of-sale

How to Display Text and Clear the Text of Partner CD7220-UN Customer Display / Pole Display


I have a Partner Tech CD7220-U 1.0 Customer Display and I'm trying to develop a POS system using C#. I need to show the unit price and Total Amount using the customer display. So I have searched the google and found few solutions to show the text on the display. here are the links I followed,

1)http://www.codeproject.com/Questions/67846/How-to-display-text-on-USB-Posiflex-Customer-Displ

2)http://www.codeproject.com/Tips/658377/PartnerTech-CD-POS-Customer-Display-NET-Class

In the example (1)

    using Microsoft.PointOfService;

private const string WelcomeMessage = "Welcome\r\n";
private PosExplorer posExplorer;
private LineDisplay posLineDisplay;
private DeviceInfo posLineDisplaydevice;

public void LineDisplayUnit()
{
this.posExplorer = new PosExplorer(this);
this.posLineDisplaydevice = this.posExplorer.GetDevice("LineDisplay", "POSIFLEX_LINEDISPLAY");

try
{
this.posLineDisplay = (LineDisplay)this.posExplorer.CreateInstance(this.posLineDisplaydevice);
this.posLineDisplay.Open();
this.posLineDisplay.Claim(1000);
this.posLineDisplay.DeviceEnabled = true;
this.posLineDisplay.DisplayText(WelcomeMessage);
this.posLineDisplay.DisplayTextAt(2, 1, this.LeftAlign("Amount", 7) + this.RightAlign(this.GrandTotalAmount.ToString("0.00"), 12));
this.posLineDisplay.Close();

}
catch (Exception)
{

}
}

I have the following exception enter image description here

In example to I'm able to send the Text to the Customer Display. but I'm unable to clear the screen.

Here's the code

public void WriteSomethingRedToPrinterThroughDisplay()
    {
        cUSB.OpenPort(); // Open the USB Port
        cUSB.WritePort(Strings.Chr(12));   // Clear pole display
        cUSB.WritePort(Strings.Chr(27) + Strings.Chr(61) + 
        Strings.Chr(1));   // Send print through pole display
        cUSB.WritePort(Strings.Chr(27) + Strings.Chr(64));   // Initialize printer
        cUSB.WritePort(Strings.Chr(27) + Strings.Chr(114) + 
        Strings.Chr(1));   // Select Red color to print
        cUSB.WritePort(string.Format("{0,-10}{1,7:-0.000}
        {2,10:0.00}{3,13:-0.00}", tempitemid, tempunits, 
        tempunitprice, tempsubtotal) + Strings.Chr(10));   // Print text and new line
        cUSB.WritePort(Strings.Chr(27) + Strings.Chr(114) + 
        Strings.Chr(0));   // Set color to default Black
        cUSB.WritePort(Strings.Chr(27) + Strings.Chr(61) + 
        Strings.Chr(2));   // De-select printer and enable pole display
        cUSB.ClosePort();  // Close the USB Port
    }

Please send me the correct tutorial or correct method to show text in the display unit. your help will be highly appreciated.


Solution

  • Use the second link that you have mentioned above.

    You can use public class USBas it is. Use cUSB.WritePort("\f") to clear the pole display.

    private void button1_Click(object sender, EventArgs e)
    {
    cUSB.OpenPort(); // Open the USB Port
    cUSB.WritePort("\f"); // Clear pole display
    cUSB.ClosePort();
    } 
    

    I think the following codes will also be useful to you.

    \f - clear screen

    \n - new line with tab

    \r - next line

    \t - tab

    \v - first row first column