public async Task ShowWallpaper(WallpaperModel wallpaper, params uint[] screenIndexs) { if (wallpaper.Type == WallpaperType.NotSupport) { wallpaper.Type = RenderFactory.ResoveType(wallpaper.Path); } if (wallpaper.Type == WallpaperType.NotSupport) { return; } foreach (var index in screenIndexs) { //类型不一致关闭上次显示的壁纸 if (CurrentWalpapers.ContainsKey(index) && wallpaper.Type != CurrentWalpapers[index].Type) { CloseWallpaper(screenIndexs); } } var currentRender = RenderFactory.GetOrCreateRender(wallpaper.Type); await currentRender.ShowWallpaper(wallpaper, screenIndexs); foreach (var index in screenIndexs) { if (!CurrentWalpapers.ContainsKey(index)) { CurrentWalpapers.Add(index, wallpaper); } else { CurrentWalpapers[index] = wallpaper; } } ApplyAudioSource(); }
public async Task ShowWallpaper(WallpaperModel wallpaper, params int[] screenIndexs) { //CloseWallpaper(screenIndexs); if (wallpaper.Type == null) { wallpaper.Type = RenderFactory.ResoveType(wallpaper.Path); } if (wallpaper.Type.DType == WalllpaperDefinedType.NotSupport) { return; } foreach (var index in screenIndexs) { //类型不一致关闭上次显示的壁纸 if (_currentWalpapers.ContainsKey(index) && wallpaper.Type.DType != _currentWalpapers[index].Type.DType) { CloseWallpaper(screenIndexs); } } var currentRender = RenderFactory.GetOrCreateRender(wallpaper.Type.DType); await currentRender.ShowWallpaper(wallpaper, screenIndexs); foreach (var index in screenIndexs) { if (!_currentWalpapers.ContainsKey(index)) { _currentWalpapers.Add(index, wallpaper); } else { _currentWalpapers[index] = wallpaper; } } }