本文整理汇总了C#中Windows.DeleteAsync方法的典型用法代码示例。如果您正苦于以下问题:C# Windows.DeleteAsync方法的具体用法?C# Windows.DeleteAsync怎么用?C# Windows.DeleteAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows
的用法示例。
在下文中一共展示了Windows.DeleteAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReencodePhotoAsync
private async Task<Windows.Storage.StorageFile> ReencodePhotoAsync(
Windows.Storage.StorageFile tempStorageFile,
Windows.Storage.FileProperties.PhotoOrientation photoRotation)
{
Windows.Storage.Streams.IRandomAccessStream inputStream = null;
Windows.Storage.Streams.IRandomAccessStream outputStream = null;
Windows.Storage.StorageFile photoStorage = null;
try
{
inputStream = await tempStorageFile.OpenAsync(Windows.Storage.FileAccessMode.Read);
var decoder = await Windows.Graphics.Imaging.BitmapDecoder.CreateAsync(inputStream);
photoStorage = await Windows.Storage.KnownFolders.PicturesLibrary.CreateFileAsync(PHOTO_FILE_NAME, Windows.Storage.CreationCollisionOption.GenerateUniqueName);
outputStream = await photoStorage.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite);
outputStream.Size = 0;
var encoder = await Windows.Graphics.Imaging.BitmapEncoder.CreateForTranscodingAsync(outputStream, decoder);
var properties = new Windows.Graphics.Imaging.BitmapPropertySet();
properties.Add("System.Photo.Orientation",
new Windows.Graphics.Imaging.BitmapTypedValue(photoRotation, Windows.Foundation.PropertyType.UInt16));
await encoder.BitmapProperties.SetPropertiesAsync(properties);
await encoder.FlushAsync();
}
finally
{
if (inputStream != null)
{
inputStream.Dispose();
}
if (outputStream != null)
{
outputStream.Dispose();
}
var asyncAction = tempStorageFile.DeleteAsync(Windows.Storage.StorageDeleteOption.PermanentDelete);
}
return photoStorage;
}