#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 SourceImageRect, TouchImageViewRect As Rect
Dim Bitmap1 As Bitmap
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.
Dim TouchImageView1 As TouchImageView
Dim SQLVariables2 As SQL
Dim CurVariables2 As Cursor
Dim SQueryVariables2 As String
Private PnlOrd As Panel
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")
Activity.LoadLayout("LytImagen")
If SQLVariables2.IsInitialized = False Then
SQLVariables2.Initialize(File.DirDefaultExternal, "l4pro.sql", False)
End If
SQueryVariables2 = "SELECT * FROM Variables"
CurVariables2 = SQLVariables2.ExecQuery(SQueryVariables2)
CurVariables2.Position = 0
Activity.Title = CurVariables2.GetString("TituloActivity")
TouchImageView1.Initialize("TouchImageView1")
Activity.AddView(TouchImageView1, 0, 0, 100%x, 100%y)
TouchImageView1.MinScale=0.5 ' default is 0.5
TouchImageView1.MaxScale=6 ' default is 1.5
TouchImageView1.TranslatePadding=128dip ' default is 64dip
TouchImageView1.Gravity=Gravity.FILL
'TouchImageView1.SetBackgroundImage(LoadBitmap(File.DirAssets,"fondo.png"))
'
'
Dim Bitmap1 As Bitmap
Bitmap1.Initialize(File.DirDefaultExternal,CurVariables2.GetString("UltimaImagen")) '
TouchImageView1.SetBitmap(Bitmap1)
If FirstTime Then
SourceImageRect.INITIALIZE(0, 0, Bitmap1.WIDTH, Bitmap1.HEIGHT)
TouchImageViewRect.INITIALIZE(0, 0, TouchImageView1.WIDTH, TouchImageView1.HEIGHT)
End If
' if the scaling process scales the image to less than the current MinScale or more than the current MaxScale then MinScale or MaxScale will be adjusted
TouchImageView1.ScaleSrcRectToDestRect(SourceImageRect, TouchImageViewRect, "CENTER") ' make string a static constant in library
Activity.AddMenuItem("Enviar Servicio","Enviar_Servicio")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
TouchImageViewRect=TouchImageView1.GetDestRect
If UserClosed Then
SQLVariables2.Close
End If
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode = KeyCodes.KEYCODE_BACK Then
Activity.Finish
End If
End Sub
Sub Enviar_Servicio_Click
Dim u As Uri 'ContentResolver library
u.Parse("file://" & File.Combine(File.DirDefaultExternal,CurVariables2.GetString("UltimaImagen")))
Dim i As Intent
i.Initialize(i.ACTION_SEND, "")
i.SetType("*/*")
i.PutExtra("android.intent.extra.STREAM",u)
StartActivity(i)
End Sub