/// <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(); }
/// <summary> /// Stop the distribution of task /// </summary> public void stopDistributing() { dataWork = null; }
/// <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(); }