Skip to main content

Crate win32_notif

Crate win32_notif 

Source
Expand description

Win32 Notification

This library implements UWP XML Toast Notification This is a safe wrapper around the official WinRT apis

§Example

use win32_notif::{
 notification::{
  actions::ActionButton,
  group::{Group, SubGroup},
  visual::{
    text::{HintAlign, HintStyle},
    Text,
  },
  Scenario,
 },
 NotificationBuilder, ToastsNotifier,
};

pub fn main() {
 let notifier = ToastsNotifier::new(Some("Microsoft.Windows.Explorer")).unwrap();

 let notification = NotificationBuilder::new()
  .with_scenario(Scenario::IncomingCall)
  .with_use_button_style(true)
  .visual(
    Group::new()
     .with_subgroup(
      SubGroup::new().with_visual(Text::create(0, "Hello World").with_style(HintStyle::Title)),
    )
    .with_subgroup(
      SubGroup::new().with_visual(
        Text::create(0, "Hello World x2")
          .with_style(HintStyle::Header)
          .with_align(HintAlign::Right),
      ),
    ),
  )
  .action(
    ActionButton::create("Answer")
    .with_tooltip("Answer")
    .with_id("answer"),
  )
  .build(1, &notifier, "a", "ahq")
  .expect("Error");

  notification.show().expect("Not Sent");
}

Modules§

data
handler
notification
notifier
registrationregistration
Registration

Macros§

string
Creates a reference to a value in notification

Structs§

Notification
The Notification Object
NotificationActivatedEventHandler
NotificationBuilder
The way to build a Notification
NotificationDataSet
NotificationDismissedEventHandler
NotificationFailedEventHandler
ToastsNotifier

Enums§

NotifError
NotificationMirroring
NotificationPriority

Traits§

ManageNotification
NotificationImpl
ToXMLunsafe