private void bw_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; string sOrigin = @"C:\Temp\SC\origin\"; string sDest = @"C:\Temp\SC\dest\"; files = copyMoveMechanism.generateEntryByDir(sOrigin, sDest); /*foreach (scFile file in files.FileList) * { * lbToCopy.Items.Add(file.FromName); * }*/ //lbFileCopiedProgress.Text = files.getTotalSize() / 1024 + " Kb"; //DoCopy(); copyMoveMechanism.CopyFiles(files, (file, status, filesize, prog, total) => worker.ReportProgress((int)(100 * prog / total))); //for (int i = 1; (i <= 10); i++) //{ // if ((worker.CancellationPending == true)) // { // e.Cancel = true; // break; // } // else // { // // Perform a time consuming operation and report progress. // System.Threading.Thread.Sleep(500); // worker.ReportProgress((i * 10)); // } //} }
private void button4_Click(object sender, EventArgs e) { string sOrigin = @"C:\Temp\SC\origin\"; string sDest = @"C:\Temp\SC\dest\"; files = copyMoveMechanism.generateEntryByDir(sOrigin, sDest); //scListBox1.add(files); lbFileCopiedProgress.Text = files.getTotalSize() / 1024 + " Kb"; DoMove(); }
private void button1_Click(object sender, EventArgs e) { string sOrigin = @"C:\Temp\SC\origin\"; string sDest = @"C:\Temp\SC\dest\"; files = copyMoveMechanism.generateEntryByDir(sOrigin, sDest); foreach (scFile file in files.FileList) { lbToCopy.Items.Add(file.FromName); } lbFileCopiedProgress.Text = files.getTotalSize() / 1024 + " Kb"; DoCopy(); }
public void add(scFilesSystemEntries lfiFiles) { int yVal = 0; List <scFile> files = lfiFiles.FileList; foreach (scFile item in files) { scListItem myItem = new scListItem(item.FromName, item.FileSize / 1024 + " Kb"); myItem.Location = new Point(0, yVal); myItem.Width = this.Width - 22; //22 is for scrollbar width yVal += myItem.Height; this.pFiles.Controls.Add(myItem); } }
private void button3_Click(object sender, EventArgs e) { List <string> ls = new List <string>(); ls.Add(@"C:\Temp\SC\origin\logs pweb"); ls.Add(@"C:\Temp\SC\origin\a239.jpg"); ls.Add(@"C:\Temp\SC\origin\blank_europe_map.gif"); ls.Add(@"C:\Temp\SC\origin\file2.bin"); ls.Add(@"C:\Temp\SC\origin\fp"); string sDest = @"C:\Temp\SC\dest\"; files = copyMoveMechanism.generateEntryByList(ls, sDest); lbFileCopiedProgress.Text = files.getTotalSize() / 1024 + " Kb"; DoMove(); }