public void init() { this.url = new Uri(file); this.docType = DocumentTypes.ToDocumentType(this.document).type; if (printerName.Length > 0) { this.printer = Printers.fromName(this.printerName); } }
/// <summary> /// Convert document type string to human readable string /// </summary> /// <param name="str"></param> /// <returns></returns> public static string toTitle(string str) { DocumentType t = DocumentTypes.ToDocumentType(str); if (t != null) { return(t.title); } else { return("null"); } }
/// <summary> /// Find printers for this types and location /// </summary> /// <param name="type"></param> /// <param name="location"></param> /// <param name="register"></param> /// <returns></returns> public static List <Printer> findPrinters(string type, int location, int register) { log.Info(" Searching printers for document type '{0}', location '{1}', register '{2}'", type, location, register); List <Printer> l = new List <Printer>(); DocumentType t = DocumentTypes.ToDocumentType(type); if (t == null) { return(l); } // Check for empty locations array and empty location (0) if (Program.config.locations.Count > 0 & location != 0) { // If location not in array - return empty list if (!Program.config.locations.Contains(location)) { log.Info(" Printers for location '{0}' not found", location); return(l); } } // Search printer by type log.Info(" Searching printer by document type '{0}'", t.name); foreach (Printer printer in Program.config.printers) { if (printer.typeGet(t.type)) { if (printer.register == 0) { log.Info(" Printer selected '{0}' - printer register is 'None' ", printer.name); l.Add(printer); } else if (printer.register == register) { log.Info(" Printer selected '{0}' - printer register is '{0}' ", register); l.Add(printer); } } } return(l); }