mirror of
https://github.com/JG2401/DownloadsFileSync.git
synced 2026-08-28 20:20:11 +00:00
show message only if files exist
This commit is contained in:
@@ -40,24 +40,27 @@ while ($true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#NOTIFICATION
|
if($files.Count -gt 0)
|
||||||
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
|
{
|
||||||
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText02)
|
#NOTIFICATION
|
||||||
|
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
|
||||||
|
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText02)
|
||||||
|
|
||||||
$toastXml = [xml] $template.GetXml()
|
$toastXml = [xml] $template.GetXml()
|
||||||
$toastXml.GetElementsByTagName("text").Item(0).AppendChild($toastXml.CreateTextNode("Files synchronized")) > $null
|
$toastXml.GetElementsByTagName("text").Item(0).AppendChild($toastXml.CreateTextNode("Files synchronized")) > $null
|
||||||
$toastXml.GetElementsByTagName("text").Item(1).AppendChild($toastXml.CreateTextNode("$($counter) of $($files.Count)")) > $null
|
$toastXml.GetElementsByTagName("text").Item(1).AppendChild($toastXml.CreateTextNode("$($counter) of $($files.Count)")) > $null
|
||||||
|
|
||||||
$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
|
$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
|
||||||
$xml.LoadXml($toastXml.OuterXml)
|
$xml.LoadXml($toastXml.OuterXml)
|
||||||
|
|
||||||
$toast = [Windows.UI.Notifications.ToastNotification]::new($xml)
|
$toast = [Windows.UI.Notifications.ToastNotification]::new($xml)
|
||||||
$toast.Tag = "DownloadsFileSync"
|
$toast.Tag = "DownloadsFileSync"
|
||||||
$toast.Group = "DownloadsFileSync"
|
$toast.Group = "DownloadsFileSync"
|
||||||
$toast.ExpirationTime = [DateTimeOffset]::Now.AddMinutes(1)
|
$toast.ExpirationTime = [DateTimeOffset]::Now.AddMinutes(1)
|
||||||
|
|
||||||
$notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("DownloadsFileSync")
|
$notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("DownloadsFileSync")
|
||||||
$notifier.Show($toast);
|
$notifier.Show($toast);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#START-SLEEP
|
#START-SLEEP
|
||||||
|
|||||||
Reference in New Issue
Block a user