bind/
bind.rs

1use std::{env::args, thread::sleep, time::Duration};
2
3use win32_notif::{
4  notification::{
5    actions::{
6      action::{ActivationType, AfterActivationBehavior},
7      ActionButton,
8    },
9    visual::{
10      text::{HintAlign, HintStyle},
11      Text,
12    },
13  },
14  NotificationBuilder, ToastsNotifier,
15};
16
17const _GUID: u128 = 23885548255760334674942869530154890271u128;
18
19pub fn main() {
20  let notifier = ToastsNotifier::new("com.ahqstore.app").unwrap();
21
22  let mut argv = args();
23
24  argv.next();
25  argv.next();
26  argv.next();
27
28  if let Some(_) = argv.next() {
29    let notification = NotificationBuilder::new()
30      .with_use_button_style(true)
31      .visual(
32        Text::create_binded(0, "hi")
33          .with_style(HintStyle::Header)
34          .with_align(HintAlign::Right),
35      )
36      .value("hi", "This is binded string")
37      .action(
38        ActionButton::create("test")
39          .with_tooltip("Answer")
40          .with_id("answer")
41          .with_activation_type(ActivationType::Background)
42          .with_after_activation_behavior(AfterActivationBehavior::PendingUpdate),
43      )
44      .value("test", "Hello World")
45      .build(1, &notifier, "a", "ahq")
46      .expect("Error");
47
48    notification.show().expect("Not Sent");
49  }
50
51  loop {
52    sleep(Duration::from_millis(10));
53  }
54}