Example #1
0
        public FileService()
        {
            this.InitiateDirectories();

            this.watcher          = new FileSystemWatcher(this.inDir);
            this.watcher.Created += this.Watcher_Created;
            this.workThread       = new Thread(this.WorkProcedure);
            this.stopWork         = new ManualResetEvent(false);
            this.newFileEvent     = new AutoResetEvent(false);

            this.pdfCreator = new PdfCreator();

            this.pdfCreator.CallbackWhenReadyToSave += this.SavePdfDocument;
            this.pdfCreator.CallbackWhenSecuenceHasWrongFileExtention += this.MoveAllFileSequenceToOtherDir;
        }
        public FileService()
        {
            this.InitiateDirectories();

            this.watcher          = new FileSystemWatcher(this.inDir);
            this.watcher.Created += this.Watcher_Created;
            this.workThread       = new Thread(this.WorkProcedure);
            this.stopWork         = new ManualResetEvent(false);
            this.newFileEvent     = new AutoResetEvent(false);

            IProxyGenerator generator = Ioc.GetInstance <IProxyGenerator>();

            this.pdfCreator = generator.CreateClassProxyWithTarget(Ioc.GetInstance <PdfCreator>(), Ioc.GetInstance <IInterceptor>());

            this.pdfCreator.CallbackWhenReadyToSave += this.SavePdfDocument;
            this.pdfCreator.CallbackWhenSecuenceHasWrongFileExtention += this.MoveAllFileSequenceToOtherDir;
        }
        public FileService(string inDir, string outDir, string outWrongFileNamingDir, string invalidFileSequenceDir)
        {
            this.inDir  = inDir;
            this.outDir = outDir;
            this.outWrongFileNamingDir  = outWrongFileNamingDir;
            this.invalidFileSequenceDir = invalidFileSequenceDir;

            this.InitializeWorkFolder(inDir, outDir, outWrongFileNamingDir, invalidFileSequenceDir);

            this.watcher          = new FileSystemWatcher(this.inDir);
            this.watcher.Created += this.Watcher_Created;
            this.workThread       = new Thread(this.WorkProcedure);
            this.stateThread      = new Thread(this.StatusNotifierProcedure);
            this.stopWork         = new ManualResetEvent(false);
            this.newFileEvent     = new AutoResetEvent(false);
            this.pdfCreator       = new PdfCreator();

            this.pdfCreator.CallbackWhenReadyToSendToQueue            += this.SendPdfDocument;
            this.pdfCreator.CallbackWhenSecuenceHasWrongFileExtention += this.MoveAllFileSequenceToOtherDir;

            this.barcodeSeparator = ConfigurationManager.AppSettings["barcode"];
            this.timeout          = ConfigurationManager.AppSettings["timeout"];
        }
        public FileService(string inDir, string outDir, string outWrongFileNamingDir, string invalidFileSequenceDir)
        {
            this.inDir  = inDir;
            this.outDir = outDir;
            this.outWrongFileNamingDir  = outWrongFileNamingDir;
            this.invalidFileSequenceDir = invalidFileSequenceDir;

            if (!Directory.Exists(this.inDir))
            {
                Directory.CreateDirectory(this.inDir);
            }

            if (!Directory.Exists(this.outDir))
            {
                Directory.CreateDirectory(this.outDir);
            }

            if (!Directory.Exists(this.outWrongFileNamingDir))
            {
                Directory.CreateDirectory(this.outWrongFileNamingDir);
            }

            if (!Directory.Exists(this.invalidFileSequenceDir))
            {
                Directory.CreateDirectory(this.invalidFileSequenceDir);
            }

            this.watcher          = new FileSystemWatcher(this.inDir);
            this.watcher.Created += this.Watcher_Created;
            this.workThread       = new Thread(this.WorkProcedure);
            this.stopWork         = new ManualResetEvent(false);
            this.newFileEvent     = new AutoResetEvent(false);
            this.pdfCreator       = new PdfCreator();

            this.pdfCreator.CallbackWhenReadyToSave += this.SavePdfDocument;
            this.pdfCreator.CallbackWhenSecuenceHasWrongFileExtention += this.MoveAllFileSequenceToOtherDir;
        }