a
This commit is contained in:
43
ScanBox/Controller/NetworkDiscoveryHandler.cs
Normal file
43
ScanBox/Controller/NetworkDiscoveryHandler.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Zebra.Sdk.Printer.Discovery;
|
||||
|
||||
namespace ScaBox30
|
||||
{
|
||||
//CLASE ZEBRA PARA LA BUSQUEDA DE IMPRESORAS EN LA RED
|
||||
class NetworkDiscoveryHandler : DiscoveryHandler
|
||||
{
|
||||
|
||||
private bool discoveryComplete = false;
|
||||
public List<DiscoveredPrinter> printers = new List<DiscoveredPrinter>();
|
||||
|
||||
public void DiscoveryError(string message)
|
||||
{
|
||||
Console.WriteLine($"An error occurred during discovery: {message}.");
|
||||
discoveryComplete = true;
|
||||
}
|
||||
|
||||
public void DiscoveryFinished()
|
||||
{
|
||||
foreach (DiscoveredPrinter printer in printers)
|
||||
{
|
||||
Console.WriteLine(printer);
|
||||
}
|
||||
Console.WriteLine($"Discovered {printers.Count} Link-OS(TM) printers.");
|
||||
discoveryComplete = true;
|
||||
}
|
||||
|
||||
public void FoundPrinter(DiscoveredPrinter printer)
|
||||
{
|
||||
printers.Add(printer);
|
||||
}
|
||||
|
||||
public bool DiscoveryComplete
|
||||
{
|
||||
get => discoveryComplete;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user