Merge pull request #4 from JG2401/develop

show message only if files exist
This commit is contained in:
JG2401
2025-01-05 17:19:38 +01:00
committed by GitHub

View File

@@ -39,25 +39,28 @@ while ($true) {
$counter++ $counter++
} }
#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() if($files.Count -gt 0)
$toastXml.GetElementsByTagName("text").Item(0).AppendChild($toastXml.CreateTextNode("Files synchronized")) > $null {
$toastXml.GetElementsByTagName("text").Item(1).AppendChild($toastXml.CreateTextNode("$($counter) of $($files.Count)")) > $null #NOTIFICATION
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText02)
$xml = New-Object Windows.Data.Xml.Dom.XmlDocument $toastXml = [xml] $template.GetXml()
$xml.LoadXml($toastXml.OuterXml) $toastXml.GetElementsByTagName("text").Item(0).AppendChild($toastXml.CreateTextNode("Files synchronized")) > $null
$toastXml.GetElementsByTagName("text").Item(1).AppendChild($toastXml.CreateTextNode("$($counter) of $($files.Count)")) > $null
$toast = [Windows.UI.Notifications.ToastNotification]::new($xml) $xml = New-Object Windows.Data.Xml.Dom.XmlDocument
$toast.Tag = "DownloadsFileSync" $xml.LoadXml($toastXml.OuterXml)
$toast.Group = "DownloadsFileSync"
$toast.ExpirationTime = [DateTimeOffset]::Now.AddMinutes(1)
$notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("DownloadsFileSync") $toast = [Windows.UI.Notifications.ToastNotification]::new($xml)
$notifier.Show($toast); $toast.Tag = "DownloadsFileSync"
$toast.Group = "DownloadsFileSync"
$toast.ExpirationTime = [DateTimeOffset]::Now.AddMinutes(1)
$notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("DownloadsFileSync")
$notifier.Show($toast);
}
#START-SLEEP #START-SLEEP