Exemplo n.º 1
0
        public void JobCollTest()
        {
            var guid = Guid.Empty;

            BackgroundCopyJob job = null;


            Assert.That(() => { var j = BackgroundCopyManager.Jobs.Add(GetCurrentMethodName()); guid = j.ID; }, Throws.Nothing);

            Assert.That(BackgroundCopyManager.Jobs.Count, Is.GreaterThanOrEqualTo(1));

            Assert.That(BackgroundCopyManager.Jobs.Contains(guid), Is.True);

            Assert.That(() => job = BackgroundCopyManager.Jobs[guid], Throws.Nothing);

            Assert.That(job, Is.Not.Null);

            Assert.That(BackgroundCopyManager.Jobs.Count(j => j.ID == guid), Is.EqualTo(1));


            var array = new BackgroundCopyJob[BackgroundCopyManager.Jobs.Count];

            Assert.That(() => ((ICollection <BackgroundCopyJob>)BackgroundCopyManager.Jobs).CopyTo(array, 0), Throws.Nothing);

            Assert.That(array[0], Is.Not.Null);

            Assert.That(() => BackgroundCopyManager.Jobs.Remove(job), Throws.Nothing);

            Assert.That(BackgroundCopyManager.Jobs.Contains(guid), Is.False);
        }
Exemplo n.º 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         job                   = BackgroundCopyManager.CreateJob("Test", "Special");
         job.Error            += new System.IO.ErrorEventHandler(job_Error);
         job.Completed        += new BackgroundCopyJobEventHandler(job_Completed);
         job.Priority          = BackgroundCopyJobPriority.High;
         job.Proxy             = null;
         job.MinimumRetryDelay = 15;
         job.SetCredentials(new System.Net.NetworkCredential("username", "password"));
         job.Files.Add(new Uri("http://www.myfavoritedownloads.com/files/"), @"C:\Favorites", new string[] { "file1.jpb", "file2.mpg", "file3.pdf" });
         job.Files.Add("http://www.myfavoritedownloads.com/files/file4.zip", @"C:\Favorites\file4.zip");
         job.Resume();
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 3
0
 public BackgroundTransferProgress(FileTransferManager fileTransferManager, BackgroundCopyJob job)
 {
     _fileTransferManager = fileTransferManager;
     _job = job;
 }
Exemplo n.º 4
0
 internal UploadOperation(FileTransferManager fileTransferManager, BackgroundCopyJob job)
     : base(fileTransferManager, job)
 {
 }
Exemplo n.º 5
0
 private void button3_Click(object sender, EventArgs e)
 {
     job = BackgroundCopyManager.CreateJob("UploadTest", "Special", BackgroundCopyJobType.Upload);
     job.Files.Add("http://localhost", @"c:\bits.zip");
 }