Sub ButtonGetImage_Click
SongTitle=""
Main.CC.Show("image/*", "Choose image")
lblHelp.Color=Colors.Transparent
lblHelp.Text="Choose a title!"
End Sub
Sub CC_Result (Success As Boolean, Dir As String, filename As String)
If Success = True Then
ImageView1.Bitmap = LoadBitmap(Dir,filename)
Else
ToastMessageShow("Error :(",True)
End If
L' utente se la guarda e se gli piace la salva nella cartella che ho stabilito.
[CODE=b4x]
If File.Exists(FullPath, SongTitleFinito & ".jpg") = False Then
Dim NomeSave As String = SongTitleFinito & ".jpg"
Dim Data() As Byte
''''''''''''''''''''''''''''''''''''
If (ImageView1.Bitmap) <> Null Then
Data = ImageToBytes(ImageView1.Bitmap)
Try
Dim out As OutputStream
out = File.OpenOutput(FotoPath, NomeSave,False)
out.WriteBytes(Data, 0, Data.Length)
out.Close
'svuoto LastException' immagine
ImageView1.Bitmap = Null
ImageView1.Visible=True ' forse non serve
ToastMessageShow( "SAVED" , True)
lblHelp.Color=Colors.Green
lblHelp.Text="Saved: " & CRLF & NomeSave
'pulisco le variabili e svuoto la lista delle canzoni presenti prima
SongTitle=""
lblListaPresenti.Text=""
Catch
MsgboxAsync("Error image","ATTENTION")
Return
End Try
Else
MsgboxAsync("No image selected","ATTENTION")
Return
End If
Else ' chiedo se corretto?
ToastMessageShow(SongTitleFinito & " " & "ATTENTION: NOT SAVED" , True)
lblHelp.Color=Colors.red
lblHelp.Text= SongTitleFinito & CRLF & "ATTENTION: already exists "
'SongTitle=""
End If
public Sub ImageToBytes(Image As Bitmap) As Byte()
Dim out As OutputStream
out.InitializeToBytesArray(0)
Image.WriteToStream(out, 100, "JPEG")
out.Close
Return out.ToBytesArray
End Sub