private void MaximizedMonitor_AppMaximized(object sender, AppMaximizedEvent e) { var maximizedScreenIndex = Screen.AllScreens.ToList().IndexOf(e.MaximizedScreen); foreach (var item in Options.ScreenOptions) { int currentScreenIndex = item.ScreenIndex; if (Options.AppMaximizedEffectAllScreen != true && currentScreenIndex != maximizedScreenIndex) { continue; } switch (item.WhenAppMaximized) { case ActionWhenMaximized.Pause: if (e.Maximized) { Pause(currentScreenIndex); } else { Resum(currentScreenIndex); } break; case ActionWhenMaximized.Stop: if (e.Maximized) { InnerCloseWallpaper(currentScreenIndex); } else if (_currentWalpapers.ContainsKey(currentScreenIndex)) { _ = ShowWallpaper(_currentWalpapers[currentScreenIndex], currentScreenIndex); } break; case ActionWhenMaximized.Play: break; } } }
private void MaximizedMonitor_AppMaximized(object sender, AppMaximizedEvent e) { var maximizedScreenIndexs = e.MaximizedScreens.Select(m => Screen.AllScreens.ToList().IndexOf(m)).ToList(); bool anyScreenMaximized = maximizedScreenIndexs.Count > 0; foreach (var item in Options.ScreenOptions) { int currentScreenIndex = item.ScreenIndex; bool currentScreenMaximized = maximizedScreenIndexs.Contains(currentScreenIndex) || Options.AppMaximizedEffectAllScreen && anyScreenMaximized; switch (item.WhenAppMaximized) { case ActionWhenMaximized.Pause: if (currentScreenMaximized) { Pause(currentScreenIndex); } else { Resum(currentScreenIndex); } break; case ActionWhenMaximized.Stop: if (currentScreenMaximized) { InnerCloseWallpaper(currentScreenIndex); } else if (_currentWalpapers.ContainsKey(currentScreenIndex)) { _ = ShowWallpaper(_currentWalpapers[currentScreenIndex], currentScreenIndex); } break; case ActionWhenMaximized.Play: break; } } }