本文整理汇总了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);
}
示例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 "";
}
示例3: MoveFileToLocalAsync
public static async Task MoveFileToLocalAsync(StorageFile backingFile)
{
await backingFile.MoveAsync(_localFolder, backingFile.Name, NameCollisionOption.GenerateUniqueName);
}