我的 Win 8 Metro 应用程序上有一张图片,我想将其复制到之前设置的文件夹中,并将其重命名为实际的日期和时间。我唯一不能去工作的是图像复制。
private async void CreateButton_Click(object sender, RoutedEventArgs e)
{
string DateTimeNow = DateTime.Now.ToString("HHmmssddMMyyyy");
StorageFolder docs = KnownFolders.DocumentsLibrary;
StorageFolder MyFolder = await docs.CreateFolderAsync("MyFolder", Windows.Storage.CreationCollisionOption.OpenIfExists);
StorageFile Img = await GetFileAsync(ImagePreview.Source.ToString()); // This is the part that I have no idea what I'm doing (nor how to)
StorageFile copyFile = await Img.CopyAsync(MyFolder, DateTimeNow, NameCollisionOption.ReplaceExisting);
}
这是 ImagePreview XAML 代码(源设置在 FileOpenPicker 上)
<Image x:Name="ImagePreview" Stretch="UniformToFill"/>