Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim sftp1 As SFtp
Private Button1 As Button
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.SetFormStyle("DEFAULT")
MainForm.RootPane.LoadLayout("main") 'Load the layout file.
sftp1.Initialize("sftp1", "usr", "pswrd", "srvr", 22)
sftp1.SetKnownHostsStore(File.DirApp, "hosts.txt")
MainForm.Show
End Sub
Sub sftp1_PromptYesNo (Message As String)
Dim res As Int = fx.Msgbox2(MainForm,Message, "", "Yes", "", "No",Null)
'The next line might be a bit confusing. It is a condition.
'The value will be True if res equals to DialogResponse.POSITIVE.
sftp1.SetPromptResult(res = fx.DialogResponse.POSITIVE)
'sftp1.SetPromptResult(True)
End Sub
Sub sftp1_ShowMessage (Message As String)
fx.Msgbox(MainForm,Message, "")
End Sub
Sub sftp1_UploadProgress (ServerPath As String, TotalUploaded As Long, Total As Long)
Dim s As String
s = "Uploaded " & Round(TotalUploaded / 1000) & "KB"
If Total > 0 Then s = s & " out of " & Round(Total / 1000) & "KB"
Log(s)
End Sub
Sub sftp1_UploadCompleted (ServerPath As String, Success As Boolean)
Log(ServerPath & ", Success=" & Success)
If Success = False Then Log(LastException.Message)
End Sub
Sub Button1_Action
sftp1.UploadFile(File.DirAssets,"USL2.jpg","/home/iccca/USL2.jpg")
End Sub