Determine which method called the DoneEvent - WeOnlyDo Discussion board

Determine which method called the DoneEvent (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Chris Green, Thursday, March 16, 2006, 23:19 (6641 days ago)

I need to know how to determine which event called the done event.

I believe the connected and progress even both call done when complete. Do you have example of how to determine which method called the done event?

I need to do some work after a file has been uploaded.

Thank you,
Chris

Re: Determine which method called the DoneEvent

by wodDrazen, Friday, March 17, 2006, 01:35 (6641 days ago) @ Chris Green

Hi Chris,

Can you send us e-mail to techsupport@weonlydo.com and we can send you sample.
In sample you can find which method called Done Event.

Idea is you can set wodSFTP.Tag in place where you executed some method and than in Done Event you can check that Tag.

For Example:
Before executing PutFile Method:
Sftp1.Tag = putfile

In Done Event:
Debug.Print Sftp1.Tag

Hope I helped.

Regards,
Drazen

Re: Determine which method called the DoneEvent

by Chris Green, Friday, March 17, 2006, 01:49 (6641 days ago) @ wodDrazen

The example was very helpful...

Thank you.

This is how I used it.

private void sftp1_ProgressEvent(object Sender, WeOnlyDo.Client.SFTP.ProgressArgs Args)
{
try
{
sftp1.Tag = test ;
progressBar1.Minimum = 0;
progressBar1.Maximum = (int)Args.Length;
progressBar1.Value = (int)Args.Position;
int uploadedBytes = (int)Args.Position / 1024;
int fileSize = (int)Args.Length / 1024;

lblUploadSize.Text = Convert.ToString(uploadedBytes) + KB/ + Convert.ToString(fileSize) + Kb ;
}
catch (Exception)
{ }
}

private void sftp1_DoneEvent(object Sender, WeOnlyDo.Client.SFTP.DoneArgs Args)
{
this.Cursor = Cursors.Arrow;

if (sftp1.Tag == test )
{
lblUpComp.Text = This worked ;
}
if (Args.Error == null)
{
lblMsg.Text = listed ok ;
AddToList(
***DONE! Awaiting next command... );
}
else
{
lblMsg.Text = Args.Error.Message;
}
}

Is this an ok way to use? Would you forsee any problems with it in the furture?

Re: Determine which method called the DoneEvent

by wodSupport, Friday, March 17, 2006, 01:52 (6641 days ago) @ Chris Green

Looks ok to me. I wouldn't personally do it from Progress event, but this is just a matter of choice. Progress event is safe enough and will be fired.

Hmm.. What if file doesn't exist? Progress will not be fired. Are you prepared to handle that too?

Kreso