use hide_console::{hide_console, show_console, is_hide_console_supported};
use std::thread;
use std::time::Duration;
use std::io::{self, Write};
fn main() {
if !is_hide_console_supported() {
println!("Console hiding/showing is not supported on this platform.");
println!("This example will simply emulate the behavior.");
}
println!("Console Visibility Toggle Demonstration");
println!("======================================");
println!("The console will be hidden in 3 seconds...");
for i in (1..=3).rev() {
print!("\rHiding in {} seconds...", i);
io::stdout().flush().unwrap();
thread::sleep(Duration::from_secs(1));
}
println!("\rHiding console... ");
hide_console();
thread::sleep(Duration::from_secs(5));
show_console();
println!("Console is visible again!");
println!("This example demonstrates the ability to:");
println!("1. Hide the console for background work");
println!("2. Show the console when user input is needed");
println!();
println!("Press Enter to hide the console again...");
let mut input = String::new();
io::stdin().read_line(&mut input).unwrap();
println!("The console will be hidden for 3 seconds...");
hide_console();
thread::sleep(Duration::from_secs(3));
show_console();
println!("Example completed!");
}