Esempio n. 1
0
        private void doWork()
        {
            CuttingTask cuttingTask = new CuttingTask();
            ClassCalculator c = new ClassCalculator();
            Fractal f = new Fractal();
            byte[][] data = cuttingTask.CutTask(nbrPacket);

            for (int i = 0; i < data.Length; i++)
            {
                byte[] result = c.Calculate(data[i]);
                displayFractale1Computer(f.createFractale(i + 1, result, nbrPacket));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Start the distribution of the task
        /// </summary>
        public void initDistributedWork(bool savePacketsToFile)
        {
            this.savePacketsToFile = savePacketsToFile;
            if (issueNumber < int.MaxValue) //Max?
                issueNumber++;
            else
            {
                issueNumber = 0;
            }
            addIssueNumberToFile();
            /*Launch timer to display time remaining*/
            timer = new System.Windows.Forms.Timer();
            timer.Tick += new EventHandler(timer_Tick);
            timer.Interval = 1000;
            timer.Start();

            /*New scan of clients*/
            //startServer();
            //listClient.Clear();

            SortedList<string, Client> tmpListClient = new SortedList<string, Client>(listClient);
            foreach (string item in tmpListClient.Keys)
            {
                listClient[item].currentWork.Clear();
                listClient[item].interval = 7000;
            }

            RemoveFilesFromFolder.Remove(Environment.CurrentDirectory + "\\" + "tmp"); //Remove previous temporary data
            listResults.Clear();
            /*Create a task cut with class file*/
            Cutting cutting = new Cutting();
            cutting.LoadSource(File.ReadAllText(cuttingClass));
            /*Cut task on x packets*/
            cuttedTask = cutting.CuttingTask(nbrPacket);
            dataWork = new DataWork(cuttedTask);
            listClient = new SortedList<string, Client>(sendFirstWorkAllClient(listClient));
            fractale = new Fractal();
        }