Hi, i have a very simple UI App. A form with a button and a progress bar.
One requrement i have is that my xceed functions ( connect, upload, etc) have to be in a dirrefernt class ( ie i cant have functions at the same place as code for the form).
Code for my main form:
namespace
MagicFolderFTP
{
public partial class Form2 : Form
{
public Form2() {
InitializeComponent();
Xceed.Ftp.
Licenser.LicenseKey = "XXXX-XXXX-XXXX-XXXX";
}
private void btnUpload_Click(object sender, EventArgs e) {
FTPWrapper fw = new FTPWrapper();
fw.ftpServerIP =
"localhost";
fw.ftpUserID =
"anonymous";
fw.Upload(
@"D:\magicfolder\IE8ALapAround.wmv");
}
public void file_transfer(object sender, FileTransferStatusEventArgs e)
{
progressBar1.Value = e.AllBytesPercent;
} } }
code for FTP class
using
Xceed.Ftp;
using
Xceed.FileSystem;
namespace
MagicFolderFTP
{
class FTPWrapper
{
public string ftpServerIP;
public string ftpUserID;
public string ftpPassword;
public void Upload(string localPath)
{
AsyncFtpClient client = new AsyncFtpClient();
client.Connect(ftpServerIP);
//client.SynchronizingObject = ??????; <--- what do i need to put here?
client.Login();
//client.FileTransferStatus += new FileTransferStatusEventHandler(); < --- some how reference a method on a Form?
client.SendFile(localPath);
client.Disconnect();
} } }
Any help appreciated.