I am trying to use the FTP for .NET component in my C# WPF project. I need the component to run Asynchronously, but, because the SynchronizingObject is a Windows Forms object, I have not been able to figure out how to accomplish this in WPF.
Is it possible use the built-in FTPClient BackgroundWorker in a WPF environment or will I need to set up threading manually?
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Robert (had 1301 views)
Unfortunately, there is no direct support for WPF’s Dispatcher for events in the component.
In your event handlers, you will have to call your WPF control methods with their Dispatcher.
Another option would be for you to write an implementation of the System.ComponentModel.ISynchronizeInvoke interface and assign an instance of your class to the FtpClient.SynchronizingObject property.
From what we can see in the component’s code, before firing an event, if SynchronizingObject is not null, it calls the ISynchronizeInvoke.InvokeRequired. If ‘true’, it calls the event handler using ISynchronizeInvoke.Invoke(). If ‘false’ it doesn’t use the ISynchronizeInvoke object and calls the event handler directly.
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Diane [Xceed] (had 1492 views)