/// <summary> /// Records a printer command for replay. We're only recording commands that have a line number /// associated with them. All other commands don't have a checksum associated and therefore can't be replayed. /// </summary> /// <param name="msg"></param> private void RecordPrinterCommand(PrinterCommand msg) { if (msg.LineNumber != null) { _lineNumber = msg.LineNumber.Value; _recordedCommands[msg.LineNumber.Value] = msg; } }
private void buttonOpenDrawer_Click(object sender, EventArgs e) { PrinterCommand.Send(Main.AssemblyProduct, Properties.Settings.Default.SettingsWsReceiptPrinter, Properties.Settings.Default.SettingsWsTicketOpenDrawer); if (Properties.Settings.Default.SettingsWsTicketOpenDrawerSendTwice) { PrinterCommand.Send(Main.AssemblyProduct, Properties.Settings.Default.SettingsWsReceiptPrinter, Properties.Settings.Default.SettingsWsTicketOpenDrawer); } }
private void buttonOpenDrawer_Click(object sender, EventArgs e) { //open drawer //if (PrinterCommand.Send(Properties.Settings.Default.SettingsWsReceiptPrinter, Properties.Settings.Default.SettingsWsTicketOpenDrawer)) // MessageBox.Show("Drawer opened!"); PrinterCommand.Send(Main.AssemblyProduct, Properties.Settings.Default.SettingsWsReceiptPrinter, Properties.Settings.Default.SettingsWsTicketOpenDrawer); if (Properties.Settings.Default.SettingsWsTicketOpenDrawerSendTwice) { PrinterCommand.Send(Main.AssemblyProduct, Properties.Settings.Default.SettingsWsReceiptPrinter, Properties.Settings.Default.SettingsWsTicketOpenDrawer); } }
/// <summary> /// Processes an incoming printer command /// </summary> /// <param name="msg">Message to process</param> private void ProcessIncomingCommand(PrinterCommand msg) { if (msg.LineNumber != null) { _flightRecorder.Tell(msg); } _transport.Tell(msg); _waitingForResponse = true; BecomeStacked(WaitingForResponse); }
public async override Task <bool> InvokeAsync(string paramList) { var index = 0; var templateFile = QueryParam <string>("Template File", GetParam(paramList, index++)); var dataFile = QueryParam <string>("Data File", GetParam(paramList, index++)); var debug = QueryParam("Debug", GetParam(paramList, index++), new List <KeyValuePair <bool, string> > { new KeyValuePair <bool, string>(true, "Yes"), new KeyValuePair <bool, string>(false, "No") }); var output = QueryParam("Output", GetParam(paramList, index++), new List <KeyValuePair <output, string> > { new KeyValuePair <output, string>(TestFileCommand.output.pdf, TestFileCommand.output.pdf.ToString()), new KeyValuePair <output, string>(TestFileCommand.output.printer, TestFileCommand.output.printer.ToString()) }); var xmdTemplate = new XmlDocument(); xmdTemplate.Load(templateFile); var template = Template.Load(xmdTemplate); var documentProperties = new DocumentProperties(); var xmdData = new XmlDocument(); xmdData.Load(dataFile); var documentData = DocumentData.Load(xmdData); switch (output) { case output.pdf: await PdfCommand.RenderPdfAsync(template, documentProperties, documentData, null, debug); break; case output.printer: await PrinterCommand.RenderPrinterAsync(template, documentProperties, documentData, null, debug); break; default: throw new ArgumentOutOfRangeException(string.Format("Unknown output {0}.", output)); } return(true); }
static extern bool SetPrinter(IntPtr hPrinter, int Level, IntPtr pPrinter, PrinterCommand Command);
private void buttonContinue_Click(object sender, EventArgs e) { //check data if (radioButtonCheckNumber.Checked) { //check number textBoxCheckNumber.Text = textBoxCheckNumber.Text.Trim(); if (!Funciones.ValidateText(textBoxCheckNumber, ref errorProvider1)) { textBoxCheckNumber.Focus(); return; } } else { ////check cashier is open //if (!Cashier.CheckCashier()) // return; if (!Funciones.ValidateText(comboBoxCashTray, ref errorProvider1)) { comboBoxCashTray.Focus(); return; } } //busy cursor this.Cursor = Cursors.WaitCursor; //update orders UpdateOrders(); ordersProcessed = true; buttonRePrint.Enabled = true; //printing is optional //if (!Main.Sol_ControlInfo.CashOutPrintingOverride) //{ // buttonRePrint.PerformClick(); //} //open drawer if (radioButtonCashTray.Checked) { //OpenDrawer(); PrinterCommand.Send(Main.AssemblyProduct, Properties.Settings.Default.SettingsWsReceiptPrinter, Properties.Settings.Default.SettingsWsTicketOpenDrawer); } buttonContinue.Text = "&Close"; this.buttonContinue.Click -= new System.EventHandler(this.buttonContinue_Click); this.buttonContinue.Click += new System.EventHandler(this.Cancel_Click); //buttonRePrint.Enabled = true; buttonReOpenDrawer.Enabled = radioButtonCashTray.Checked; Cancel.Enabled = false; this.Cursor = Cursors.Default; }
/// <summary> /// Handles incoming printer commands /// </summary> /// <param name="obj"></param> private void WriteData(PrinterCommand obj) { _port.WriteLine(obj.Serialize()); }
/// <summary> /// Initializes a new instance of <see cref="ResendCommand" /> /// </summary> /// <param name="command">Command to resend</param> public ResendCommand(PrinterCommand command) { Command = command; }
private void buttonContinue_Click(object sender, EventArgs e) { //check max amount if (Main.Sol_ControlInfo.CashierMaxAmount > 0.00m) { if (Main.Sol_ControlInfo.CashierMaxAmount < totalSelectedOrders) { if (!SolFunctions.PermisosConfirmar("The amount to pay is over the maximum allowed!", "Please provide password for Manager Override.", "")) { //MessageBox.Show("Sorry, you cannot void orders!"); return; } } } //busy cursor this.Cursor = Cursors.WaitCursor; if (BottleDrop && !SaveOrderToBottleDrop()) { return; } //update orders UpdateOrders(); ordersProcessed = true; //print receipt //if (!onAccount) ??? not sure if (!Main.Sol_ControlInfo.CashOutPrintingOverride && !BottleDrop) { string errorMessage = string.Empty; bool flag = SolFunctions.PrintReceipt(listView1, "", ref errorMessage, Properties.Settings.Default.BarcodeEncoding , buttonSource , securityCode , totalSelectedOrders ); if (!flag) { MessageBox.Show("There was a problem printing the receipt, please try again.\nError: " + errorMessage); } } //open drawer if (!onAccount) { //OpenDrawer(); PrinterCommand.Send(Main.AssemblyProduct, Properties.Settings.Default.SettingsWsReceiptPrinter, Properties.Settings.Default.SettingsWsTicketOpenDrawer); //coin dispenser if (AxCoinUSB2 != null) { //int iDecimalPart = (int)((totalPaidOrders - Math.Truncate(totalPaidOrders)) * 100); //int iIntegerPart = (int)(totalPaidOrders) * 100; //int iTotalPaidOrders = iIntegerPart+iDecimalPart; //Cajero_Automatico.Calculate("ca", totalPaidOrders, ref Main.billsAndCoinsByCountry); decimal totalCoins = 0; decimal totalBills = 0; Cajero_Automatico.Calculate( "CA", totalPaidOrders, //ref Main.billsAndCoinsByCountry, out totalCoins, out totalBills); int iCoins = (int)(totalCoins * 100); if (iCoins > 0) { bool flag = Properties.Settings.Default.CoinDispenserEnabled; if (flag) { switch (Properties.Settings.Default.CoinDispenserDevice) { case 0: // tflex coin dispenser decimal totalDiference = 0; // We call a subroutine to dispense it. DispenseByAmount(iCoins); //if (iCoins >= AxCoinUSB2.DispenseBelowValue) //{ // totalDiference = totalCoins; // decimal dispenseBelowValue = (decimal)(AxCoinUSB2.DispenseBelowValue)/100; // decimal amountDispensed = totalCoins - dispenseBelowValue; // totalCoins = amountDispensed; // totalDiference -= totalCoins; //} // Get our status and show the user UpdateCanisterStatus(true, iCoins, totalCoins, totalBills, totalDiference); utilDelay(1); break; default: MessageBox.Show("Invalid coin dispenser selection, please go to settings and fix this"); break; } } } else { // Show amount dispensed in the status bar UpdateStatus(String.Format("Total Bills:" + SirLib.Funciones.Indent(18) + "{0,9:$##,##0.00}\r\nTotal Coins dispensed:" + SirLib.Funciones.Indent(1) + "{1,9:$##,##0.00}", totalBills, totalCoins)); } } } buttonContinue.Text = "&Close"; this.buttonContinue.Click -= new System.EventHandler(this.buttonContinue_Click); this.buttonContinue.Click += new System.EventHandler(this.Cancel_Click); buttonContinue.BackColor = Color.FromArgb(241, 116, 85); buttonContinue.ForeColor = SystemColors.Control; if (!BottleDrop) { buttonRePrint.Enabled = true; buttonReOpenDrawer.Enabled = true; } //buttonViewReceipt.Enabled = false; Cancel.Visible = false; buttonSelectCustomer.Visible = false; this.Cursor = Cursors.Default; }