private static void Try(Action <TaskbarManager> action) { if (EnvUtils.RunningOnWindowsWithMainWindow() && TaskbarManager.IsPlatformSupported) { try { action(TaskbarManager.Instance); } catch (InvalidOperationException) { } } }