码迷,mamicode.com
首页 > 其他好文 > 详细

保存camera StorageFile文件

时间:2018-01-20 22:50:49      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:ext   保存   creation   磁盘   collision   temp   .so   sha   create   

        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文件

标签:ext   保存   creation   磁盘   collision   temp   .so   sha   create   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!