diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/SampleLiveTiles.gif b/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/SampleLiveTiles.gif
new file mode 100644
index 000000000..c4a4b0b37
Binary files /dev/null and b/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/SampleLiveTiles.gif differ
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/SampleToast.gif b/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/SampleToast.gif
new file mode 100644
index 000000000..0456e52a9
Binary files /dev/null and b/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/SampleToast.gif differ
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherTileLarge.png b/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherTileLarge.png
new file mode 100644
index 000000000..ce5c683b2
Binary files /dev/null and b/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherTileLarge.png differ
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherTileMedium.png b/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherTileMedium.png
new file mode 100644
index 000000000..edc4fd99c
Binary files /dev/null and b/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherTileMedium.png differ
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherTileSmall.png b/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherTileSmall.png
new file mode 100644
index 000000000..2a95c4800
Binary files /dev/null and b/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherTileSmall.png differ
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherTileWide.png b/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherTileWide.png
new file mode 100644
index 000000000..a3316cc32
Binary files /dev/null and b/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherTileWide.png differ
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherToast.png b/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherToast.png
new file mode 100644
index 000000000..0686ce05f
Binary files /dev/null and b/Microsoft.Toolkit.Uwp.SampleApp/Assets/NotificationAssets/WeatherToast.png differ
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj b/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj
index d828e47ae..37ec112a0 100644
--- a/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj
+++ b/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj
@@ -119,9 +119,6 @@
2.0.1
-
- 1.0.5
-
4.5.0
@@ -142,6 +139,8 @@
+
+
@@ -150,6 +149,11 @@
+
+
+
+
+
@@ -1562,4 +1566,4 @@
-
+
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/LiveTile/LiveTilePage.xaml b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/LiveTile/LiveTilePage.xaml
index 459f6133f..59aa07a68 100644
--- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/LiveTile/LiveTilePage.xaml
+++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/LiveTile/LiveTilePage.xaml
@@ -3,8 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:visualizer="using:NotificationsVisualizerLibrary"
- xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
@@ -23,7 +21,8 @@
Margin="20,20,20,0"
HorizontalAlignment="Stretch"
Click="ButtonPinTile_Click"
- Content="Pin Tile" />
+ Content="Pin Tile"
+ Style="{ThemeResource AccentButtonStyle}" />
Click the button to pin a secondary tile and send a notification to the tile, displaying rich visual content. The previews below show you what the tile will look like when you pin it.
@@ -35,52 +34,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/LiveTile/LiveTilePage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/LiveTile/LiveTilePage.xaml.cs
index ed74df574..b26782b51 100644
--- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/LiveTile/LiveTilePage.xaml.cs
+++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/LiveTile/LiveTilePage.xaml.cs
@@ -5,24 +5,18 @@
using System;
using Microsoft.Toolkit.Uwp.Notifications;
using Microsoft.Toolkit.Uwp.SampleApp.Common;
-using Microsoft.Toolkit.Uwp.SampleApp.Models;
-using NotificationsVisualizerLibrary;
using Windows.UI.Notifications;
using Windows.UI.StartScreen;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Navigation;
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
public sealed partial class LiveTilePage : Page
{
- private TileContent _tileContent;
-
public LiveTilePage()
{
InitializeComponent();
- Initialize();
}
public static TileContent GenerateTileContent(string username, string avatarLogoSource)
@@ -149,31 +143,9 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
return;
}
- TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Update(new TileNotification(_tileContent.GetXml()));
- }
-
- private void Initialize()
- {
- // Generate the tile notification content
- _tileContent = GenerateTileContent("MasterHip", "Assets/Photos/Owl.jpg");
-
- // Prepare and update the preview tiles
- var previewTiles = new PreviewTile[] { MediumPreviewTile, WidePreviewTile, LargePreviewTile };
- foreach (var tile in previewTiles)
- {
- tile.DisplayName = "Xbox";
- tile.VisualElements.BackgroundColor = Constants.ApplicationBackgroundColor;
- tile.VisualElements.ShowNameOnSquare150x150Logo = true;
- tile.VisualElements.ShowNameOnSquare310x310Logo = true;
- tile.VisualElements.ShowNameOnWide310x150Logo = true;
- tile.VisualElements.Square44x44Logo = Constants.Square44x44Logo;
- tile.VisualElements.Square150x150Logo = Constants.Square150x150Logo;
- tile.VisualElements.Wide310x150Logo = Constants.Wide310x150Logo;
- tile.VisualElements.Square310x310Logo = Constants.Square310x310Logo;
- _ = tile.UpdateAsync(); // Commit changes (no need to await)
-
- tile.CreateTileUpdater().Update(new TileNotification(_tileContent.GetXml()));
- }
+ // Generate the tile notification content and update the tile
+ TileContent content = GenerateTileContent("MasterHip", "Assets/Photos/Owl.jpg");
+ TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Update(new TileNotification(content.GetXml()));
}
}
}
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Toast/ToastPage.xaml b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Toast/ToastPage.xaml
index 18c2c3f99..868846451 100644
--- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Toast/ToastPage.xaml
+++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Toast/ToastPage.xaml
@@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:visualizer="using:NotificationsVisualizerLibrary"
mc:Ignorable="d">
@@ -21,7 +20,8 @@
+ Content="Pop Toast"
+ Style="{ThemeResource AccentButtonStyle}" />
The button will pop a Toast notification reminder about your calendar appointment. A preview is seen below.
@@ -42,9 +42,7 @@
-
+
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Toast/ToastPage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Toast/ToastPage.xaml.cs
index 7c71ec7fb..9ccd047a7 100644
--- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Toast/ToastPage.xaml.cs
+++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Toast/ToastPage.xaml.cs
@@ -3,32 +3,29 @@
// See the LICENSE file in the project root for more information.
using Microsoft.Toolkit.Uwp.Notifications;
-using Microsoft.Toolkit.Uwp.SampleApp.Common;
-using Microsoft.Toolkit.Uwp.SampleApp.Models;
-using NotificationsVisualizerLibrary;
-using Windows.UI.Notifications;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Navigation;
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
public sealed partial class ToastPage : Page
{
- private ToastContent _toastContent;
-
public ToastPage()
{
InitializeComponent();
- Initialize();
+ }
+
+ private void ButtonPopToast_Click(object sender, RoutedEventArgs e)
+ {
+ PopToast();
}
#pragma warning disable SA1008 // Parenthesis spacing
#pragma warning disable SA1117 // Parameters must be on same line or separate lines
- public static ToastContent GenerateToastContent()
+ private void PopToast()
{
- var builder = new ToastContentBuilder()
+ new ToastContentBuilder()
.SetToastScenario(ToastScenario.Reminder)
.AddArgument("action", "viewEvent")
.AddArgument("eventId", 1983)
@@ -43,37 +40,11 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
.AddButton(new ToastButton()
.SetSnoozeActivation("snoozeTime"))
.AddButton(new ToastButton()
- .SetDismissActivation());
-
- return builder.Content;
+ .SetDismissActivation())
+ .Show();
}
#pragma warning restore SA1008
#pragma warning restore SA1117
-
- private void ButtonPopToast_Click(object sender, RoutedEventArgs e)
- {
- PopToast();
- }
-
- private void PopToast()
- {
- ToastNotificationManagerCompat.CreateToastNotifier().Show(new ToastNotification(_toastContent.GetXml()));
- }
-
- private void Initialize()
- {
- // Generate the toast notification content
- _toastContent = GenerateToastContent();
-
- // Prepare and update preview toast
- PreviewToastReminder.Properties = new PreviewToastProperties()
- {
- BackgroundColor = Constants.ApplicationBackgroundColor,
- DisplayName = Constants.ApplicationDisplayName,
- Square44x44Logo = Constants.Square44x44Logo
- };
- PreviewToastReminder.Initialize(_toastContent.GetXml());
- }
}
}
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/WeatherLiveTileAndToast/WeatherLiveTileAndToastPage.xaml b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/WeatherLiveTileAndToast/WeatherLiveTileAndToastPage.xaml
index 1f6eb7da0..f035f1579 100644
--- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/WeatherLiveTileAndToast/WeatherLiveTileAndToastPage.xaml
+++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/WeatherLiveTileAndToast/WeatherLiveTileAndToastPage.xaml
@@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:visualizer="using:NotificationsVisualizerLibrary"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
@@ -22,12 +21,14 @@
+ Content="Pop Toast"
+ Style="{ThemeResource AccentButtonStyle}" />
+ Content="Pin Tile"
+ Style="{ThemeResource AccentButtonStyle}" />
The first button will pop a Toast notification displaying the weather forecast.
@@ -52,9 +53,7 @@
-
+
-
+
-
+
-
+
-
+
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/WeatherLiveTileAndToast/WeatherLiveTileAndToastPage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/WeatherLiveTileAndToast/WeatherLiveTileAndToastPage.xaml.cs
index d65bb60c2..f902e3394 100644
--- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/WeatherLiveTileAndToast/WeatherLiveTileAndToastPage.xaml.cs
+++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/WeatherLiveTileAndToast/WeatherLiveTileAndToastPage.xaml.cs
@@ -5,7 +5,6 @@
using System;
using Microsoft.Toolkit.Uwp.Notifications;
using Microsoft.Toolkit.Uwp.SampleApp.Common;
-using NotificationsVisualizerLibrary;
using Windows.System.Profile;
using Windows.UI.Notifications;
using Windows.UI.StartScreen;
@@ -15,13 +14,9 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
public sealed partial class WeatherLiveTileAndToastPage
{
- private TileContent _tileContent;
- private ToastContent _toastContent;
-
public WeatherLiveTileAndToastPage()
{
InitializeComponent();
- Initialize();
}
public static ToastContent GenerateToastContent()
@@ -276,7 +271,9 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
return;
}
- TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Update(new TileNotification(_tileContent.GetXml()));
+ // Generate the tile notification content and update the tile
+ TileContent content = GenerateTileContent();
+ TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Update(new TileNotification(content.GetXml()));
}
private void ButtonPopToast_Click(object sender, RoutedEventArgs e)
@@ -286,43 +283,48 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
private void PopToast()
{
- ToastNotificationManagerCompat.CreateToastNotifier().Show(new ToastNotification(_toastContent.GetXml()));
- }
-
- private void Initialize()
- {
- // Generate the tile notification content
- _tileContent = GenerateTileContent();
-
// Generate the toast notification content
- _toastContent = GenerateToastContent();
+ ToastContentBuilder builder = new ToastContentBuilder();
- // Prepare and update the preview tiles
- var previewTiles = new PreviewTile[] { PreviewTileSmall, PreviewTileMedium, PreviewTileWide, PreviewTileLarge };
- foreach (var tile in previewTiles)
+ // Include launch string so we know what to open when user clicks toast
+ builder.AddArgument("action", "viewForecast");
+ builder.AddArgument("zip", 98008);
+
+ // We'll always have this summary text on our toast notification
+ // (it is required that your toast starts with a text element)
+ builder.AddText("Today will be mostly sunny with a high of 63 and a low of 42.");
+
+ // If Adaptive Toast Notifications are supported
+ if (IsAdaptiveToastSupported())
{
- tile.DisplayName = "WeatherSample";
- tile.VisualElements.BackgroundColor = Constants.ApplicationBackgroundColor;
- tile.VisualElements.ShowNameOnSquare150x150Logo = true;
- tile.VisualElements.ShowNameOnSquare310x310Logo = true;
- tile.VisualElements.ShowNameOnWide310x150Logo = true;
- tile.VisualElements.Square44x44Logo = Constants.Square44x44Logo;
- tile.VisualElements.Square150x150Logo = Constants.Square150x150Logo;
- tile.VisualElements.Wide310x150Logo = Constants.Wide310x150Logo;
- tile.VisualElements.Square310x310Logo = Constants.Square310x310Logo;
- _ = tile.UpdateAsync(); // Commit changes (no need to await)
-
- tile.CreateTileUpdater().Update(new TileNotification(_tileContent.GetXml()));
+ // Use the rich Tile-like visual layout
+ builder.AddVisualChild(new AdaptiveGroup()
+ {
+ Children =
+ {
+ GenerateSubgroup("Mon", "Mostly Cloudy.png", 63, 42),
+ GenerateSubgroup("Tue", "Cloudy.png", 57, 38),
+ GenerateSubgroup("Wed", "Sunny.png", 59, 43),
+ GenerateSubgroup("Thu", "Sunny.png", 62, 42),
+ GenerateSubgroup("Fri", "Sunny.png", 71, 66)
+ }
+ });
}
- // Prepare and update preview toast
- PreviewToastWeather.Properties = new PreviewToastProperties()
+ // Otherwise...
+ else
{
- BackgroundColor = Constants.ApplicationBackgroundColor,
- DisplayName = Constants.ApplicationDisplayName,
- Square44x44Logo = Constants.Square44x44Logo
- };
- PreviewToastWeather.Initialize(_toastContent.GetXml());
+ // We'll just add two simple lines of text
+ builder
+ .AddText("Monday ⛅ 63° / 42°")
+ .AddText("Tuesday ☁ 57° / 38°");
+ }
+
+ // Set the base URI for the images, so we don't redundantly specify the entire path
+ builder.Content.Visual.BaseUri = new Uri("Assets/NotificationAssets/", UriKind.Relative);
+
+ // Show the toast
+ builder.Show();
}
}
}
\ No newline at end of file