Sub Process_Globals
End Sub
Sub Globals
Private SendParam As HttpJob
Private edtInput As EditText
Private txtShowResult As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("activity_main")
SendParam.Initialize("Translate",Me)
End Sub
Sub Activity_Resume
End Sub
Sub MyText(value As String,fromLan As String,toLan As String)
ProgressDialogShow("در حال ترجمه . . . ")
SendParam.Download2("http://api.mymemory.translated.net/get",Array As String("q",value,"langpair",fromLan&"|"&toLan))
Log("Send")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub JobDone(job As HttpJob)
Log("jobdone")
ProgressDialogHide
If job.Success Then
Log("success!")
If job.JobName = "Translate" Then
Log("Translate")
Private parser As JSONParser
parser.Initialize(job.GetString)
Private TranslateText As Map
TranslateText = parser.NextObject
TranslateText = TranslateText.Get("responseData")
txtShowResult.Text = TranslateText.Get("translatedText")
End If
Else
Msgbox(job.ErrorMessage,"")
End If
End Sub
Sub btnEnToFa_Click
MyText(edtInput.Text,"en","fa")
End Sub
Sub btnFaToEn_Click
MyText(edtInput.Text,"fa","en")
End Sub