これは、Windows 8 メトロ アプリのコードです。ローカル フォルダーからアプリ ストレージ フォルダーに 1 つの画像をコピーすると、タイル通知が表示されます。画像ライブラリからすべての画像を自動コピーし、タイル通知に表示されるこれらの画像を自動コピーするのを手伝ってください。画像ライブラリからすべての画像にアクセスしたりコピーしたりする方法がわかりません... 画像をコピーするためのユーザー インターフェイスがありません。
public seal 部分クラス BlankPage : Page { string imageRelativePath = String.Empty;
public BlankPage()
{
this.InitializeComponent();
CopyImages();
}
public async void CopyImages()
{
FileOpenPicker picker = new Windows.Storage.Pickers.FileOpenPicker();
picker.ViewMode = PickerViewMode.Thumbnail;
picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
picker.FileTypeFilter.Add(".jpg");
picker.FileTypeFilter.Add(".jpeg");
picker.FileTypeFilter.Add(".png");
picker.CommitButtonText = "Copy";
StorageFile file = await picker.PickSingleFileAsync();
StorageFile newFile = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFileAsync(file.Name);
await file.CopyAndReplaceAsync(newFile);
this.imageRelativePath = newFile.Path.Substring(newFile.Path.LastIndexOf("\\") + 1);
IWideTileNotificationContent tileContent = null;
ITileWideImage wideContent = TileContentFactory.CreateTileWideImage();
wideContent.RequireSquareContent = false;
wideContent.Image.Src = "ms-appdata:///local/" + this.imageRelativePath;
wideContent.Image.Alt = "App data";
tileContent = wideContent;
tileContent.RequireSquareContent = false;
TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification());
}
}