本文整理匯總了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);
}