Topic "c#: Backgroundworker and SessionFileTransferProgress"

Author Message
RobSteward
[View user's profile]

Joined: 2016-12-15
Posts: 1
Location: London
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:
Code:
bw.ReportProgress(Convert.ToInt16(e.FileProgress*100), "Transmitting file: " + e.FileName);
within the SessionFileTransferProgress function like so:
Code:
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;
        }
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:
Code:
private static bool emptyRawBackupFolder(BackgroundWorker bwWorker)
        {
            bwWorker.ReportProgress(0, "Deleting files in RawBackupFolder");
            // some code
            bwWorker.ReportProgress(100, fileList.Count() + " have been deleted");
        }
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26150
Location: Prague, Czechia
Sorry, but this is a generic programming question. It has nothing to do with WinSCP. Ask at an appropriate site, like Stack Overflow. And you will need to provide more details about your code, as your current question is a way too broad.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License