@@ -13,29 +13,42 @@ You declare your own style, however you like as long as the XML Supports it.
1313## Basic Usage
1414
1515``` rust
16- use win32_notif :: {Notif , NotifIcon , NotifState , NotifType , NotifFlags };
16+ use std :: {path :: absolute, thread :: sleep, time :: Duration };
17+
18+ use win32_notif :: {
19+ NotificationBuilder , NotificationDataSet , notification :: visual :: {Image , Placement , Text , image :: {AdaptiveImageAlign , ImageCrop }, text :: HintStyle }, notifier :: ToastsNotifier
20+ };
1721
1822fn main () {
19- let notifier = ToastsNotifier :: new (" windows app user model id " ). unwrap ();
23+ let notifier = ToastsNotifier :: new (" Microsoft.Windows.Explorer " ). unwrap ();
2024
21- // Not correct, undergoing massive rewrite
2225 let notif = NotificationBuilder :: new ()
23- . visual (Text :: new (2 , None , None , string! (" Hello There 👋🏼" )))
24- . action (ActionButton :: new (
25- string! (" Yes" ),
26- string! (" yes" ),
27- ActivationType :: Foreground ,
28- AfterActivationBehavior :: Default ,
29- None ,
30- string! (" yes" ),
31- HintButtonStyle :: Success ,
32- string! (" Yes" ),
33- false
34- ))
35- . build (2 , & * NOTIFIER , " tag" , " group" )
26+ . visual (
27+ Text :: create (0 , " Welcome to \ " win32_notif\ " !! 👋" )
28+ . align_center (true )
29+ . wrap (true )
30+ . with_style (HintStyle :: Title )
31+ )
32+ . visual (
33+ Text :: create_binded (1 , " desc" )
34+ . align_center (true )
35+ . wrap (true )
36+ . with_style (HintStyle :: Body )
37+ )
38+ . value (" desc" , " Data binding works as well {WOW}!" )
39+ . build (0 , & notifier , " 01" , " readme" )
40+ . unwrap ();
41+
42+ notif . show ()
3643 . unwrap ();
3744
38- notif . show (). unwrap ();
45+ sleep (Duration :: from_secs (1 ));
46+
47+ let data = NotificationDataSet :: new (). unwrap ();
48+
49+ data . insert (" desc" , " Hello, the message is edited" ). unwrap ();
50+
51+ notifier . update (& data , " readme" , " 01" ). unwrap ();
3952}
4053```
4154
@@ -68,8 +81,9 @@ We've actually implemented a lot of the Notification APIs
6881- Inputs
6982- Selections
7083- Visual
84+ - ** _ Idiomatic Rust Builder Style (with\_ ... methods)_ **
7185
72- and a lot of other things... 🎉
86+ ** _ and a lot of other things... 🎉_ **
7387
7488## Future Project Plan
7589
0 commit comments