pub struct ToastNotification(/* private fields */);Implementations§
Source§impl ToastNotification
impl ToastNotification
pub fn Content(&self) -> Result<XmlDocument, Error>
pub fn SetExpirationTime<'a, Param0>(&self, value: Param0) -> Result<(), Error>where
Param0: IntoParam<'a, IReference<DateTime>>,
pub fn ExpirationTime(&self) -> Result<IReference<DateTime>, Error>
pub fn Dismissed<'a, Param0>( &self, handler: Param0, ) -> Result<EventRegistrationToken, Error>
pub fn RemoveDismissed<'a, Param0>(&self, token: Param0) -> Result<(), Error>where
Param0: IntoParam<'a, EventRegistrationToken>,
pub fn Activated<'a, Param0>( &self, handler: Param0, ) -> Result<EventRegistrationToken, Error>
pub fn RemoveActivated<'a, Param0>(&self, token: Param0) -> Result<(), Error>where
Param0: IntoParam<'a, EventRegistrationToken>,
pub fn Failed<'a, Param0>( &self, handler: Param0, ) -> Result<EventRegistrationToken, Error>
pub fn RemoveFailed<'a, Param0>(&self, token: Param0) -> Result<(), Error>where
Param0: IntoParam<'a, EventRegistrationToken>,
pub fn SetTag<'a, Param0>(&self, value: Param0) -> Result<(), Error>where
Param0: IntoParam<'a, HSTRING>,
pub fn Tag(&self) -> Result<HSTRING, Error>
pub fn SetGroup<'a, Param0>(&self, value: Param0) -> Result<(), Error>where
Param0: IntoParam<'a, HSTRING>,
pub fn Group(&self) -> Result<HSTRING, Error>
pub fn SetSuppressPopup(&self, value: bool) -> Result<(), Error>
pub fn SuppressPopup(&self) -> Result<bool, Error>
Sourcepub fn CreateToastNotification<'a, Param0>(
content: Param0,
) -> Result<ToastNotification, Error>where
Param0: IntoParam<'a, XmlDocument>,
pub fn CreateToastNotification<'a, Param0>(
content: Param0,
) -> Result<ToastNotification, Error>where
Param0: IntoParam<'a, XmlDocument>,
Examples found in repository?
examples/without_library.rs (line 51)
29fn do_toast() -> windows::runtime::Result<()> {
30 let toast_xml = XmlDocument::new()?;
31
32 toast_xml.LoadXml(HSTRING::from(
33 format!(r#"<toast duration="long">
34 <visual>
35 <binding template="ToastGeneric">
36 <text id="1">title</text>
37 <text id="2">first line</text>
38 <text id="3">third line</text>
39 <image placement="appLogoOverride" hint-crop="circle" src="file:///c:/path_to_image_above_toast.jpg" alt="alt text" />
40 <image placement="Hero" src="file:///C:/path_to_image_in_toast.jpg" alt="alt text2" />
41 <image id="1" src="file:///{}" alt="another_image" />
42 </binding>
43 </visual>
44 <audio src="ms-winsoundevent:Notification.SMS" />
45 <!-- <audio silent="true" /> -->
46 </toast>"#,
47 escape_str_attribute(&Path::new("C:\\path_to_image_in_toast.jpg").display().to_string()),
48 ))).expect("the xml is malformed");
49
50 // Create the toast and attach event listeners
51 let toast_template = ToastNotification::CreateToastNotification(toast_xml)?;
52
53 // If you have a valid app id, (ie installed using wix) then use it here.
54 let toast_notifier = ToastNotificationManager::CreateToastNotifierWithId(HSTRING::from(
55 "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\\WindowsPowerShell\\v1.0\\powershell.exe",
56 ))?;
57
58 // Show the toast.
59 // Note this returns success in every case, including when the toast isn't shown.
60 toast_notifier.Show(&toast_template)
61}pub fn NotificationMirroring(&self) -> Result<NotificationMirroring, Error>
pub fn SetNotificationMirroring( &self, value: NotificationMirroring, ) -> Result<(), Error>
pub fn RemoteId(&self) -> Result<HSTRING, Error>
pub fn SetRemoteId<'a, Param0>(&self, value: Param0) -> Result<(), Error>where
Param0: IntoParam<'a, HSTRING>,
pub fn Data(&self) -> Result<NotificationData, Error>
pub fn SetData<'a, Param0>(&self, value: Param0) -> Result<(), Error>where
Param0: IntoParam<'a, NotificationData>,
pub fn Priority(&self) -> Result<ToastNotificationPriority, Error>
pub fn SetPriority(&self, value: ToastNotificationPriority) -> Result<(), Error>
pub fn ExpiresOnReboot(&self) -> Result<bool, Error>
pub fn SetExpiresOnReboot(&self, value: bool) -> Result<(), Error>
pub fn IToastNotificationFactory<R, F>(callback: F) -> Result<R, Error>
Trait Implementations§
Source§impl Clone for ToastNotification
impl Clone for ToastNotification
Source§fn clone(&self) -> ToastNotification
fn clone(&self) -> ToastNotification
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ToastNotification
impl Debug for ToastNotification
Source§impl Interface for ToastNotification
impl Interface for ToastNotification
Source§impl PartialEq for ToastNotification
impl PartialEq for ToastNotification
impl Eq for ToastNotification
impl Send for ToastNotification
impl StructuralPartialEq for ToastNotification
impl Sync for ToastNotification
Auto Trait Implementations§
impl Freeze for ToastNotification
impl RefUnwindSafe for ToastNotification
impl Unpin for ToastNotification
impl UnwindSafe for ToastNotification
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more