コード例 #1
0
        public static int ProcessFile(string name, string fullPath)
        {
            if (added2List(name, fullPath))
            {
                var item = fileList[name];
                //Console.WriteLine(String.Format("{0} added to list of {1}", name, TaskMgr.fileList.Count));

                PrintJobThread printJob = TroyPortMonService.setupPrintJob(fullPath);
                item.status = statusType.Processing;
                item.start  = DateTime.Now;
                lock (_lockObject)
                {
                    fileList[name] = item;
                }
                int result = doTask(printJob);
                lock (_lockObject)
                {
                    fileList.Remove(name);
                }

                //Console.WriteLine(String.Format("{0} removed from list of {1}", name, TaskMgr.fileList.Count));
                return(result);
            }
            else
            {
                return(1);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: jdemarchi1295/TSPE3
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
#if (!DEBUG)
            {
                ServiceBase[] ServicesToRun = new ServiceBase[]
                {
                    new TroyPortMonService()
                };
                ServiceBase.Run(ServicesToRun);
            }
#else
            TroyPortMonService service = new TroyPortMonService();
            service.StartService(args);
#endif
        }