#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim FTP As FTP
Dim my As Catling
Public cc As ContentChooser
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
FTP.Initialize("FTP", "tt.host22.com", 21, "a7369129", "Calix841124")
cc.Initialize("ChangeControlImage")
cc.Show("image/*","Please choose an image") '開啟視窗選擇圖片
'FTP.DownloadFile("/somefolder/files/1.zip", False, File.DirRootExternal, "1.zip")
End Sub
Sub ChangeControlImage_Result(Success As Boolean, Dir As String, FileName As String)
If Success <> True Then
ToastMessageShow("No Image Selected",False)
Return
End If
Dim Fullpath As String = my.GetPathFromContentResult(FileName) 'FullPath = 路徑 + 文件名
FileName = Fullpath.SubString(Fullpath.LastIndexOf("/") + 1) ' FileName = 文件名
Log(Fullpath)
Log(FileName)
FTP.UploadFile("",Fullpath,True, FileName)
'FTP.UploadFile("/home/a7369129/public_html","",Fullpath)
'If SubExists(Me,Subv) Then CallSub3(Me,Subv,Fullpath,FileName)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub FTP_DownloadProgress (ServerPath As String, TotalDownloaded As Long, Total As Long)
Dim s As String
s = "Downloaded " & Round(TotalDownloaded / 1000) & "KB"
If Total > 0 Then s = s & " out of " & Round(Total / 1000) & "KB"
Log(s)
End Sub
Sub FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
Log(ServerPath & ", Success=" & Success)
If Success = False Then Log(LastException.Message)
End Sub
Sub FTP_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 FTP_UploadCompleted (ServerPath As String, Success As Boolean)
Log(ServerPath & ", Success=" & Success)
If Success = False Then Log(LastException.Message)
End Sub