@@ -28,26 +28,26 @@ public async Task<BaseApiResult<List<RenderInfo>>> ShowWallpaper(WallpaperModel
28
28
foreach ( var item in screens )
29
29
Debug . WriteLine ( $ "show { GetType ( ) . Name } { item } ") ;
30
30
31
- List < RenderInfo > changedRender = new List < RenderInfo > ( ) ;
31
+ List < RenderInfo > changedRenderInfo = new ( ) ;
32
32
//过滤无变化的屏幕
33
33
var changedScreen = screens . Where ( m =>
34
34
{
35
35
bool ok = false ;
36
- var existRender = _currentWallpapers . FirstOrDefault ( x => x . Screen == m ) ;
37
- if ( existRender == null )
36
+ var existRenderInfo = _currentWallpapers . FirstOrDefault ( x => x . Screen == m ) ;
37
+ if ( existRenderInfo == null )
38
38
ok = true ;
39
39
else
40
40
{
41
- ok = existRender . Wallpaper . RunningData . AbsolutePath != wallpaper . RunningData . AbsolutePath ;
42
- changedRender . Add ( existRender ) ;
41
+ ok = existRenderInfo . Wallpaper . RunningData . AbsolutePath != wallpaper . RunningData . AbsolutePath ;
42
+ changedRenderInfo . Add ( existRenderInfo ) ;
43
43
}
44
44
return ok ;
45
45
} ) . ToArray ( ) ;
46
46
47
47
if ( changedScreen . Length > 0 )
48
48
{
49
49
//关闭已经展现的壁纸
50
- await InnerCloseWallpaperAsync ( changedRender , true ) ;
50
+ await CloseWallpaperExAsync ( wallpaper , changedScreen ) ;
51
51
52
52
_showWallpaperCts = new CancellationTokenSource ( ) ;
53
53
var showResult = await InnerShowWallpaper ( wallpaper , _showWallpaperCts . Token , changedScreen ) ;
@@ -60,7 +60,11 @@ public async Task<BaseApiResult<List<RenderInfo>>> ShowWallpaper(WallpaperModel
60
60
61
61
return BaseApiResult < List < RenderInfo > > . SuccessState ( ) ;
62
62
}
63
- public async Task CloseWallpaperAsync ( params string [ ] screens )
63
+ public Task CloseWallpaperAsync ( params string [ ] screens )
64
+ {
65
+ return CloseWallpaperExAsync ( null , screens ) ;
66
+ }
67
+ public async Task CloseWallpaperExAsync ( WallpaperModel nextWallpaper = null , params string [ ] screens )
64
68
{
65
69
var playingWallpaper = _currentWallpapers . Where ( m => screens . Contains ( m . Screen ) ) . ToList ( ) ;
66
70
if ( playingWallpaper . Count == 0 )
@@ -74,7 +78,7 @@ public async Task CloseWallpaperAsync(params string[] screens)
74
78
_showWallpaperCts ? . Dispose ( ) ;
75
79
_showWallpaperCts = null ;
76
80
77
- await InnerCloseWallpaperAsync ( playingWallpaper ) ;
81
+ await InnerCloseWallpaperAsync ( playingWallpaper , nextWallpaper ) ;
78
82
79
83
playingWallpaper . ToList ( ) . ForEach ( m =>
80
84
{
@@ -88,7 +92,7 @@ public async Task CloseWallpaperAsync(params string[] screens)
88
92
/// <param name="playingWallpaper"></param>
89
93
/// <param name="closeBeforeOpening">是否是临时关闭,临时关闭表示马上又会继续播放其他壁纸</param>
90
94
/// <returns></returns>
91
- protected virtual Task InnerCloseWallpaperAsync ( List < RenderInfo > playingWallpaper , bool closeBeforeOpening = false )
95
+ protected virtual Task InnerCloseWallpaperAsync ( List < RenderInfo > playingWallpaper , WallpaperModel nextWallpaper = null )
92
96
{
93
97
return Task . CompletedTask ;
94
98
}
0 commit comments