EnumerateSubsetOfPrintQueues
    shows how to use the EnumeratedPrintQueueTypes enumeration to get a subset of available print queues
    这个Sample倒也简单,只有一个Main函数,讲的是EnumeratedPrintQueueTypes枚举,通过其两个值Local和Shared将本地和共享的打印机全都找出来。

        static void Main(string[] args)
        
WPF SDK研究 Printing (2) EnumerateSubsetOfPrintQueues_main函数_04{
            
// Specify that the list will contain only the print queues that are installed as local and are shared
            EnumeratedPrintQueueTypes[] enumerationFlags = WPF SDK研究 Printing (2) EnumerateSubsetOfPrintQueues_main函数_04{EnumeratedPrintQueueTypes.Local,
                                                            EnumeratedPrintQueueTypes.Shared}
;

            LocalPrintServer printServer 
= new LocalPrintServer();

            
//Use the enumerationFlags to filter out unwanted print queues
            PrintQueueCollection printQueuesOnLocalServer = printServer.GetPrintQueues(enumerationFlags);

            Console.WriteLine(
"These are your shared, local print queues:\n\n");

            
foreach (PrintQueue printer in printQueuesOnLocalServer)
            
WPF SDK研究 Printing (2) EnumerateSubsetOfPrintQueues_main函数_04{
                Console.WriteLine(
"\tThe shared printer " + printer.Name + " is located at " + printer.Location + "\n");
            }

            Console.WriteLine(
"Press enter to continue.");
            Console.ReadLine();
        }