示例#1
0
        private void HandleCOMException(COMException cex)
        {
            BackgroundCopyJobState state = BackgroundCopyJob.GetState(m_ijob);

            if (state == BackgroundCopyJobState.Error ||
                state == BackgroundCopyJobState.TransientError)
            {
                Interop.IBackgroundCopyError pErr;
                m_ijob.GetError(out pErr);
                throw new BackgroundCopyException(pErr);
            }
            else
            {
                throw new BackgroundCopyException(cex);
            }
        }
        /// <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);
        }
示例#3
0
 internal BackgroundCopyJobEventArgs(BackgroundCopyJob j)
 {
     Job = j;
 }
示例#4
0
 public Notifier(BackgroundCopyJob job)
 {
     parent = job;
 }