Private Sub ListView1_ItemClick (Position As Int, Value As Object)
Dim f As ExternalFile = Value
If f = UpItem Then
'remove the current folder
FoldersStack.RemoveAt(FoldersStack.Size - 1)
'get the parent folder which is now the topmost folder
Dim folder As ExternalFile = GetCurrentFolder
'remove it and enter it again
FoldersStack.RemoveAt(FoldersStack.Size - 1)
EnterFolder(folder)
Else
'The ExternalFile returned from ListFiles cannot be used directly.
'We need to first call FindFile.
f = Storage.FindFile(GetCurrentFolder, f.Name)
If f.IsFolder Then
EnterFolder(f)
Else If IsImageFile(f.Name) Then
Dim in As InputStream = Storage.OpenInputStream(f)
'We can open the image directly with Bitmap.Initialize2 however it will not allow us to use LoadBitmapResize
'so instead we copy it to a temporary file.
Dim out As OutputStream = File.OpenOutput(File.DirInternal, "temp", False)
File.Copy2(in, out)
out.Close
ImageView1.SetBackgroundImage(LoadBitmapResize(File.DirInternal, "temp", ImageView1.Width, ImageView1.Height, True))
' Storage.CreateNewFile(GetCurrentFolder, f.Name&"Probe.jpg")
End If
End If
End Sub