1use std::time::Duration;
2
3use win32_notif::{NotificationActivatedEventHandler, NotificationBuilder, ToastsNotifier, notification::{actions::{ActionButton, Input, action::ActivationType, input::Selection}, 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_selection_input(
16 "0",
17 "Name",
18 "AHQ",
19 vec![
20 Selection::new("1", "AHQ Novel"),
21 Selection::new("2", "AHQ Soft"),
22 Selection::new("3", "Wings of Fire")
23 ]
24 )
25 )
26 .action(
27 ActionButton::create("Submit")
28 .with_input_id("0")
29 .with_activation_type(ActivationType::Foreground)
31 )
32 .on_activated(NotificationActivatedEventHandler::new(|_notif, data| {
33 let data = data.unwrap();
34
35 println!("{:#?}", data);
36
37 Ok(())
38 }))
39 .with_expiry(Duration::from_secs(5))
41 .build(0, ¬ifier, "01", "input")
45 .unwrap();
46
47 notification.show()
48 .unwrap();
49
50 loop {
52 std::thread::sleep(Duration::from_secs(2));
53 }
54}