Skip to content

Commit

Permalink
屏蔽服务配置暂时用不上,增加设置描述
Browse files Browse the repository at this point in the history
  • Loading branch information
snowlab committed Jan 9, 2019
1 parent e5fb916 commit 679fd76
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 19 deletions.
2 changes: 1 addition & 1 deletion LiveWallpaper/LiveWallpaper.csproj
Expand Up @@ -66,7 +66,7 @@
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
</Reference>
<Reference Include="JsonConfiger.WPF, Version=1.0.0.16, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\JsonConfiger.1.0.0.42\lib\net46\JsonConfiger.WPF.dll</HintPath>
<HintPath>..\packages\JsonConfiger.1.0.0.45\lib\net46\JsonConfiger.WPF.dll</HintPath>
</Reference>
<Reference Include="LoadingIndicators.WPF, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LoadingIndicators.WPF.0.0.1\lib\LoadingIndicators.WPF.dll</HintPath>
Expand Down
14 changes: 8 additions & 6 deletions LiveWallpaper/Managers/AppManager.cs
Expand Up @@ -160,7 +160,7 @@ private static async Task CheckDefaultSetting()
{
General = GeneralSettting.GetDefaultGeneralSettting(),
Wallpaper = WallpaperSetting.GetDefaultWallpaperSetting(),
Server = ServerSetting.GetDefaultServerSetting()
//Server = ServerSetting.GetDefaultServerSetting()
};
writeDefault = true;
}
Expand All @@ -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)
//生成默认配置
Expand Down Expand Up @@ -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();
}
}
}
1 change: 1 addition & 0 deletions LiveWallpaper/Res/Languages/en.json
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion LiveWallpaper/Res/Languages/zh.json
Expand Up @@ -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": "保存主窗口大小",
Expand Down
18 changes: 10 additions & 8 deletions LiveWallpaper/Res/setting.desc.json
Expand Up @@ -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"
// }
//}
}
2 changes: 1 addition & 1 deletion LiveWallpaper/Settings/SettingObject.cs
Expand Up @@ -75,6 +75,6 @@ public class SettingObject

public WallpaperSetting Wallpaper { get; set; }

public ServerSetting Server { get; set; }
//public ServerSetting Server { get; set; }
}
}
3 changes: 2 additions & 1 deletion LiveWallpaper/ViewModels/MainViewModel.cs
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion LiveWallpaper/packages.config
Expand Up @@ -8,7 +8,7 @@
<package id="DZY.WinAPI" version="1.0.44" targetFramework="net471" />
<package id="Expression.Interaction" version="3.0.40218.0" targetFramework="net471" />
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net471" />
<package id="JsonConfiger" version="1.0.0.42" targetFramework="net471" />
<package id="JsonConfiger" version="1.0.0.45" targetFramework="net471" />
<package id="LoadingIndicators.WPF" version="0.0.1" targetFramework="net471" />
<package id="MahApps.Metro.IconPacks" version="2.3.0" targetFramework="net471" />
<package id="Microsoft.Win32.Registry" version="4.5.0" targetFramework="net471" />
Expand Down
7 changes: 7 additions & 0 deletions LiveWallpaperEngineLib/WallpaperManager.UI.cs
Expand Up @@ -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;
Expand Down

0 comments on commit 679fd76

Please sign in to comment.