当前位置: 首页>>代码示例>>C#>>正文


C# StorageFile.MoveAsync方法代码示例

本文整理汇总了C#中Windows.Storage.StorageFile.MoveAsync方法的典型用法代码示例。如果您正苦于以下问题:C# StorageFile.MoveAsync方法的具体用法?C# StorageFile.MoveAsync怎么用?C# StorageFile.MoveAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows.Storage.StorageFile的用法示例。


在下文中一共展示了StorageFile.MoveAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MoveFileAsync

        public async Task MoveFileAsync(StorageFile file, StorageFolder destinationFolder, string desiredNewFileName)
        {
            if (Exist(destinationFolder, desiredNewFileName))
            {
                try
                {
                    StorageFile fileToDelete = await destinationFolder.GetFileAsync(desiredNewFileName);
                    await DeleteAsync(fileToDelete);

                }
                catch (Exception)
                {
                    //TODO there is a known issue of the .net api; fix this when the api will be fixed
                }
            }

            await file.MoveAsync(destinationFolder,desiredNewFileName);
        }
开发者ID:stonemonkey,项目名称:WhereAmI,代码行数:18,代码来源:FileManipulator.cs

示例2: GetPictureFromCameraAsync

        public async Task<string> GetPictureFromCameraAsync()
        {
            var photo = new CameraCaptureUI();

            photo.PhotoSettings.AllowCropping = true;
            photo.PhotoSettings.CroppedAspectRatio = new Size(1, 1);
            photo.PhotoSettings.MaxResolution = CameraCaptureUIMaxPhotoResolution.HighestAvailable;
            photo.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Png;

            _recordStorageFile = await photo.CaptureFileAsync(CameraCaptureUIMode.Photo);

            if (_recordStorageFile != null)
            {
                var path = Path.Combine(StorageService.ImagePath);
                _url = string.Format("Image_{0}.{1}", Guid.NewGuid(), _recordStorageFile.FileType);
                var folder = await StorageFolder.GetFolderFromPathAsync(path);

                await _recordStorageFile.MoveAsync(folder, _url, NameCollisionOption.FailIfExists);

                return string.Format("{0}\\{1}",path, _url);
            }

            return "";
        }
开发者ID:india-rose,项目名称:xamarin-indiarose,代码行数:24,代码来源:MediaService.cs

示例3: MoveFileToLocalAsync

 public static async Task MoveFileToLocalAsync(StorageFile backingFile)
 {
     await backingFile.MoveAsync(_localFolder, backingFile.Name, NameCollisionOption.GenerateUniqueName);
 }        
开发者ID:pingzing,项目名称:Codeco,代码行数:4,代码来源:FileUtilities.cs


注:本文中的Windows.Storage.StorageFile.MoveAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。