Skip to content

Commit 2c69f0f

Browse files
committed
Adding dynamic wallpaper on and off
Adding dynamic wallpaper on and off
1 parent 354c2c3 commit 2c69f0f

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

Nimble/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
5252
// 方法是按如下所示使用“*”:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.0.0.3")]
55-
[assembly: AssemblyFileVersion("1.0.0.3")]
54+
[assembly: AssemblyVersion("1.0.0.4")]
55+
[assembly: AssemblyFileVersion("1.0.0.4")]

Nimble/ViewModels/MainVM.cs

+23-7
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
315315
/// </summary>
316316
public ICommand GithubCommand => new RelayCommand(obj =>
317317
{
318-
Process.Start("https://github.com/yanjinhuagood/Nimble");
318+
Process.Start("https://github.com/WPFDevelopersOrg/Nimble");
319319
});
320320

321321
/// <summary>
@@ -419,12 +419,14 @@ private void ScreenCapturer_SnapCompleted(CroppedBitmap bitmap)
419419
{
420420
if (!wallpaper.IsSelected)
421421
{
422+
ConfigHelper.SaveOpenWallpaper(false);
422423
StopFFplayProcess();
423424
wallpaper.ItemName = "壁纸已关闭";
424425
wallpaper.IsSelected = false;
425426
}
426427
else
427428
{
429+
ConfigHelper.SaveOpenWallpaper(true);
428430
WallpaersFilePlay();
429431
wallpaper.ItemName = "壁纸已开启";
430432
wallpaper.IsSelected = true;
@@ -449,18 +451,31 @@ private void ScreenCapturer_SnapCompleted(CroppedBitmap bitmap)
449451

450452
void ShowWallpaper(string wallpaperPath)
451453
{
452-
if (string.IsNullOrWhiteSpace(wallpaperPath) || !File.Exists(wallpaperPath)) return;
454+
if(string.IsNullOrWhiteSpace(wallpaperPath))
455+
{
456+
if(WallpaperArray.Count >= 3 && ConfigHelper.OpenWallpaper)
457+
{
458+
WallpaperArray.First().IsSelected = true;
459+
wallpaperPath = WallpaperArray[0].VideoPath;
460+
}
461+
462+
}
463+
if (!File.Exists(wallpaperPath) || !ConfigHelper.OpenWallpaper) return;
453464
StopFFplayProcess();
454465
WallpaperArray.Where(x => x.VideoPath != wallpaperPath && x.VideoPath != _exitWallpaper).ToList().ForEach(x =>
455466
{
456467
x.IsSelected = false;
457468
});
458-
var wallpaper = WallpaperArray.FirstOrDefault(x => x.VideoPath == _exitWallpaper);
459-
if (wallpaper != null)
469+
if(ConfigHelper.OpenWallpaper)
460470
{
461-
wallpaper.ItemName = "壁纸已开启";
462-
wallpaper.IsSelected = true;
471+
var wallpaper = WallpaperArray.FirstOrDefault(x => x.VideoPath == _exitWallpaper);
472+
if (wallpaper != null)
473+
{
474+
wallpaper.ItemName = "壁纸已开启";
475+
wallpaper.IsSelected = true;
476+
}
463477
}
478+
464479
StartFFplayProcess(wallpaperPath);
465480
if (ffplayWindowHandle != IntPtr.Zero)
466481
{
@@ -556,7 +571,7 @@ void StartFFplayProcess(string videoFilePath)
556571
var ffplayPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DLL", "ffplay.exe");
557572
var startInfo = new ProcessStartInfo();
558573
startInfo.FileName = ffplayPath;
559-
//startInfo.WindowStyle = ProcessWindowStyle.Maximized;
574+
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
560575
startInfo.Arguments = $"-loop 0 -fs \"{videoFilePath}\" ";
561576
startInfo.UseShellExecute = false;
562577
startInfo.CreateNoWindow = true;
@@ -620,6 +635,7 @@ void WallpaersFilePlay()
620635
WallpaperArray = names;
621636
if (WallpaperArray.Count > 0)
622637
ShowWallpaper(ConfigHelper.WallpaperPath);
638+
623639
}
624640
#endregion
625641
}

Nimble/app.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
-->
2626
<add key="CustomJson" value="false"/>
2727
<add key="Startup" value="false"/>
28-
<add key="OpenWallpaper" value="true"/>
28+
<add key="OpenWallpaper" value="false"/>
2929
<add key="WallpaperPath" value=""/>
3030
</appSettings>
3131
</configuration>

0 commit comments

Comments
 (0)