Home Forums .NET libraries Xceed SFTP/FTP for .NET Show notification after ReceiveFile

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

    Hello,

    I am trying to display a form after a complete BeginReceiveMultipleFiles operation.

    This is my code

    FrmInfo oFrmInfo = new FrmInfo();
    oFrmInfo.Show();

    I am trying with a thread :
    System.Threading.Thread oThread = new System.Threading.Thread(new System.Threading.ThreadStart(AfficheNotification),0);
    oThread.Start();

    void AfficheNotification()
    {
    FrmInfo oFrmInfo = new FrmInfo();
    oFrmInfo.Show();
    }

    the problem is the FrmInfo appear but instantly disepear (whit the thread) or the application bug an the FrmInfo is not display (without thread).

    If I add a messagebox.SHow in the onLoad function of FrmInfo, I can see the messagebox but when I click on “Ok” the form diseapear.

    In the form frmInfo, I have a label with a sample text, when I can see the frmInfo, I can’t see the label.

    Sorry for my poor english, I hope you can help me

    Regards

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by seb.49 (had 3104 views)

    User (Old forums)
    Member
    Post count: 23064

    I’m not totally sure I understand what you are trying to do.

    Normally, if you want to show the use a notification after receiving files, you do it in the callback you provide to the BeginReceiveMultipleFiles method.

    In that callback, you can show a modal form, which will of course close when the user clicks OK.

    e.g. :
    <code>
    asyncFtpClient.BeginReceiveMultipleFiles(
    filesToRetreive,
    localFolder,
    true,
    true,
    new AsyncCallback( ReceiveMultipleFilesCompleted ),
    null );

    private void ReceiveMultipleFilesCompleted( IAsyncResult asyncResult )
    {
    try
    {
    asyncFtpClient.EndReceiveMultipleFiles( asyncResult );
    MessageBox.Show( “Files received” );
    }
    catch( Exception ex )
    {
    MessageBox.Show( ex.ToString() );
    }
    }
    </code>

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by André (had 300 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks for your help,

    Your issue is’t fine in my situation.

    I solve y problem with create callback function for lots of object call

    eg :

    delegate void ShowNotificationCallBack();
    private void ShowNotification()
    {
    if (InvokeRequired)
    {
    ShowNotificationCallBack oShowNotificationCallBack = new ShowNotificationCallBack(ShowNotification);
    this.Invoke(oShowNotificationCallBack);
    }
    else
    {
    new frmNotification.Show();
    }
    }

    Sorry for my very poor english
    Regards.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by seb.49 (had 4143 views)

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