Exemple #1
0
        private IEnumerable <Printer> GetPrintersAsync(Job job)
        {
            var installedPrinters = _printerService.GetPrinters();

            return(installedPrinters
                   .Where(x => job.Document.Register.HasValue ? job.Document.Register == x.Register : true)
                   .Where(x => x.DocumentTypes.Any(d => d.DocumentType == job.Document.Type && d.Enabled && (job.Document.AutoPrint ? d.AutoPrint : true)))
                   .ToList());
        }
        private static void GetListPrinters()
        {
            System.Console.Clear();
            int i = 1;

            foreach (var item in service.GetPrinters())
            {
                System.Console.WriteLine($"{i++}: {item.Name} {item.Model} ");
            }

            System.Console.WriteLine($"{i}:To main menu");

            var key = System.Console.ReadKey();

            if (key.Key == ConsoleKey.D1)
            {
                CreatePrinter();
            }
        }