public static void Initialise(BusyDialog busyDialog) { if (!Order.Initialise()) { MessageLogger.Add("Error connecting to DB - see log file for details", MessageLogger.MsgLevel.critical); } Pack.Initialise(); printer = new LabelPrinter(); if (CommonData.localSettings.PullMaterialsAtStartup) { ReadMaterialsFromSAP(busyDialog); } else { ReadMaterialsFromDB(busyDialog); } if (CommonData.localSettings.PullOrdersAtStartup) { ReadOrdersFromSAP(busyDialog); } else { ReadOrdersFromDB(busyDialog); } }
private PrintPackageDataLabel.Response PrintPackageDataLabelHandler(PrintPackageDataLabel command) { var response = new PrintPackageDataLabel.Response(); var error1 = LabelPrinter.PrintDataLabel(command.SerialNumbers, command.ProductCode, command.WorkArea); if (!error1.connectionsucceeded) { response.SetError(-1000, "Impossibile connettersi al servizio di stampa: " + error1.error); return(response); } else if (!string.IsNullOrEmpty(error1.error)) { response.SetError(-1000, "Errore di stampa etichetta dati:" + error1.error); return(response); } var error2 = LabelPrinter.PrintPackageLabel(command.SerialNumbers, command.ProductCode, command.WorkArea, 2); if (!error2.connectionsucceeded) { response.SetError(-1000, "Impossibile connettersi al servizio di stampa: " + error2.error); return(response); } else if (!string.IsNullOrEmpty(error2.error)) { response.SetError(-1000, "Errore di stampa etichetta imballo" + error2.error); return(response); } return(response); }
public Printer(Label label, LabelPrinter printerCapture) { _printerCapture = printerCapture; _labelFilePath = label.LabelPath; _placerMissing = System.Reflection.Missing.Value; _label = label; }
private void Init() { // Hide advanced panel. PrintGroupBox.Height -= AdvancedPanel.Height; CloseButton.Location = new Point(CloseButton.Location.X, CloseButton.Location.Y - AdvancedPanel.Height); this.Height -= AdvancedPanel.Height; // Define columns for bar code list view. BarCodeListView.Columns.Add("Registered bar codes", (BarCodeListView.Width / 2) - 12); BarCodeListView.Columns.Add(TEXT_COLUMN_NAME, (BarCodeListView.Width / 2) - 12); // Print bar code properties. BarCodeHeightComboBox.SelectedItem = "Tall"; BarCodeWidthComboBox.SelectedItem = "Narrow"; OffsetX.Value = LabelPrinter.GetDefaultBarCodeOffsetX(); OffsetY.Value = LabelPrinter.GetDefaultBarCodeOffsetY(); BarCodeTypeComboBox.SelectedIndex = 0; PrintModeComboBox.SelectedIndex = 0; PrintServerNameTextBox.Text = LabelPrinter.GetDefaultPrintServerName(); IGenericContainer container = null; container = ContainerManager.GetUncontainedContainer(); if (IsNotNull(container)) { BarCodeListView.BeginUpdate(); BarCodeListView.Items.Add(new BarCodeListViewItem(container)); BarCodeListView.EndUpdate(); } else { ShowWarning("Could not find the Uncontained object!"); } PrintButton.Enabled = IsNotEmpty(BarCodeListView.Items); }
public void PostScanHook(String ScanValue) { char[] delim = { '|' }; // NOTE: the main thread will // after scanning // Update the barcode in the ExoNetUT object TheController.SaveBarCodeValue(TopIndex, ScanValue); //Update the UI: Necessary to do this here. StatusLabelCombo LabelStatus = new StatusLabelCombo(); LabelStatus.LabelBox = ""; LabelStatus.Status = ""; UpdateUI(LabelStatus); // update the status and commitPersist(rundone.txt) of this EN to file LastLabel = TheController.GetLabel(TopIndex).Trim(delim); // print label at the end of commiting LabelPrinter.PrintLabel( LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[0], LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[1] ); LabelPrinter.PrintLabel( LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[0], LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[1] ); }
public void LabelPrinterConstructorTest1() { // Run to look for exceptions. LabelPrinter target = new LabelPrinter(); Assert.IsNotNull(target); }
private void btn_Connect_Click(object sender, EventArgs e) { try { LabelPrinter printer = new LabelPrinter(); int type = (int)comboBox1.SelectedValue; // Set COMM Properties( COMM only ) if (LabelConst.CLS_PORT_COM == type) { printer.SetCommProperties(LabelConst.CLS_COM_BAUDRATE_9600, LabelConst.CLS_COM_PARITY_NONE, LabelConst.CLS_COM_HANDSHAKE_DTRDSR); } int result = printer.Connect(type, txt_Address.Text); if (LabelConst.CLS_SUCCESS == result) { btn_Connect.BackColor = Color.Green; printer.Disconnect(); } else { btn_Connect.BackColor = Color.Red; } } catch (Exception ex) { MessageBox.Show("异常:" + ex.ToString()); } }
public void GetPrintDataTest() { LabelPrinter target = new LabelPrinter(); string actual; actual = target.GetPrintData(); Assert.Inconclusive("GetPrintData():{0}", actual); }
private void btnPreview_Click(object sender, EventArgs e) { LabelPrinter printer = new LabelPrinter(); LabelDesign design = new LabelDesign(); this.DesignLabel(design); printer.Preview(design, LabelConst.CLS_PRT_RES_203, LabelConst.CLS_UNIT_INCH, 450, 600); }
public void GetPrintDataTest1() { LabelPrinter target = new LabelPrinter(); string actual; string barCodeText = "654321"; actual = target.GetPrintData(barCodeText); Assert.Inconclusive("GetPrintData({0}):{1}", barCodeText, actual); }
private void ClickedPrintAction(object _parameter) { // do the printing and then: Save the token TestIOToken = TheController.GetRunDate(); LabelPrinter.PrintLabel(TestIOToken, TestIOToken); BCScanObject.FireEnableEvent(PostScanHook); // update the message EnableEnterEvent("UpdtMsg", new PropertyChangedEventArgs("Click [Test Scanner] to Continue")); }
public void Register(NbtAuth auth, PrinterSetupData aprinter) { RegisterEventArgs e = new RegisterEventArgs(); try { NbtPublicClient NbtClient = _getClient(auth); LabelPrinter lblPrn = new LabelPrinter(); lblPrn.LpcName = aprinter.LPCname; lblPrn.Description = aprinter.Description; CswNbtLabelPrinterReg Ret; using (OperationContextScope Scope = new OperationContextScope(NbtClient.InnerChannel)) { WebOperationContext.Current.OutgoingRequest.Headers.Add("X-NBT-SessionId", auth.sessionId); Ret = NbtClient.LpcRegister(lblPrn); } if (Ret.Authentication.AuthenticationStatus == "NonExistentSession") { //the old session has timed out, and we need to authenticate again CswNbtWebServiceSessionCswNbtAuthReturn authAttempt = _Authenticate(auth, e, NbtClient); if (authAttempt.Authentication.AuthenticationStatus == "Authenticated") { Register(auth, aprinter); } }//if previous authentication timed out else if (Ret.Authentication.AuthenticationStatus == "Authenticated") { if (Ret.Status.Success) { e.printer.PrinterKey = Ret.PrinterKey; e.printer.Message = "Registered PrinterKey=" + e.printer.PrinterKey; e.printer.Succeeded = true; } else { e.printer.Message = "Printer \"" + aprinter.LPCname + "\" registration failed. "; e.printer.PrinterKey = string.Empty; if (Ret.Status.Errors.Length > 0) { e.printer.Message += Ret.Status.Errors[0].Message; } } if (OnRegisterLpc != null) { OnRegisterLpc(e); } } //else when authentication was successful } //try catch (Exception Error) { e.Message = "Printer registration failed. Please check server settings."; e.printer.Message = "Printer registration failed. Please check server settings."; } } // Register()
/// <summary> /// Generates labels and attaches appropriate scripts to print labels client side /// </summary> private void ProcessLabels() { LabelPrinter labelPrinter = new LabelPrinter(CurrentCheckInState, Request); labelPrinter.PrintNetworkLabels(); var script = labelPrinter.GetClientScript(); script += "setTimeout( function(){ __doPostBack( '" + btnDone.UniqueID + "', 'OnClick' ); },6000)"; ScriptManager.RegisterStartupScript(upContent, upContent.GetType(), "addLabelScript", script, true); }
public void BarCodeTextTest() { LabelPrinter target = new LabelPrinter(); string expected = "123456"; string actual; target.BarCodeText = expected; actual = target.BarCodeText; Assert.AreEqual(expected, actual); }
public void BarCodeTypeTest() { LabelPrinter target = new LabelPrinter(); BarCodeType expected = BarCodeType.Code128; BarCodeType actual; target.BarCodeType = expected; actual = target.BarCodeType; Assert.AreEqual(expected, actual); }
private void printLpnLabelButton_Click(object sender, EventArgs e) { var shipment = packlistContentsView.GetFocusedRow() as Shipment; if (shipment != null && Session.CurrentConfiguration.ShipmentAllocationInstance.PrintShipmentLabel) { LabelPrinter.PrintDellLpnLabel(shipment.LineItemIdentifier, shipment.PartNumber); } }
static void Main(string[] args) { while (true) { Console.WriteLine("1 - Serial"); Console.WriteLine("2 - Data"); Console.WriteLine("3 - Package"); Console.WriteLine("4 - Pallet"); string option = Console.ReadLine(); switch (option) { case "1": { Console.WriteLine("Insert Serial:"); var result = LabelPrinter.PrintSNLabel(new List <string>() { Console.ReadLine() }, "101110060", "100.DM1.D103", 3); Console.WriteLine($"Succeeded: {result.connectionsucceeded}, Error: {result.error}"); break; } case "2": { Console.WriteLine("Insert Serial:"); var result = LabelPrinter.PrintDataLabel(new List <string>() { Console.ReadLine() }, "101110060", "100.DM1.D103"); Console.WriteLine($"Succeeded: {result.connectionsucceeded}, Error: {result.error}"); break; } case "3": { Console.WriteLine("Insert Serial:"); var result = LabelPrinter.PrintPackageLabel(new List <string>() { Console.ReadLine() }, "101110060", "100.DM1.D103", 1); Console.WriteLine($"Succeeded: {result.connectionsucceeded}, Error: {result.error}"); break; } case "4": { var result = LabelPrinter.PrintPalletLabel(new List <string>() { }, "101110060", "100.DM1.D103"); Console.WriteLine($"Succeeded: {result.connectionsucceeded}, Error: {result.error}"); break; } } } }
public void LabelPrinterConstructorTest() { // Run to look for exceptions. BarCodeType barCodeType = BarCodeType.Code128; List <string> descriptiveTextLines = null; string barCodeText = string.Empty; LabelPrinter target = new LabelPrinter(barCodeType, descriptiveTextLines, barCodeText); Assert.IsNotNull(target); }
private void button2_Click(object sender, EventArgs e) { // Create an instance( LabelDesign class ) LabelDesign design = new LabelDesign(); // Text design.DrawTextPtrFont("Sample Print", LabelConst.CLS_LOCALE_JP, LabelConst.CLS_PRT_FNT_TRIUMVIRATE_B, LabelConst.CLS_RT_NORMAL, 1, 1, LabelConst.CLS_PRT_FNT_SIZE_24, 20, 300); // QRCode design.DrawQRCode("DrawQRCode", LabelConst.CLS_ENC_CDPG_IBM850, LabelConst.CLS_RT_NORMAL, 4, LabelConst.CLS_QRCODE_EC_LEVEL_H, 20, 220); // Rect(fill) design.FillRect(20, 150, 350, 40, LabelConst.CLS_SHADED_PTN_11); // BarCode design.DrawBarCode("0123456789", LabelConst.CLS_BCS_CODE128, LabelConst.CLS_RT_NORMAL, 3, 3, 30, 20, 70, LabelConst.CLS_BCS_TEXT_SHOW); // Create an instance( LabelPrinter class ) LabelPrinter printer = new LabelPrinter(); // Get Type int type = (int)comboBox1.SelectedValue; // Get Address String addr = txt_Address.Text; // Set COMM Properties( COMM only ) if (LabelConst.CLS_PORT_COM == type) { printer.SetCommProperties(LabelConst.CLS_COM_BAUDRATE_9600, LabelConst.CLS_COM_PARITY_NONE, LabelConst.CLS_COM_HANDSHAKE_DTRDSR); } int result = printer.Connect(type, addr); if (LabelConst.CLS_SUCCESS == result) { int printDarkness = printer.GetPrintDarkness(); if (LabelConst.CLS_PROPERTY_DEFAULT == printDarkness) { printer.SetPrintDarkness(10); } result = printer.Print(design, 0001);// if (LabelConst.CLS_SUCCESS != result) { MessageBox.Show("Print Error : " + result.ToString(), "Citizen_Label_sample", MessageBoxButtons.OK, MessageBoxIcon.Error); } printer.Disconnect(); } else { MessageBox.Show("Connect Error : " + result.ToString(), "Citizen_Label_sample", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public CswNbtLabelPrinterReg LpcRegister(LabelPrinter Request) { //delegate has to be static because you can't create an instance yet: you don't have resources until the delegate is actually called CswNbtLabelPrinterReg Ret = new CswNbtLabelPrinterReg(); var SvcDriver = new CswWebSvcDriver <CswNbtLabelPrinterReg, LabelPrinter>( CswWebSvcResourceInitializer: new CswWebSvcResourceInitializerNbt(_Context, null), ReturnObj: Ret, WebSvcMethodPtr: CswNbtWebServicePrintLabels.registerLpc, ParamObj: Request ); SvcDriver.run(); return(Ret); }
private void PauseAReprint(object Parameter) { //reprint last label here //get information about TopIndex and reprint the label char[] delim = { '|' }; LabelPrinter.PrintLabel( LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[0], LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[1] ); LabelPrinter.PrintLabel( LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[0], LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[1] ); }
public void DescriptiveTextLinesTest() { var lines = new List <string>(); lines.Add("a"); lines.Add("b"); var target = new LabelPrinter(BarCodeType.Code128, lines, "0099282"); List <string> expected = new List <string>(); List <string> actual; target.DescriptiveTextLines = expected; actual = target.DescriptiveTextLines; Assert.AreEqual(expected, actual); }
/// <summary> /// /// </summary> /// <returns></returns> private LabelPrinter GetLabelPrinter() { LabelPrinter labelPrinter = new LabelPrinter(); labelPrinter.Type = (LabelPrinterTypes)Enum.Parse(typeof(LabelPrinterTypes), Properties.Settings.Default.PrinterType); labelPrinter.Name = Properties.Settings.Default.PrinterName; if (labelPrinter.Type == LabelPrinterTypes.Dymo) { labelPrinter.TemplateFile = Properties.Settings.Default.LabelTemplateFile; } logger.DebugFormat("Retrieving label printer: Name=[{0}]", labelPrinter.Name); return(labelPrinter); }
void ShippingSession_ItemShipped(ShippingSession obj) { IShipmentAllocation allocationMethod = CurrentConfiguration.ShipmentAllocationInstance; if (allocationMethod.PrintShipmentLabel) { //TODO: EWWWWWWWWW. Clean this junk up string lpn = allocationMethod.ShipmentLabelValues[0].ToString(); string partNumber = allocationMethod.ShipmentLabelValues[1].ToString(); LabelPrinter.PrintDellLpnLabel(lpn, partNumber); } if (CurrentConfiguration.ShipmentAllocationInstance.AutoAllocateItems) { ChangeOrder(null); } }
private void PrintLabels(IList <QLabel> labels) { PageSetupDialog pageDialog1 = new PageSetupDialog(); LabelPrinter labelPrinter = new LabelPrinter(labels, "QuickLabel document"); pageDialog1.Document = labelPrinter; //eventueel standaard printer instellen bool printerAndPaperSelected = PrinterHelper.HandlePrinterAndPaperSettings(pageDialog1, labelPrinter, config.Printer); printDialog1.Document = labelPrinter; printDialog1.Document.DefaultPageSettings.Landscape = config.Printer.Landscape; printDialog1.AllowSelection = false; printDialog1.AllowSomePages = false; PrinterHelper.PrintWithOrWithoutDialog(config.Printer, printerAndPaperSelected, labelPrinter, printDialog1); }
private PrintSNLabel.Response PrintSNLabelHandler(PrintSNLabel command) { var response = new PrintSNLabel.Response(); var error = LabelPrinter.PrintSNLabel(command.SerialNumbers, command.ProductCode, command.WorkArea); if (error.connectionsucceeded) { if (!string.IsNullOrEmpty(error.error)) { response.SetError(-1000, "Errore di stampa etichetta seriale: " + error.error); } } else { response.SetError(-1000, "Impossibile connettersi al servizio di stampa: " + error.error); } return(response); }
/// <summary> /// Print a list of jobs. Could be one, could be a bunch. /// </summary> /// <param name="jobs">Jobs to be printed.</param> private void PrintJobs(List <Job> jobs) { const string tag = ClassName + "PrintJobs:"; try { string printerName = ViewModel.PrinterViewModel.SelectedPrinter; foreach (Job j in jobs) { for (int copy = 1; copy <= ViewModel.PrinterViewModel.NumberOfCopies; ++copy) { string rawBytes = LabelPrinter.GetPrintData(j.BarCodeType, j.DescriptiveTextLines, j.BarCodeText); RawPrinterHelper.SendStringToPrinter(printerName, rawBytes); string logEntry = string.Format( tag + "Copy={9}, " + "BatchDate={4}, BarCodeText={2}, SerialNumber={8}, AssetId={0}, AssetType={1}, " + "BarCodeType={3}" + "DescriptiveTextLines[0]={5}, DescriptiveTextLines[1]={6}, DescriptiveTextLines[2]={7}", j.AssetId, j.AssetType, j.BarCodeText, j.BarCodeType, j.BatchDate, (j.DescriptiveTextLines.Count > 0) ? j.DescriptiveTextLines[0] : string.Empty, (j.DescriptiveTextLines.Count > 1) ? j.DescriptiveTextLines[1] : string.Empty, (j.DescriptiveTextLines.Count > 2) ? j.DescriptiveTextLines[2] : string.Empty, j.SerialNumber, copy); Trace.WriteLine(logEntry); } } } catch (Exception ex) { HandlePrintError(ex); } }
public void GetPrintDataTest2() { var target = new LabelPrinter(); BarCodeType barCodeType = BarCodeType.Code128; List <string> descriptiveTextLines = new List <string>(); descriptiveTextLines.Add("aaaaa"); descriptiveTextLines.Add("bbbbb"); descriptiveTextLines.Add("ccccc"); string barCodeText = "123456"; string actual; actual = target.GetPrintData(barCodeType, descriptiveTextLines, barCodeText); Assert.Inconclusive( "GetPrintData({0}, {1}, {2})\n{3}", barCodeType, descriptiveTextLines, barCodeText, actual); }
private void PrinterErrorProc(LabelPrinter printer, eErrorKind eError, int iErrCode, String sMsg) { String sTmpMsg = ""; if (eError == eErrorKind.eErrConnect) { MessageBox.Show("Connect failure: " + iErrCode.ToString(), "Error"); } else if (eError == eErrorKind.eErrPrinterCheck) { MessageBox.Show("PrinterCheck failure: " + iErrCode.ToString(), "Error"); } else if (eError == eErrorKind.eErrPrint) { MessageBox.Show("Print failure: " + iErrCode.ToString(), "Error"); } else if (eError == eErrorKind.eErrPrinterStatus) { sTmpMsg = "The printer can not print.\r\n" + sMsg; MessageBox.Show(sTmpMsg, "Printer Error"); } }
private void btnFind_Click(object sender, EventArgs e) { int type = 0; int result = 0; LabelPrinter printer = new LabelPrinter(); lstPrinters.Items.Clear(); type = (int)connectType.SelectedValue; CitizenPrinterInfo[] info; info = printer.SearchCitizenPrinter(type, 10, out result); if (result != LabelConst.CLS_SUCCESS) { if (result == LabelConst.CLS_E_NO_LIST) { MessageBox.Show("Printer Not Found", "Warning"); } else { MessageBox.Show("Searching Failed", "Error"); } return; } for (int i = 0; i < info.Length; i++) { string[] CLS = new string[2]; CLS[0] = info[i].deviceName; CLS[1] = info[i].printerModel; lstPrinters.Items.Add(new ListViewItem(CLS)); } lstPrinters.Focus(); lstPrinters.Items[0].Selected = true; }
private void CheckPrinterStatus(LabelPrinter printer, ref int error, ref String message) { int iStatus = 0; { message += "Printer Status\r\n"; iStatus = printer.GetCommandInterpreterInAction(); message += " " + iStatus.ToString() + ": Command interpreter in action" + "\r\n"; error += iStatus; iStatus = printer.GetPaperError(); message += " " + iStatus.ToString() + ": Paper error" + "\r\n"; error += iStatus; iStatus = printer.GetRibbonEnd(); message += " " + iStatus.ToString() + ": Ribbon end" + "\r\n"; error += iStatus; iStatus = printer.GetBatchProcessing(); message += " " + iStatus.ToString() + ": Batch processing" + "\r\n"; error += iStatus; iStatus = printer.GetPrinting(); message += " " + iStatus.ToString() + ": Printing" + "\r\n"; error += iStatus; iStatus = printer.GetPause(); message += " " + iStatus.ToString() + ": Pause" + "\r\n"; error += iStatus; iStatus = printer.GetWaitingForPeeling(); message += " " + iStatus.ToString() + ": Waiting for peeling" + "\r\n"; error += iStatus; } }