public static void ThreadLoop()
        {
            Boolean fileExists = false; string filename;

            while (Thread.CurrentThread.IsAlive)
            {
                Thread.Sleep(Program.Products.execIntDelay);
                MainInterface ig = (MainInterface)Application.OpenForms["MainInterface"];

                ig.setRichTextBox("\nRecherche de nouveaux produits à envoyer", false, Parameters.productId);


                //Lecture répertoire  source pour rechercher les fichiers
                //Pour chaque fichier trouvé appeller WSProducts
                filename = FileUtilities.getNextFileFromFolder(Program.Products.source, Program.Products.archive);
                while (filename != null)
                {
                    WSProducts.createXMLFile(filename);
                    FileUtilities.moveFileToFolder(Program.Products.archive, filename);
                    filename = FileUtilities.getNextFileFromFolder(Program.Products.source, Program.Products.archive);
                }

                Thread.Sleep(Program.Products.execInterval);
            }
        }
Ejemplo n.º 2
0
        public static void initThread()
        {
            MainInterface ig = (MainInterface)Application.OpenForms["MainInterface"];

            threadProducts = new Thread(new ThreadStart(ThreadProducts.ThreadLoop));
            threadOffers   = new Thread(new ThreadStart(ThreadOffers.ThreadLoop));
            threadCommands = new Thread(new ThreadStart(ThreadCommands.ThreadLoop));
        }
        public static void ThreadLoop()
        {
            Boolean fileExists = false; string filename;

            while (Thread.CurrentThread.IsAlive)
            {
                Thread.Sleep(Program.Commands.execIntDelay);
                MainInterface ig = (MainInterface)Application.OpenForms["MainInterface"];
                ig.setRichTextBox("\nRecherche de nouvelles commandes à réceptionner", false, Parameters.commandId);

                //Lecture répertoire  source pour rechercher les fichiers
                //Pour chaque fichier trouvé appeller WSProducts
                //  filename = FileUtilities.getNextFileFromFolder(Program.Commands.source, Program.Commands.archive);
                //  while (filename != null)
                //  {
                WSCommands.initOdersWorkflow();
                // FileUtilities.moveFileToFolder(Program.Commands.archive, filename);
                // filename = FileUtilities.getNextFileFromFolder(Program.Commands.source, Program.Commands.archive);
                // }

                Thread.Sleep(Program.Commands.execInterval);
            }
        }