src/KsWare.Console/Console.cs
/// <summary>
/// Shows or hides the Console window.
/// </summary>
/// <param name="show">true to show; false to hide</param>
Shows or hides the Console window.
Shows or hides the Console window .
public static void ShowWindow(bool show = true) {
			const int SW_HIDE = 0;
			const int SW_SHOW = 5;
			var handle = ConsoleApi.GetConsoleWindow();
			if (handle == IntPtr.Zero && show) {
				ConsoleApi.AllocConsole();
				handle = ConsoleApi.GetConsoleWindow();
			}
			if (handle == IntPtr.Zero) {
				throw new InvalidOperationException("No console window available!");
			}
			ConsoleApi.ShowWindow(handle, show ? SW_SHOW : SW_HIDE);
		}
public static void ShowWindow ( bool show = true ) { const int SW_HIDE = 0 ; const int SW_SHOW = 5 ; var handle = ConsoleApi . GetConsoleWindow ( ) ; if ( handle == IntPtr . Zero && show ) { ConsoleApi . AllocConsole ( ) ; handle = ConsoleApi . GetConsoleWindow ( ) ; } if ( handle == IntPtr . Zero ) { throw new InvalidOperationException ( " " ) ; } ConsoleApi . ShowWindow ( handle , show ? SW_SHOW : SW_HIDE ) ; }
Shows or hides the Console window.
Shows or hides the Console window .
show
bool
true to show; false to hide
true to show ; false to hide