示例#1
0
        private void getStatus()
        {
            string[] args = new string[] { "-n", datacard.getName() };

            CommandLineOptions commandLineOptions = new CommandLineOptions();

            CommandLine.Utility.Arguments arguments = new CommandLine.Utility.Arguments(args);

            if (string.IsNullOrEmpty(arguments["n"]))
            {
                Console.WriteLine("Some information");
            }
            bool boolVal = false;

            if (Boolean.TryParse(arguments["n"], out boolVal))
            {
                Console.WriteLine("Some information");
            }
            commandLineOptions.printerName = arguments["n"];

            if (!string.IsNullOrEmpty(arguments["j"]))
            {
                commandLineOptions.jobStatus = true;
            }

            BidiSplWrap bidiSpl = null;

            try
            {
                bidiSpl = new BidiSplWrap();
                bidiSpl.BindDevice(commandLineOptions.printerName);

                string driverVersionXml = bidiSpl.GetPrinterData(strings.SDK_VERSION);
                //Console.WriteLine(Environment.NewLine + "driver version: " + Util.ParseDriverVersionXML(driverVersionXml) + Environment.NewLine);

                string printerOptionsXML = bidiSpl.GetPrinterData(strings.PRINTER_OPTIONS2);
                PrinterOptionsValues printerOptionsValues = Util.ParsePrinterOptionsXML(printerOptionsXML);
                DisplayPrinterOptionsValues(printerOptionsValues);

                string printerCardCountXML = bidiSpl.GetPrinterData(strings.COUNTER_STATUS2);
                PrinterCounterStatus printerCounterStatusValues = Util.ParsePrinterCounterStatusXML(printerCardCountXML);
                DisplayPrinterCounterValues(printerCounterStatusValues);

                string         suppliesXML    = bidiSpl.GetPrinterData(strings.SUPPLIES_STATUS3);
                SuppliesValues suppliesValues = Util.ParseSuppliesXML(suppliesXML);
                DisplaySuppliesValues(suppliesValues);

                //string printerStatusXML = bidiSpl.GetPrinterData(strings.PRINTER_MESSAGES);
                //PrinterStatusValues printerStatusValues = Util.ParsePrinterStatusXML(printerStatusXML);
                //DisplayPrinterStatusValues(printerStatusValues);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                bidiSpl.UnbindDevice();
            }
        }
示例#2
0
 private void DisplaySuppliesValues(SuppliesValues vals)
 {
     //Console.WriteLine("Supplies:");
     //Console.WriteLine("  RibbonRemaining:            " + vals._ribbonRemaining + "%");
     datacard.setRibbonRemaining(vals._ribbonRemaining);
     //Console.WriteLine();
 }
示例#3
0
        private void GetPrinterProperties(String printerName)
        {
            BidiSplWrap bidiSpl      = null;
            int         printerJobID = 0;

            try
            {
                bidiSpl = new BidiSplWrap();
                String BindResponse = bidiSpl.BindDevice(printerName);
                textBox4.Text += Environment.NewLine + BindResponse;
                string driverVersionXml = bidiSpl.GetPrinterData(strings.SDK_VERSION);
                textBox4.Text += Environment.NewLine + "driver version: " + Util.ParseDriverVersionXML(driverVersionXml) + Environment.NewLine;

                string printerOptionsXML = bidiSpl.GetPrinterData(strings.PRINTER_OPTIONS2);
                PrinterOptionsValues printerOptionsValues = Util.ParsePrinterOptionsXML(printerOptionsXML);


                if ("Ready" != printerOptionsValues._printerStatus && "Busy" != printerOptionsValues._printerStatus)
                {
                    throw new Exception(printerName + " is not ready. status: " + printerOptionsValues._printerStatus);
                }
                else
                {
                    string         printerOptionsXMLSupply    = bidiSpl.GetPrinterData(strings.SUPPLIES_STATUS3);
                    SuppliesValues printerOptionsSupplyValues = Util.ParseSuppliesXML(printerOptionsXMLSupply);

                    textBox4.Text += Environment.NewLine + "Printer Status: " + printerOptionsValues._printerStatus;
                    textBox4.Text += Environment.NewLine + "Ribbon Type: " + printerOptionsSupplyValues._printRibbonType;
                    textBox4.Text += Environment.NewLine + "Ribbon Serial Number: " + printerOptionsSupplyValues._printRibbonSerialNumber;
                    textBox4.Text += Environment.NewLine + "Ribbon Level: " + printerOptionsSupplyValues._ribbonRemaining + "%";
                }
            }
            catch (BidiException e)
            {
                textBox4.Text += Environment.NewLine + e.Message;
                Util.CancelJob(bidiSpl, e.PrinterJobID, e.ErrorCode);
            }
            catch (Exception e)
            {
                textBox4.Text += Environment.NewLine + e.Message;

                if (0 != printerJobID)
                {
                    Util.CancelJob(bidiSpl, printerJobID, 0);
                }
            }
            finally
            {
                bidiSpl.UnbindDevice();
            }
        }
示例#4
0
    private static void DisplaySuppliesValues(SuppliesValues vals)
    {
        Console.WriteLine("Supplies:");
        Console.WriteLine("  IndentRibbon:               " + vals._indentRibbon);
        Console.WriteLine("  IndentRibbonLotCode:        " + vals._indentRibbonLotCode);
        Console.WriteLine("  IndentRibbonPartNumber:     " + vals._indentRibbonPartNumber);
        Console.WriteLine("  IndentRibbonRemaining:      " + vals._indentRibbonRemaining + "%");
        Console.WriteLine("  IndentRibbonSerialNumber:   " + vals._indentRibbonSerialNumber);
        Console.WriteLine("  L1LaminateLotCode:          " + vals._laminatorL1LotCode);
        Console.WriteLine("  L1LaminatePartNumber:       " + vals._laminatorL1PartNumber);
        Console.WriteLine("  L1LaminateRemaining:        " + vals._laminatorL1PercentRemaining + "%");
        Console.WriteLine("  L1LaminateSerialNumber:     " + vals._laminatorL1SerialNumber);
        Console.WriteLine("  L1LaminateType:             " + vals._laminatorL1SupplyCode);
        Console.WriteLine("  L2LaminateLotCode:          " + vals._laminatorL2LotCode);
        Console.WriteLine("  L2LaminatePartNumber:       " + vals._laminatorL2PartNumber);
        Console.WriteLine("  L2LaminateRemaining:        " + vals._laminatorL2PercentRemaining + "%");
        Console.WriteLine("  L2LaminateSerialNumber:     " + vals._laminatorL2SerialNumber);
        Console.WriteLine("  L2LaminateType:             " + vals._laminatorL2SupplyCode);
        Console.WriteLine("  PrinterStatus:              " + vals._printerStatus);
        Console.WriteLine("  PrintRibbonLotCode:         " + vals._printRibbonLotCode);
        Console.WriteLine("  PrintRibbonPartNumber:      " + vals._printRibbonPartNumber);
        Console.WriteLine("  PrintRibbonSerialNumber:    " + vals._printRibbonSerialNumber);
        Console.WriteLine("  PrintRibbonType:            " + vals._printRibbonType);
        Console.WriteLine("  PrintRibbonRegionCode:      " + vals._printRibbonRegionCode);
        Console.WriteLine("  RibbonRemaining:            " + vals._ribbonRemaining + "%");

        Console.WriteLine("  RetransferFilmLotCode:      " + vals._retransferFilmLotCode);
        Console.WriteLine("  RetransferFilmPartNumber:   " + vals._retransferFilmPartNumber);
        Console.WriteLine("  RetransferFilmRemaining:    " + vals._retransferFilmRemaining + "%");
        Console.WriteLine("  RetransferFilmSerialNumber: " + vals._retransferFilmSerialNumber);

        Console.WriteLine("  TopperRibbonLotCode:        " + vals._topperRibbonLotCode);
        Console.WriteLine("  TopperRibbonPartNumber:     " + vals._topperRibbonPartNumber);
        Console.WriteLine("  TopperRibbonRemaining:      " + vals._topperRibbonRemaining + "%");
        Console.WriteLine("  TopperRibbonSerialNumber:   " + vals._topperRibbonSerialNumber);
        Console.WriteLine("  TopperRibbonType:           " + vals._topperRibbonType);
        Console.WriteLine();
    }