/// <summary> /// Determines if the print job is rendered on the client or on the server. /// </summary> /// <param name="queues">The list of queues.</param> /// <returns> /// <c>true</c> if Render Print Jobs on Client is set for the specified queue name; otherwise, <c>false</c>. /// </returns> /// <exception cref="System.ArgumentNullException">queues</exception> public SerializableDictionary <string, string> GetJobRenderLocation(Collection <string> queues) { if (queues == null) { throw new ArgumentNullException("queues"); } SerializableDictionary <string, string> values = new SerializableDictionary <string, string>(); foreach (string queueName in queues) { PrintQueue queue = PrintQueueController.GetPrintQueue(queueName); var location = PrintQueueController.GetJobRenderLocation(queue); values.Add(queueName, location.ToString()); TraceFactory.Logger.Debug("Render On Client {0}:{1}".FormatWith(queueName, location)); } return(values); }
private MonitoredQueueInfoCache GetQueueInfo(string queueName) { MonitoredQueueInfoCache cachedInfo = null; try { //Try to retrieve from the cache if (!_cache.TryGetValue(queueName, out cachedInfo)) { cachedInfo = new MonitoredQueueInfoCache(queueName) { PrintServer = Environment.MachineName, PrintServerOS = Environment.OSVersion.ToString() }; _cache.Add(queueName, cachedInfo); } // Refresh queue data if older than 5 minutes if (cachedInfo.QueueSettingsRetrieved < DateTime.Now.AddMinutes(-5)) { PrintQueue queue = PrintQueueController.GetPrintQueue(queueName); cachedInfo.Refresh(queue); PrintJobRenderLocation location = PrintQueueController.GetJobRenderLocation(queue); if (location != PrintJobRenderLocation.Unknown) { cachedInfo.RenderOnClient = (location == PrintJobRenderLocation.Client); } else { cachedInfo.RenderOnClient = null; } cachedInfo.QueueSettingsRetrieved = DateTime.Now; } } catch (Win32Exception ex) { TraceFactory.Logger.Error("Unable to get queue data for {0}".FormatWith(queueName), ex); } return(cachedInfo); }