fork(2) download
  1. public void SetResume(string printerName)
  2. {
  3. string query = string.Format("SELECT * from Win32_Printer WHERE Name LIKE '%{0}'", printerName);
  4. ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
  5. ManagementObjectCollection coll = searcher.Get();
  6.  
  7. foreach (ManagementObject printer in coll) { printer.InvokeMethod("Resume", null); }
  8. }
  9.  
  10. public void SetPause(string printerName)
  11. {
  12. string query = string.Format("SELECT * from Win32_Printer WHERE Name LIKE '%{0}'", printerName);
  13. ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
  14. ManagementObjectCollection coll = searcher.Get();
  15.  
  16. foreach (ManagementObject printer in coll) { printer.InvokeMethod("Pause", null); }
  17. }
  18.  
  19. public static StringCollection GetPrintersCollection()
  20. {
  21. StringCollection printerNameCollection = new StringCollection();
  22. string searchQuery = "SELECT * FROM Win32_Printer";
  23.  
  24. ManagementObjectSearcher searchPrinters = new ManagementObjectSearcher(searchQuery);
  25. ManagementObjectCollection printerCollection = searchPrinters.Get();
  26.  
  27. foreach (ManagementObject printer in printerCollection) {
  28. printerNameCollection.Add(printer.Properties["Name"].Value.ToString());
  29. }
  30.  
  31. return printerNameCollection;
  32. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(1,7): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', or `struct'
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty