首页 > 其他 > 详细

保存camera StorageFile文件

时间:2018-01-20 22:01:55      阅读:216      评论:0      收藏:0      [点我收藏+]
        private async void TakeSnapShotButton_Click(object sender, RoutedEventArgs e)
        {
            CameraCaptureUI ccu = new CameraCaptureUI();
            ccu.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Png;
            ccu.PhotoSettings.AllowCropping = false;
            StorageFile photo =await ccu.CaptureFileAsync(CameraCaptureUIMode.Photo);
            if (photo is null)
                return;
            else
            {
                TemporaryPhotoFile = photo;
                BitmapImage bitMapImage = new BitmapImage();
                FileRandomAccessStream fRAS = (FileRandomAccessStream)await photo.OpenAsync(FileAccessMode.Read);
                bitMapImage.SetSource(fRAS);
                yourPhoto.Source = bitMapImage;
 
 
                /// 保存 StorageFile文件到磁盘
                StorageFolder destinationFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync
                    (yourName.Text,CreationCollisionOption.OpenIfExists);
                await photo.MoveAsync(destinationFolder, "ProfilePhoto.jpg", NameCollisionOption.ReplaceExisting);
                await photo.DeleteAsync();
 
 
            }
        }

  

保存camera StorageFile文件

原文:https://www.cnblogs.com/pugongying123/p/8322008.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!