Home Forums .NET libraries Xceed SFTP/FTP for .NET Using Async FTPClient (SynchronizingObject) in WPF

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #21327 |

    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? 

    Thanks. 

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Robert (had 1301 views)

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi Robert,

    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)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.