/// <summary>Creates a new upload or download transfer job.</summary> /// <param name="displayName">Name of the job.</param> /// <param name="description">Description of the job.</param> /// <param name="jobType">Type (upload or download) of the job.</param> /// <returns>The new <see cref="BackgroundCopyJob"/>.</returns> public BackgroundCopyJob Add(string displayName, string description = "", BackgroundCopyJobType jobType = BackgroundCopyJobType.Download) { try { var job = new BackgroundCopyJob(BackgroundCopyManager.CreateJob(displayName, (BG_JOB_TYPE)jobType)); if (!string.IsNullOrEmpty(description)) { job.Description = description; } return(job); } catch (COMException cex) { BackgroundCopyManager.HandleCOMException(cex); } return(null); }
public virtual extern void CreateJob([In, MarshalAs(UnmanagedType.LPWStr)] string DisplayName, [In, ComAliasName("BG_JOB_TYPE")] BackgroundCopyJobType Type, [ComAliasName("GUID")] out Guid pJobId, [MarshalAs(UnmanagedType.Interface)] out IBackgroundCopyJob ppJob);
/// <summary> /// Creates a new upload or download transfer job. /// </summary> /// <param name="displayName">Name of the job.</param> /// <param name="description">Description of t he job.</param> /// <param name="jobType">Type (upload or download) of the job.</param> /// <returns>The new <see cref="BackgroundCopyJob"/>.</returns> public static BackgroundCopyJob CreateJob(string displayName, string description, BackgroundCopyJobType jobType) { try { IBackgroundCopyJob newJob; Guid newJobID; mgr.CreateJob(displayName, jobType, out newJobID, out newJob); BackgroundCopyJob job = new BackgroundCopyJob(newJob); if (!string.IsNullOrEmpty(description)) { job.Description = description; } return(job); } catch (COMException cex) { HandleCOMException(cex); } return(null); }