Skip to main content

notification/
notification.rs

1const APP_ID: &str = "rustydialogs.example.notify";
2
3fn main() {
4	rustydialogs::Notification::setup(APP_ID);
5
6	// winrt-toast: Takes almost three seconds to show the first notification due to registration delays.
7	// All Notifications shown before the first one may be ignored...
8
9	let notify = rustydialogs::Notification {
10		app_id: APP_ID,
11		title: "Rusty Dialogs",
12		message: "This is a native notification.",
13		icon: rustydialogs::MessageIcon::Info,
14		timeout: rustydialogs::Notification::SHORT_TIMEOUT,
15	};
16
17	notify.show();
18	println!("Notification shown");
19
20	// winrt-toast: Wait a bit to ensure the notification is visible before the program exits.
21	std::thread::sleep(std::time::Duration::from_millis(100));
22}