1use std::time::Duration;
2
3use win32_notif::{NotificationActivatedEventHandler, NotificationBuilder, ToastsNotifier, notification::{actions::{ActionButton, Input, action::ActivationType}, visual::Text}};
4fn main() {
8 let notifier = ToastsNotifier::new("Microsoft.Windows.Explorer").unwrap();
9
10 let notification = NotificationBuilder::new()
11 .visual(
12 Text::create(0, "Enter your name")
13 )
14 .action(
15 Input::create_text_input("0", "Name", "AHQ")
16 )
17 .action(
18 ActionButton::create("Submit")
19 .with_input_id("0")
20 .with_activation_type(ActivationType::Foreground)
22 )
23 .on_activated(NotificationActivatedEventHandler::new(|_notif, data| {
24 let data = data.unwrap();
25
26 println!("{:#?}", data);
27
28 Ok(())
29 }))
30 .with_expiry(Duration::from_secs(5))
32 .build(0, ¬ifier, "01", "input")
36 .unwrap();
37
38 notification.show()
39 .unwrap();
40
41 loop {
43 std::thread::sleep(Duration::from_secs(2));
44 }
45}