diff --git a/PixivFSUWP/BigImage.xaml b/PixivFSUWP/BigImage.xaml
index c8294b8..6daa174 100644
--- a/PixivFSUWP/BigImage.xaml
+++ b/PixivFSUWP/BigImage.xaml
@@ -37,7 +37,7 @@
-
+
diff --git a/PixivFSUWP/BigImage.xaml.cs b/PixivFSUWP/BigImage.xaml.cs
index 47b40e3..e3c8129 100644
--- a/PixivFSUWP/BigImage.xaml.cs
+++ b/PixivFSUWP/BigImage.xaml.cs
@@ -139,19 +139,29 @@ private async void btnSetWallpaper_Click(object sender, RoutedEventArgs e)
if (UserProfilePersonalizationSettings.IsSupported())
{
UserProfilePersonalizationSettings settings = UserProfilePersonalizationSettings.Current;
- StorageFile cacheFile = await CacheManager.GetCachedFileAsync(parameter.FileName);
- StorageFile file = await cacheFile.CopyAsync(ApplicationData.Current.LocalFolder, "WallpaperImage", NameCollisionOption.ReplaceExisting);
+ StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync("WallpaperImage", CreationCollisionOption.ReplaceExisting);
+ using (var stream = await file.OpenAsync(FileAccessMode.ReadWrite))
+ {
+ var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, stream);
+ var image = mainImg.Source as WriteableBitmap;
+ var imageStream = image.PixelBuffer.AsStream();
+ byte[] raw = new byte[imageStream.Length];
+ await imageStream.ReadAsync(raw, 0, raw.Length);
+ encoder.SetPixelData(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Ignore,
+ (uint)image.PixelWidth, (uint)image.PixelHeight, 96, 96, raw);
+ await encoder.FlushAsync();
+ }
if (!await settings.TrySetWallpaperImageAsync(file))
{
- var messageDialog = new MessageDialog("更换壁纸失败");
+ var messageDialog = new MessageDialog(GetResourceString("WallpaperFailed"));
await messageDialog.ShowAsync();
}
else
- await ShowTip("已更换壁纸");
+ await ShowTip(GetResourceString("WallpaperSuccess"));
}
else
{
- var messageDialog = new MessageDialog("您的设备不支持更换壁纸");
+ var messageDialog = new MessageDialog("WallpaperNotSupport");
await messageDialog.ShowAsync();
}
}
@@ -183,7 +193,7 @@ public async Task ShowTip(string Message, int Seconds = 3)
}
private async Task saveImage()
- {
+ {
FileSavePicker picker = new FileSavePicker();
picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
picker.FileTypeChoices.Add(GetResourceString("ImageFilePlain"), new List() { ".png" });
diff --git a/PixivFSUWP/MultilingualResources/PixivFSUWP.ja.xlf b/PixivFSUWP/MultilingualResources/PixivFSUWP.ja.xlf
index a44f062..ac99e4a 100644
--- a/PixivFSUWP/MultilingualResources/PixivFSUWP.ja.xlf
+++ b/PixivFSUWP/MultilingualResources/PixivFSUWP.ja.xlf
@@ -825,6 +825,26 @@ Do you want to disable them?
Download Manager
NavigationViewItemHeader
+
+ Failed to change wallpaper
+ 壁紙が変更できません
+ PlainText
+
+
+ Your device does not support changing the wallpaper
+ お使いのデバイスは壁紙の変更をサポートしていません
+ PlainText
+
+
+ Wallpaper changed
+ 壁紙を変更しました
+ PlainText
+
+
+ Set as Wallpaper
+ 壁紙に設定する
+ PlainText
+