c#: Backgroundworker and SessionFileTransferProgress
Hi guys,
I am trying to report the e.FileProgress and e.FileName of the SessionFileTransferProgress to my backgroundworker. How do I pass the backgroundworker to the function so that I can do:
within the SessionFileTransferProgress function like so:
bw is the backgroundworker object I would like to send to the function. This is based on this example:https://winscp.net/eng/docs/library_session_filetransferprogress#example. In other functions I pass the backgroundworker like so:
I am trying to report the e.FileProgress and e.FileName of the SessionFileTransferProgress to my backgroundworker. How do I pass the backgroundworker to the function so that I can do:
bw.ReportProgress(Convert.ToInt16(e.FileProgress*100), "Transmitting file: " + e.FileName);
private static void SessionFileTransferProgress(object sender, FileTransferProgressEventArgs e) { // Print transfer progress if (bolDebugMode) MessageBox.Show(e.FileName + " " + Convert.ToString(e.FileProgress)); bw.ReportProgress(Convert.ToInt16(e.FileProgress*100), "Transmitting file: " + e.FileName) // Remember a name of the last file reported strLastFileName = e.FileName; }
private static bool emptyRawBackupFolder(BackgroundWorker bwWorker) { bwWorker.ReportProgress(0, "Deleting files in RawBackupFolder"); // some code bwWorker.ReportProgress(100, fileList.Count() + " have been deleted"); }