• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

examples/H03-May-2022-158120

resources/test/H03-May-2022-

src/H03-May-2022-381255

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D01-Jan-197074 65

.gitignoreH A D29-Nov-197334 43

.rustfmt.tomlH A D29-Nov-197376 43

CHANGELOG.mdH A D29-Nov-19731,022 4430

Cargo.lockH A D01-Jan-19703.3 KiB126110

Cargo.tomlH A D01-Jan-19701.5 KiB3835

Cargo.toml.orig-cargoH A D29-Nov-19731.1 KiB4136

README.mdH A D29-Nov-19732.2 KiB7357

appveyor.ymlH A D29-Nov-19734 KiB11498

README.md

1# winrt-notification
2
3[![license](https://img.shields.io/crates/l/winrt-notification.svg)](https://crates.io/crates/winrt-notification/)
4[![version](https://img.shields.io/crates/v/winrt-notification.svg)](https://crates.io/crates/winrt-notification/)
5[![Build Status](https://img.shields.io/appveyor/ci/allenbenz/winrt-notification.svg)](https://ci.appveyor.com/project/allenbenz/winrt-notification)
6
7An incomplete wrapper over the WinRT toast api
8
9Tested in Windows 10 and 8.1. Untested in Windows 8, might work.
10
11[0.5 Documentation](https://allenbenz.github.io/winrt-notification/0_5_0/winrt_notification/index.html)
12
13[0.2 Documentation](https://allenbenz.github.io/winrt-notification/0_2_0/winrt_notification/index.html)
14
15Todo:
16* Add support for Adaptive Content
17* Add support for Actions
18
19Known Issues:
20* Will not work for Windows 7.
21
22Limitations:
23* Windows 8.1 only supports a single image, the last image (icon, hero, image) will be the one on the toast
24
25## Usage
26
27```toml
28#Cargo.toml
29[dependencies]
30winrt-notification = "0.5.0"
31```
32
33## Examples
34
35```rust
36extern crate winrt_notification;
37use winrt_notification::{Duration, Sound, Toast};
38
39fn main() {
40    Toast::new(Toast::POWERSHELL_APP_ID)
41        .title("Look at this flip!")
42        .text1("(╯°□°)╯︵ ┻━┻")
43        .sound(Some(Sound::SMS))
44        .duration(Duration::Short)
45        .show()
46        .expect("unable to toast");
47}
48```
49
50```rust
51extern crate winrt_notification;
52use std::path::Path;
53use winrt_notification::{IconCrop, Toast};
54
55fn main() {
56    Toast::new("Your AppUserModeId")
57        .hero(&Path::new("C:\\absolute\\path\\to\\image.jpeg"), "alt text")
58        .icon(
59            &Path::new("c:/this/style/works/too/image.png"),
60            IconCrop::Circular,
61            "alt text",
62        )
63        .title("Lots of pictures here")
64        .text1("One above the text as the hero")
65        .text2("One to the left as an icon, and several below")
66        .image(&Path::new("c:/photos/sun.png"), "the sun")
67        .image(&Path::new("c:/photos/moon.png"), "the moon")
68        .sound(None) // will be silent
69        .show()
70        .expect("unable to toast");
71}
72```
73