public void Resum(params int[] screenIndexs) { foreach (var index in screenIndexs) { if (_currentWalpapers.ContainsKey(index)) { var wallpaper = _currentWalpapers[index]; var currentRender = RenderFactory.GetOrCreateRender(wallpaper.Type.DType); currentRender.Resum(screenIndexs); } } }
public void Pause(params uint[] screenIndexs) { foreach (var index in screenIndexs) { if (CurrentWalpapers.ContainsKey(index)) { var wallpaper = CurrentWalpapers[index]; var currentRender = RenderFactory.GetOrCreateRender(wallpaper.Type); currentRender.Pause(screenIndexs); } } }
private void ApplyAudioSource() { //设置音源 for (uint screenIndex = 0; screenIndex < Screen.AllScreens.Length; screenIndex++) { if (CurrentWalpapers.ContainsKey(screenIndex)) { var wallpaper = CurrentWalpapers[screenIndex]; var currentRender = RenderFactory.GetOrCreateRender(wallpaper.Type); currentRender.SetVolume(screenIndex == Options.AudioScreenIndex ? 100 : 0, screenIndex); } } }
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; } } }