Esempio n. 1
0
 public void RunAction(ActionTask action, Action<ProgressReport> reportProgress)
 {
     string scriptPath =
         System.IO.Path.Combine(_agentSettingsManager.Settings.UnpackingLocation, action.ScriptPath);
     action.Log =
         PowershellHelper.ExecutePowerShellScript(scriptPath, _agentSettingsManager.Settings)
         .ToString();
 }
 private void StartAction(ActionTask action)
 {
     action.Task= new Task<ActionTaskResult>(() =>
     {
         ActionsService.RunAction(action,
             progressReport=>HandleProgressReport(action,progressReport));
         return new ActionTaskResult();
     });
     action.Task
         .ContinueWith(RemoveFromRunningActions)
         .ContinueWith(task => _logger.Error(action.Exception, "Action failed"),
                       TaskContinuationOptions.OnlyOnFaulted);
     action.Task.Start();
 }
 private void HandleProgressReport(ActionTask action, ProgressReport progressReport)
 {
     action.Log += progressReport.Message + "\r\n";
 }