Files
FluentTerminal/FluentTerminal.App.Services/Implementation/NotificationService.cs
T
Eric Cornelissen 2f58ed63de Add About page to the settings window (#103)
* create "About" page in settings

* add content to About page

* Get latest version from GitHub

* Add NotificationService to servies

* Enable actions on notifications

* Get latest version asynchroniously

* Handle when latest version is not found and clean code

* Remove old UpdateService

* Remove old NotificationService

* Add icon for about tab

* Update About page styling

* Make About menu item a footer menu item

* Update About page layout

Based on suggestions by @felixse

* Instatiate temporary navigation item only once

This seems to solve display issues when opening the "About" page multiple times where the main navigation list is being rerendered for no apparent reason.

* Revert unintended changes

* Added shortcut to about page in hamburger menu

* Move About page properties to the AboutPageViewModel

* Make "loading..." and "Not found" italic to indicate non-default behaviour

* move update check back to systemtray

* Made IUpdateService async
2018-10-28 13:55:36 +01:00

31 lines
1014 B
C#

using System.Diagnostics;
using Windows.Data.Xml.Dom;
using Windows.UI.Notifications;
namespace FluentTerminal.App.Services.Implementation
{
public class NotificationService : INotificationService
{
public void ShowNotification(string title, string content, string url = null)
{
string xml = $@"<toast>
<visual>
<binding template='ToastGeneric'>
<text>{title}</text>
<text>{content}</text>
</binding>
</visual>
</toast>";
var doc = new XmlDocument();
doc.LoadXml(xml);
var toast = new ToastNotification(doc);
if (url != null)
{
toast.Activated += (n, o) => Process.Start(url);
}
ToastNotificationManager.CreateToastNotifier().Show(toast);
}
}
}