Sub Globals
'These global variables will be redeclared each time the activity is created.
Private btnEmail As Button
Private btnFacebook As Button
Private btnGoogle As Button
Private lblSignup As Label
Private ImageSlider1 As ImageSlider
Private MyList, MyList2, MyListBlob As List
Private lblFlag As Label
Private Idx As Int
Private btnNext As Button
Private btnPrev As Button
Private btnPlay As Button
Private LabelView As Label
Private ver As Boolean = False
Private edtPassword As EditText
Private Label2 As Label
Private ImageViewBlop As ImageView
' Private ArregloBlop As DBResult
End Sub
MyList=File.ListFiles(File.DirAssets)
For Each f As String In MyList
If f.EndsWith(".png") Or f.EndsWith(".jpg") Then
MyList2.Add(f)
End If
Next
ImageSlider1.WindowBase.Color=Colors.White
ImageSlider1.NumberOfImages = MyList2.Size
If FirstTime Then
timer1.Initialize("timer1", 2500)
End If
ImageSlider1.PrevImage
btnNext_Click
timer1.Enabled = Not(timer1.Enabled)
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("splashui")
MyList.Initialize
MyList2.Initialize
MyListBlob.Initialize
Wait For (GetLogoComercio) Complete (Answer As Boolean)
If Answer=True Then
End If
' GetImagesFromDir
MyList=File.ListFiles(File.DirAssets)
For Each f As String In MyList
If f.EndsWith(".png") Or f.EndsWith(".jpg") Then
MyList2.Add(f)
End If
Next
ImageSlider1.WindowBase.Color=Colors.White
ImageSlider1.NumberOfImages = MyList2.Size
If FirstTime Then
timer1.Initialize("timer1", 2500)
End If
ImageSlider1.PrevImage
btnNext_Click
timer1.Enabled = Not(timer1.Enabled)
End Sub
Sub ImageSlider1_GetImage (Index As Int) As ResumableSub
Idx=Index
Return xui.LoadBitmapResize(File.DirAssets,MyList2.Get(Index), _
ImageSlider1.WindowBase.Width/2, ImageSlider1.WindowBase.Height, True)
End Sub
Sub Timer1_Tick
btnNext_Click
End Sub
Private Sub btnNext_Click
ImageSlider1.NextImage
End Sub
'Method for recovering from database with blob SQL ...
Sub GetLogoComercio As ResumableSub
Dim respuesta As Boolean
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("Select_logo_comercios", Null)
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j, "req")
Wait For (req) req_Result(res As DBResult)
' 'work with result
req.PrintTable(res)
Log(res.Columns)
' ArregloBlop=res
'ListViewListTable.Clear
For Each row() As Object In res.Rows
Dim oBitMap As Bitmap
Dim buffer() As Byte
buffer = row(res.Columns.Get("LOGO"))
oBitMap = req.BytesToImage(buffer)
'ListViewListTable.AddTwoLinesAndBitmap(row(1) & CRLF & row(4), "See more...", oBitMap)
'ListViewListTable.AddTwoLinesAndBitmap(row(3), MyFormat(row(4)),oBitMap)
Log("name:" & row(0))
'preparamos para pasar a imagen
Dim InputStream1 As InputStream
InputStream1.InitializeFromBytesArray(buffer, 0, buffer.Length)
Dim Bmp As Bitmap
Bmp.Initialize2(InputStream1)
InputStream1.Close
ImageViewBlop.Bitmap=Bmp
'guardamos la imagen
Dim InStr As InputStream = InputStream1
Dim OutStr As OutputStream = File.OpenOutput(xui.defaultfolder,row(1)&".jpg",False)
File.Copy2(InStr,OutStr)
OutStr.Close
Next
respuesta = True
Else
respuesta = False
Log("ERROR: " & j.ErrorMessage)
End If
j.Release
Return respuesta
End Sub