示例#1
0
 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);
     }
 }
示例#2
0
        /// <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");
            }
        }
示例#3
0
        /// <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);
        }
示例#4
0
        /// <summary>
        /// New job consturctor
        /// </summary>
        /// <param name="document"></param>
        /// <param name="file"></param>
        /// <param name="location"></param>
        /// <param name="type"></param>
        public Job(
            string document,
            string file,
            int location,
            string type,
            bool autoprinted,
            int register
            )
        {
            this.document    = document;
            this.file        = file;
            this.type        = type;
            this.location    = location;
            this.autoprinted = autoprinted;
            this.register    = register;

            init();

            // Generate local file path with partial random name
            this.fileName      = Path.GetFileName(this.url.LocalPath);
            this.localFileName = tools.randomFileName() + "_" + fileName;
            this.documentTitle = DocumentTypes.toTitle(document);
            this.localFilePath = Path.Combine(Program.tempDnDir, this.localFileName);
        }
示例#5
0
 /// <summary>
 /// Intialization of printers static class
 /// </summary>
 public static void init()
 {
     DocumentTypes.init();
 }