我正在使用CameraCaptureUI API在Windows平板电脑上拍照。我可以拍照,但我不知道它保存在哪里或如何更改它的保存文件夹。
我尝试过以下代码将其保存在图片库中但没有成功:
Dim fileCopy As StorageFile = Await file.CopyAsync(KnownFolders.PicturesLibrary, "MyNicePhoto.bmp", NameCollisionOption.ReplaceExisting)
这是我用来拍照的代码(取自CameraCaptureUI样本)
Private appSettings As Windows.Foundation.Collections.IPropertySet
Private Const photoKey As String = "capturedPhoto"
Try
' Using Windows.Media.Capture.CameraCaptureUI API to capture a photo
Dim dialog As New CameraCaptureUI()
Dim aspectRatio As New Size(16, 9)
dialog.PhotoSettings.CroppedAspectRatio = aspectRatio
Dim file As StorageFile = Await dialog.CaptureFileAsync(CameraCaptureUIMode.Photo)
If file IsNot Nothing Then
Dim bitmapImage As New BitmapImage()
Using fileStream As IRandomAccessStream = Await file.OpenAsync(FileAccessMode.Read)
bitmapImage.SetSource(fileStream)
End Using
' Store the file path in Application Data
appSettings(photoKey) = file.Path
End If
Catch ex As Exception
End Try
使用此代码是将照片保存在某处?
如果有,任何想法在哪里?
如何更改保存位置?
答案 0 :(得分:1)
我并非100%确定这是你所追求的,但它可能有所帮助:
Dim saveDiag As New Pickers.FolderPicker
Dim destFolder As Windows.Storage.StorageFolder = Await SaveDiag.PickSingleFolderAsync
Await file.MoveAsync(destFolder)