public async Task AddTaskAsync(AddTaskOptions options)
 {
     await this.Service.AddTaskAsync(options);
 }
 /// <summary>
 /// Adds a task.
 /// </summary>
 /// <param name="options">The options describing the task to add.</param>
 /// <returns></returns>
 public async Task AddTaskAsync(AddTaskOptions options)
 {
     CloudTask unboundTask = new CloudTask(options.TaskId, options.CommandLine);
     if (options.IsMultiInstanceTask)
     {
         unboundTask.MultiInstanceSettings = new MultiInstanceSettings(options.InstanceNumber);
         unboundTask.MultiInstanceSettings.CoordinationCommandLine = options.BackgroundCommand;
         unboundTask.MultiInstanceSettings.CommonResourceFiles = options.CommonResourceFiles.ConvertAll(f => new ResourceFile(f.BlobSource, f.FilePath));
     }
     unboundTask.RunElevated = options.RunElevated;
     unboundTask.Constraints = new TaskConstraints(null, null, options.MaxTaskRetryCount);
     unboundTask.ResourceFiles = options.ResourceFiles.ConvertAll(f => new ResourceFile(f.BlobSource, f.FilePath));
     await this.Client.JobOperations.AddTaskAsync(options.JobId, unboundTask);
 }
 /// <summary>
 /// Adds a task.
 /// </summary>
 /// <param name="options">The options describing the task to add.</param>
 /// <returns></returns>
 public async Task AddTaskAsync(AddTaskOptions options)
 {
     CloudTask unboundTask = new CloudTask(options.TaskId, options.CommandLine);
     await this.Client.JobOperations.AddTaskAsync(options.JobId, unboundTask);
 }
        private async Task AddTaskAsync()
        {
            try
            {
                if (this.IsInputValid())
                {
                    AddTaskOptions options = new AddTaskOptions()
                    {
                        WorkItemName = this.workItemName,
                        JobName = this.jobName,
                        CommandLine = this.CommandLine,
                        TaskName = this.TaskName
                    };

                    await this.batchService.AddTask(options);

                    Messenger.Default.Send(new GenericDialogMessage(string.Format("Successfully added Task {0}", this.TaskName)));
                    this.TaskName = string.Empty; //So that the user cannot accidentally try to create the same task twice
                }
            }
            catch (Exception e)
            {
                Messenger.Default.Send<GenericDialogMessage>(new GenericDialogMessage(e.ToString()));
            }
        }
        private async Task AddTaskAsync()
        {
            try
            {
                if (this.IsInputValid())
                {
                    AddTaskOptions options = new AddTaskOptions()
                    {
                        JobId = this.jobId,
                        CommandLine = this.CommandLine,
                        TaskId = this.TaskId,
                        ResourceFiles = ResourceFileStringParser.Parse(this.ResourceFiles).Files.ToList(),
                    };

                    await this.batchService.AddTaskAsync(options);

                    Messenger.Default.Send(new GenericDialogMessage(string.Format("Successfully added Task {0}", this.TaskId)));
                    this.TaskId = string.Empty; //So that the user cannot accidentally try to create the same task twice
                }
            }
            catch (Exception e)
            {
                Messenger.Default.Send<GenericDialogMessage>(new GenericDialogMessage(e.ToString()));
            }
        }
        private async Task AddTaskAsync()
        {
            try
            {
                if (this.IsInputValid())
                {
                    AddTaskOptions options = new AddTaskOptions()
                    {
                        JobId = this.jobId,
                        CommandLine = this.CommandLine,
                        TaskId = this.TaskId,
                        IsMultiInstanceTask = this.IsMultiInstanceTask,
                        ResourceFiles = ResourceFileStringParser.Parse(this.ResourceFiles).Files.ToList(),
                        RunElevated = this.RunElevated
                    };

                    if (this.IsMultiInstanceTask)
                    {
                        options.BackgroundCommand = this.BackgroundCommand;
                        options.InstanceNumber = Int32.Parse(this.InstanceNumber);
                        options.CommonResourceFiles = ResourceFileStringParser.Parse(this.commonResourceFiles).Files.ToList();
                    }

                    await this.batchService.AddTaskAsync(options);

                    Messenger.Default.Send(new GenericDialogMessage(string.Format("Successfully added Task {0}", this.TaskId)));
                    this.TaskId = string.Empty; //So that the user cannot accidentally try to create the same task twice
                }
            }
            catch (Exception e)
            {
                Messenger.Default.Send<GenericDialogMessage>(new GenericDialogMessage(e.ToString()));
            }
        }
 /// <summary>
 /// Adds a task.
 /// </summary>
 /// <param name="options">The options describing the task to add.</param>
 /// <returns></returns>
 public async Task AddTaskAsync(AddTaskOptions options)
 {
     CloudTask unboundTask = new CloudTask(options.TaskId, options.CommandLine);
     unboundTask.ResourceFiles = options.ResourceFiles.ConvertAll(f => new ResourceFile(f.BlobSource, f.FilePath));
     await this.Client.JobOperations.AddTaskAsync(options.JobId, unboundTask);
 }
 /// <summary>
 /// Adds a task.
 /// </summary>
 /// <param name="options">The options describing the task to add.</param>
 /// <returns></returns>
 public async Task AddTaskAsync(AddTaskOptions options)
 {
     using (IWorkItemManager workItemManager = this.Client.OpenWorkItemManager())
     {
         ICloudTask unboundTask = new CloudTask(options.TaskName, options.CommandLine);
         await workItemManager.AddTaskAsync(options.WorkItemName, options.JobName, unboundTask);
     }
 }