Beispiel #1
0
 public void ExecuteOnServer()
 {
     switch (SelectedTask.Key)
     {
             case TaskType.Factorial:
             ParallelableTask = new Factorial();
             ParallelableTask.GetDataFromFile("factorial_input.txt");
             OutputString += "Выполнение задачи на сервере: Факториал" + '\n';
             ParallelableTask.ReadyEvent += ServerResultOutput;
             ParallelableTask.Execute();
             break;
     }
 }
Beispiel #2
0
 public void ExecuteOnClients()
 {
     switch (SelectedTask.Key)
     {
         case TaskType.Factorial:
             ParallelableTask = new Factorial();
             ParallelableTask.GetDataFromFile("factorial_input.txt");
             OutputString += "Выполнение задачи на клиентах: Факториал" + '\n';
             var data = ParallelableTask.GetDataForWorkers(_clientManagers.Count);
             int i = 0;
             foreach (var pack in data)
             {
                 var message =
                     FormMessage(MessageType.FromServerWithTask, pack.Value, TaskType.Factorial, i,
                         ClientManagers.Count);
                 ClientManagers[i].SendData(message);
                 i++;
             }
             break;
     }
 }