From 679fd7644a138477ed04cae8e464caf57549ca03 Mon Sep 17 00:00:00 2001 From: snowlab Date: Wed, 9 Jan 2019 11:51:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E6=9C=8D=E5=8A=A1=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=9A=82=E6=97=B6=E7=94=A8=E4=B8=8D=E4=B8=8A=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=BE=E7=BD=AE=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LiveWallpaper/LiveWallpaper.csproj | 2 +- LiveWallpaper/Managers/AppManager.cs | 14 ++++++++------ LiveWallpaper/Res/Languages/en.json | 1 + LiveWallpaper/Res/Languages/zh.json | 3 ++- LiveWallpaper/Res/setting.desc.json | 18 ++++++++++-------- LiveWallpaper/Settings/SettingObject.cs | 2 +- LiveWallpaper/ViewModels/MainViewModel.cs | 3 ++- LiveWallpaper/packages.config | 2 +- LiveWallpaperEngineLib/WallpaperManager.UI.cs | 7 +++++++ 9 files changed, 33 insertions(+), 19 deletions(-) diff --git a/LiveWallpaper/LiveWallpaper.csproj b/LiveWallpaper/LiveWallpaper.csproj index 41ee784e..786f67b3 100644 --- a/LiveWallpaper/LiveWallpaper.csproj +++ b/LiveWallpaper/LiveWallpaper.csproj @@ -66,7 +66,7 @@ ..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll - ..\packages\JsonConfiger.1.0.0.42\lib\net46\JsonConfiger.WPF.dll + ..\packages\JsonConfiger.1.0.0.45\lib\net46\JsonConfiger.WPF.dll ..\packages\LoadingIndicators.WPF.0.0.1\lib\LoadingIndicators.WPF.dll diff --git a/LiveWallpaper/Managers/AppManager.cs b/LiveWallpaper/Managers/AppManager.cs index 44bcc33a..dca1859c 100644 --- a/LiveWallpaper/Managers/AppManager.cs +++ b/LiveWallpaper/Managers/AppManager.cs @@ -160,7 +160,7 @@ private static async Task CheckDefaultSetting() { General = GeneralSettting.GetDefaultGeneralSettting(), Wallpaper = WallpaperSetting.GetDefaultWallpaperSetting(), - Server = ServerSetting.GetDefaultServerSetting() + //Server = ServerSetting.GetDefaultServerSetting() }; writeDefault = true; } @@ -176,11 +176,11 @@ private static async Task CheckDefaultSetting() writeDefault = true; tempSetting.Wallpaper = WallpaperSetting.GetDefaultWallpaperSetting(); } - if (tempSetting.Server == null) - { - writeDefault = true; - tempSetting.Server = ServerSetting.GetDefaultServerSetting(); - } + //if (tempSetting.Server == null) + //{ + // writeDefault = true; + // tempSetting.Server = ServerSetting.GetDefaultServerSetting(); + //} if (writeDefault) //生成默认配置 @@ -257,6 +257,8 @@ public static async Task ApplySetting(SettingObject setting) await AutoStartupHelper.Instance.Set(setting.General.StartWithWindows); setting.General.StartWithWindows = await AutoStartupHelper.Instance.Check(); + WallpaperManager.VideoAspect = setting.Wallpaper.VideoAspect; + WallpaperManager.ApplyVideoAspect(); } } } diff --git a/LiveWallpaper/Res/Languages/en.json b/LiveWallpaper/Res/Languages/en.json index cd6107ab..5eeb2ab8 100644 --- a/LiveWallpaper/Res/Languages/en.json +++ b/LiveWallpaper/Res/Languages/en.json @@ -42,6 +42,7 @@ "setting_maximizedStop": "Pause", "setting_maximizedPause": "Stop", "setting_videoAspect": "VideoAspect", + "setting_videoAspect_desc": "Format 16:9 4:3 1:1, default is none", "setting_server": "Server", "setting_serverURL": "server url", "setting_recordWindowSize": "Save the main window size", diff --git a/LiveWallpaper/Res/Languages/zh.json b/LiveWallpaper/Res/Languages/zh.json index cc365d59..a4f8931c 100644 --- a/LiveWallpaper/Res/Languages/zh.json +++ b/LiveWallpaper/Res/Languages/zh.json @@ -42,7 +42,8 @@ "setting_maximizedPlay": "播放", "setting_maximizedStop": "停止", "setting_maximizedPause": "暂停", - "setting_videoAspect": "视频播放比例(例如 4:3 ,默认不填)", + "setting_videoAspect": "视频播放比例", + "setting_videoAspect_desc": "格式 16:9 4:3 1:1,默认不填", "setting_server": "服务器", "setting_serverURL": "服务器地址", "setting_recordWindowSize": "保存主窗口大小", diff --git a/LiveWallpaper/Res/setting.desc.json b/LiveWallpaper/Res/setting.desc.json index 3a062ed7..a403695b 100644 --- a/LiveWallpaper/Res/setting.desc.json +++ b/LiveWallpaper/Res/setting.desc.json @@ -58,14 +58,16 @@ }, "VideoAspect": { "type": "text", - "lanKey": "setting_videoAspect" - } - }, - "Server": { - "lanKey": "setting_server", - "ServerUrl": { - "type": "text", - "lanKey": "setting_serverURL" + "lanKey": "setting_videoAspect", + "descLanKey": "setting_videoAspect_desc" } } + //, + //"Server": { + // "lanKey": "setting_server", + // "ServerUrl": { + // "type": "text", + // "lanKey": "setting_serverURL" + // } + //} } \ No newline at end of file diff --git a/LiveWallpaper/Settings/SettingObject.cs b/LiveWallpaper/Settings/SettingObject.cs index 8eb4897f..d21768a9 100644 --- a/LiveWallpaper/Settings/SettingObject.cs +++ b/LiveWallpaper/Settings/SettingObject.cs @@ -75,6 +75,6 @@ public class SettingObject public WallpaperSetting Wallpaper { get; set; } - public ServerSetting Server { get; set; } + //public ServerSetting Server { get; set; } } } diff --git a/LiveWallpaper/ViewModels/MainViewModel.cs b/LiveWallpaper/ViewModels/MainViewModel.cs index 52f46694..bafebd50 100644 --- a/LiveWallpaper/ViewModels/MainViewModel.cs +++ b/LiveWallpaper/ViewModels/MainViewModel.cs @@ -218,7 +218,8 @@ public async void OpenLocalServer() //没有文件夹UWP会报错 Directory.CreateDirectory(wallpaperDir); - Uri uri = new Uri($"live.wallpaper.store://?host={AppManager.Setting.Server.ServerUrl}&wallpaper={wallpaperDir}"); + //host={AppManager.Setting.Server.ServerUrl}& + Uri uri = new Uri($"live.wallpaper.store://?wallpaper={wallpaperDir}"); #pragma warning disable UWP003 // UWP-only bool success = await Windows.System.Launcher.LaunchUriAsync(uri); diff --git a/LiveWallpaper/packages.config b/LiveWallpaper/packages.config index e7108be7..19bfc3ac 100644 --- a/LiveWallpaper/packages.config +++ b/LiveWallpaper/packages.config @@ -8,7 +8,7 @@ - + diff --git a/LiveWallpaperEngineLib/WallpaperManager.UI.cs b/LiveWallpaperEngineLib/WallpaperManager.UI.cs index c9102974..335f5c5a 100644 --- a/LiveWallpaperEngineLib/WallpaperManager.UI.cs +++ b/LiveWallpaperEngineLib/WallpaperManager.UI.cs @@ -89,6 +89,13 @@ public static void MonitorMaxiemized(bool enable) } } + public static void ApplyVideoAspect() + { + if (RenderWindow != null) + { + RenderWindow.SetAspect(VideoAspect); + } + } public static void Show(Wallpaper wallpaper) { IntPtr handler = IntPtr.Zero;