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 + diff --git a/PixivFSUWP/MultilingualResources/PixivFSUWP.zh-Hans.xlf b/PixivFSUWP/MultilingualResources/PixivFSUWP.zh-Hans.xlf index 3dd02a7..c9a7515 100644 --- a/PixivFSUWP/MultilingualResources/PixivFSUWP.zh-Hans.xlf +++ b/PixivFSUWP/MultilingualResources/PixivFSUWP.zh-Hans.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 + diff --git a/PixivFSUWP/MultilingualResources/PixivFSUWP.zh-Hant.xlf b/PixivFSUWP/MultilingualResources/PixivFSUWP.zh-Hant.xlf index f6e6ab0..0d30bbf 100644 --- a/PixivFSUWP/MultilingualResources/PixivFSUWP.zh-Hant.xlf +++ b/PixivFSUWP/MultilingualResources/PixivFSUWP.zh-Hant.xlf @@ -813,6 +813,26 @@ Do you want to disable them? Download Manager NavigationViewItemHeader + + Failed to change wallpaper + Failed to change wallpaper + PlainText + + + Your device does not support changing the wallpaper + Your device does not support changing the wallpaper + PlainText + + + Wallpaper changed + Wallpaper changed + PlainText + + + Set as Wallpaper + Set as Wallpaper + PlainText + diff --git a/PixivFSUWP/Strings/en/Resources.resw b/PixivFSUWP/Strings/en/Resources.resw index 514afbb..48287e9 100644 --- a/PixivFSUWP/Strings/en/Resources.resw +++ b/PixivFSUWP/Strings/en/Resources.resw @@ -666,6 +666,10 @@ Do you want to disable them? Settings PlainText + + Set as Wallpaper + PlainText + Sex TextBlock @@ -734,6 +738,18 @@ Do you want to disable them? Version information TextBlock + + Failed to change wallpaper + PlainText + + + Your device does not support changing the wallpaper + PlainText + + + Wallpaper changed + PlainText + Works TextBlock diff --git a/PixivFSUWP/Strings/ja/Resources.resw b/PixivFSUWP/Strings/ja/Resources.resw index a497211..440bf5f 100644 --- a/PixivFSUWP/Strings/ja/Resources.resw +++ b/PixivFSUWP/Strings/ja/Resources.resw @@ -25,7 +25,7 @@ TextBlock - ブックマークから「{0}」を削除できません + 「{0}」をブックマークから解除できません PlainText @@ -53,7 +53,7 @@ PlainText - チェア + 椅子 TextBlock @@ -77,11 +77,11 @@ ComboBoxItem - ブックマーク削除 + ブックマーク解除 PlainText - ブックマークから「{0}」を削除しました + 「{0}」をブックマークから解除しました PlainText @@ -173,7 +173,7 @@ PlainText - {0}/{1} を読み込む中 + {0}/{1}を読み込む中 PlainText @@ -189,7 +189,7 @@ TextBlock - ログインできません。トラブルシューティングを行うか、もう一度やり直してください。 + ログインできません。トラブルシューティングを行い、もう一度やり直してください。 Button @@ -197,7 +197,7 @@ Button - *すべでのWindowsデバイスからログアウトします + *すべでのWindowsデバイスからログイン解除します TextBlock @@ -225,7 +225,7 @@ PlainText - 保存するインクがありません + 保存できるインクがありません PlainText @@ -249,7 +249,7 @@ PlainText - 画像数: {0} + 画像数: {0}。 クリックまたはタップして全画像モードに。 PlainText @@ -557,40 +557,24 @@ TextBlock - 実験的な機能が有効になっています、安定性問題が発生する可能性があります。 -無効にしますか? + You have experimental features enabled. They may cause stability issues. +Do you want to disable them? PlainText - - - TextBlock - - - 濃色 - ComboBoxItem - - - Windows モードを使用 - ComboBoxItem - - - 淡色 - ComboBoxItem - - - アプリを再起動して有効にする + + 壁紙が変更できません PlainText - - パッケージ: + + お使いのデバイスは壁紙の変更をサポートしていません PlainText - - 時刻: + + 壁紙を変更しました PlainText - - バージョン: + + 壁紙に設定する PlainText \ No newline at end of file diff --git a/PixivFSUWP/Strings/zh-Hans/Resources.resw b/PixivFSUWP/Strings/zh-Hans/Resources.resw index a6701eb..8f06628 100644 --- a/PixivFSUWP/Strings/zh-Hans/Resources.resw +++ b/PixivFSUWP/Strings/zh-Hans/Resources.resw @@ -641,4 +641,20 @@ 当然 PlainText (❌Unworkable) + + 更换壁纸失败 + PlainText + + + 您的设备不支持更换壁纸 + PlainText + + + 壁纸已更换 + PlainText + + + 设为壁纸 + PlainText + \ No newline at end of file