public static void ApplyVideoAspect() { if (RenderWindow != null) { RenderWindow.SetAspect(VideoAspect); } }
public static void Show(Wallpaper wallpaper) { IntPtr handler = IntPtr.Zero; Execute.OnUIThread(() => { if (RenderWindow == null) { RenderWindow = new RenderForm { Wallpaper = wallpaper }; RenderWindow.SetAspect(VideoAspect); RenderWindow.Show(); } else { try { RenderWindow.Wallpaper = wallpaper; RenderWindow.SetAspect(VideoAspect); //RenderWindow .Visibility = System.Windows.Visibility.Visible; RenderWindow.Visible = true; } catch (Exception) { RenderWindow?.Close(); RenderWindow = null; //explorer 崩溃后会触发这个问题 RenderWindow = new RenderForm { Wallpaper = wallpaper }; RenderWindow.Show(); } } //handler = new WindowInteropHelper(RenderWindow).Handle; handler = RenderWindow.Handle; }); //HandlerWallpaper.Show(handler); _LWECore.SendToBackground(handler); }