Exemplo n.º 1
0
        private void LoadPrintQueues(PrintQueueDefinitionCollection printQueueDefinitions)
        {
            _printQueues.Clear();

            foreach (LocalPrintQueueDefinition local in printQueueDefinitions.OfType <LocalPrintQueueDefinition>())
            {
                _printQueues.Add(new LocalPrintQueueInfo(local.QueueName, local.AssociatedAssetId));
            }
        }
        private void LoadPrintQueues(PrintQueueDefinitionCollection printQueueDefinitions)
        {
            _printQueues.Clear();

            foreach (LocalPrintQueueDefinition local in printQueueDefinitions.OfType <LocalPrintQueueDefinition>())
            {
                _printQueues.Add(new LocalPrintQueueInfo(local.QueueName, local.AssociatedAssetId));
            }

            var remotePrintQueues = ConfigurationServices.AssetInventory.GetRemotePrintQueues().ToList();

            foreach (RemotePrintQueueDefinition remote in printQueueDefinitions.OfType <RemotePrintQueueDefinition>())
            {
                var queue = remotePrintQueues.FirstOrDefault(n => n.PrintQueueId == remote.PrintQueueId);
                if (queue != null)
                {
                    _printQueues.Add(queue);
                }
            }
        }
Exemplo n.º 3
0
        private void LoadPrintQueues(PrintQueueDefinitionCollection printQueueDefinitions)
        {
            _printQueues.Clear();

            foreach (LocalPrintQueueDefinition local in printQueueDefinitions.OfType <LocalPrintQueueDefinition>())
            {
                _printQueues.Add(new LocalPrintQueueInfo(local.QueueName, local.AssociatedAssetId));
            }

            var remotePrintQueues = ConfigurationServices.AssetInventory.GetRemotePrintQueues().ToList();

            foreach (RemotePrintQueueDefinition remote in printQueueDefinitions.OfType <RemotePrintQueueDefinition>())
            {
                var queue = remotePrintQueues.FirstOrDefault(n => n.PrintQueueId == remote.PrintQueueId);
                if (queue != null)
                {
                    _printQueues.Add(queue);
                }
            }

            var dynamicQueueDefinitions = printQueueDefinitions.OfType <DynamicLocalPrintQueueDefinition>().ToList();

            if (dynamicQueueDefinitions.Any())
            {
                var printers = ConfigurationServices.AssetInventory.GetAssets(dynamicQueueDefinitions.Select(n => n.AssetId)).OfType <IPrinterInfo>().ToList();
                var drivers  = ConfigurationServices.AssetInventory.AsInternal().GetPrintDrivers().ToList();
                foreach (DynamicLocalPrintQueueDefinition definition in dynamicQueueDefinitions)
                {
                    IPrinterInfo    printer = printers.FirstOrDefault(n => n.AssetId == definition.AssetId);
                    PrintDriverInfo driver  = drivers.FirstOrDefault(n => n.PrintDriverId == definition.PrintDriverId);
                    if (printer != null && driver != null)
                    {
                        _printQueues.Add(new DynamicLocalPrintQueueInfo(printer, driver, definition.PrinterPort, definition.PrintDriverConfiguration));
                    }
                }
            }
        }