experiments for the new client
This commit is contained in:
@@ -378,15 +378,16 @@ receipt.Gangs[0].Dishes.Add(new Dish(1, "Salmon Taco")
|
||||
|
||||
var serializedReceipt = JsonSerializer.Serialize(receipt, new JsonSerializerOptions { WriteIndented = true });
|
||||
var deserializedReceipt = JsonSerializer.Deserialize<KitchenReceipt>(serializedReceipt);
|
||||
KitchenReceiptConverter converter = new KitchenReceiptConverter(bigLineWidth: 18, lineWidth: 33);
|
||||
KitchenReceiptConverter converter = new KitchenReceiptConverter(bigLineWidth: 12, lineWidth: 33);
|
||||
var printCommands = converter.ConvertToPrintCommands(deserializedReceipt);
|
||||
|
||||
Console.WriteLine("=== PRINT COMMANDS ===\n");
|
||||
//var printer = new HtmlPrinter(@".\test.html", paperWidth: 258);
|
||||
//await printer.ConnectAsync("");
|
||||
bool useDelay=true;
|
||||
var printer = new EpsonPrinter();
|
||||
await printer.ConnectAsync("127.0.0.1",8888);
|
||||
await Task.Delay(200);
|
||||
await printer.ConnectAsync("127.0.0.1", 8888);
|
||||
if (useDelay)await Task.Delay(200);
|
||||
await printer.FeedLinesAsync(1);
|
||||
await printer.SetCustomLineSpacing(22);
|
||||
foreach (var command in printCommands)
|
||||
@@ -397,25 +398,26 @@ foreach (var command in printCommands)
|
||||
if (command.IsRed) attributes += "[RED] ";
|
||||
|
||||
Console.WriteLine($"{attributes}{command.Text}");
|
||||
await printer.SetBiggerFontTM220(command.IsBig);
|
||||
|
||||
await printer.SetBiggerFontTM220(command.IsBig, command.IsTall, secondaryFont: false);
|
||||
|
||||
await Task.Delay(200);
|
||||
|
||||
|
||||
if (useDelay) await Task.Delay(200);
|
||||
|
||||
await printer.SetRedColor(command.IsRed);
|
||||
|
||||
await Task.Delay(200);
|
||||
if (useDelay) await Task.Delay(200);
|
||||
|
||||
await printer.SetEmphasized(command.IsBold);
|
||||
await Task.Delay(200);
|
||||
if (useDelay) await Task.Delay(200);
|
||||
|
||||
await printer.PrintTextAsync(command.Text + "\n");
|
||||
await Task.Delay(200);
|
||||
if (useDelay) await Task.Delay(200);
|
||||
|
||||
}
|
||||
|
||||
await printer.FeedLinesAsync(5);
|
||||
await Task.Delay(200*5);
|
||||
if (useDelay) await Task.Delay(200*5);
|
||||
await printer.CutAsync();
|
||||
|
||||
//await printer.SetDefaultLineSpacing();
|
||||
|
||||
Reference in New Issue
Block a user