Skip to content

Commit

Permalink
Remove NotificationsVisualizerLibrary from sample app (#4259)
Browse files Browse the repository at this point in the history
The NotificationsVisualizerLibrary is being deprecated/no longer updated, and we really don't need this dependency. Replacing the previews with static images/GIFs so that there are still previews of the toasts/tiles without affecting sample functionality.
  • Loading branch information
andrewleader authored Sep 20, 2021
1 parent 7816189 commit fa96904
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 181 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@
<PackageReference Include="Microsoft.Xaml.Behaviors.Uwp.Managed">
<Version>2.0.1</Version>
</PackageReference>
<PackageReference Include="NotificationsVisualizerLibrary">
<Version>1.0.5</Version>
</PackageReference>
<PackageReference Include="System.ValueTuple">
<Version>4.5.0</Version>
</PackageReference>
Expand All @@ -142,6 +139,8 @@
<Content Include="Assets\NotificationAssets\Mostly Cloudy-Background.jpg" />
<Content Include="Assets\NotificationAssets\Mostly Cloudy-Square.png" />
<Content Include="Assets\NotificationAssets\Mostly Cloudy.png" />
<Content Include="Assets\NotificationAssets\SampleLiveTiles.gif" />
<Content Include="Assets\NotificationAssets\SampleToast.gif" />
<Content Include="Assets\NotificationAssets\Slight Drizzle-Square.png" />
<Content Include="Assets\NotificationAssets\Slight Drizzle.png" />
<Content Include="Assets\NotificationAssets\Snow-Square.png" />
Expand All @@ -150,6 +149,11 @@
<Content Include="Assets\NotificationAssets\Sunny.png" />
<Content Include="Assets\NotificationAssets\Thunderstorms-Square.png" />
<Content Include="Assets\NotificationAssets\Thunderstorms.png" />
<Content Include="Assets\NotificationAssets\WeatherTileLarge.png" />
<Content Include="Assets\NotificationAssets\WeatherTileMedium.png" />
<Content Include="Assets\NotificationAssets\WeatherTileSmall.png" />
<Content Include="Assets\NotificationAssets\WeatherTileWide.png" />
<Content Include="Assets\NotificationAssets\WeatherToast.png" />
<Content Include="Assets\People\dave.png" />
<Content Include="Assets\People\david.png" />
<Content Include="Assets\People\giorgio.png" />
Expand Down Expand Up @@ -1562,4 +1566,4 @@
</Target>
<!-- No-op to avoid build error when packing solution from commandline -->
<Target Name="Pack" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<Page.Resources>
Expand All @@ -23,7 +21,8 @@
Margin="20,20,20,0"
HorizontalAlignment="Stretch"
Click="ButtonPinTile_Click"
Content="Pin Tile" />
Content="Pin Tile"
Style="{ThemeResource AccentButtonStyle}" />

<RichTextBlock Margin="20,10,20,0">
<Paragraph>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.</Paragraph>
Expand All @@ -35,52 +34,10 @@
</Paragraph>
</RichTextBlock>

<controls:WrapPanel
Margin="18"
HorizontalAlignment="Center">

<StackPanel
HorizontalAlignment="Center"
Padding="20"
Background="{ThemeResource Brush-Grey-04}"
Margin="10">
<TextBlock
Text="MEDIUM"
Style="{StaticResource Box-Header}" />
<visualizer:PreviewTile x:Name="MediumPreviewTile"
IsAnimationEnabled="False"
TileSize="Medium"
HorizontalAlignment="Center" />
</StackPanel>

<StackPanel
HorizontalAlignment="Center"
Padding="20"
Background="{ThemeResource Brush-Grey-04}"
Margin="10">
<TextBlock
Text="WIDE"
Style="{StaticResource Box-Header}" />
<visualizer:PreviewTile x:Name="WidePreviewTile"
IsAnimationEnabled="False"
TileSize="Wide"
HorizontalAlignment="Center" />
</StackPanel>

<StackPanel
HorizontalAlignment="Center"
Padding="20"
Background="{ThemeResource Brush-Grey-04}"
Margin="10">
<TextBlock
Text="LARGE"
Style="{StaticResource Box-Header}" />
<visualizer:PreviewTile x:Name="LargePreviewTile"
IsAnimationEnabled="False"
TileSize="Large"
HorizontalAlignment="Center" />
</StackPanel>
</controls:WrapPanel>
<Border Background="{ThemeResource Brush-Grey-04}" Padding="20" HorizontalAlignment="Center" Margin="18">
<Image Source="ms-appx:///Assets/NotificationAssets/SampleLiveTiles.gif" Width="400"/>
</Border>

</StackPanel>
</ScrollViewer>
</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -149,31 +143,9 @@ private async void PinTile()
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()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<Page.Resources>
Expand All @@ -21,7 +20,8 @@
<Button x:Name="ButtonPopToast"
HorizontalAlignment="Stretch"
Click="ButtonPopToast_Click"
Content="Pop Toast" />
Content="Pop Toast"
Style="{ThemeResource AccentButtonStyle}" />

<RichTextBlock Margin="0,10,0,0">
<Paragraph>The button will pop a Toast notification reminder about your calendar appointment. A preview is seen below.</Paragraph>
Expand All @@ -42,9 +42,7 @@
<TextBlock
Text="TOAST"
Style="{StaticResource Box-Header}" />
<visualizer:PreviewToast x:Name="PreviewToastReminder"
MaxWidth="362"
HorizontalAlignment="Left" />
<Image Source="ms-appx:///Assets/NotificationAssets/SampleToast.gif" Width="362"/>
</StackPanel>
</StackPanel>
</ScrollViewer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -43,37 +40,11 @@ public static ToastContent GenerateToastContent()
.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());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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">

Expand All @@ -22,12 +21,14 @@
<Button x:Name="ButtonPopToast"
HorizontalAlignment="Stretch"
Click="ButtonPopToast_Click"
Content="Pop Toast" />
Content="Pop Toast"
Style="{ThemeResource AccentButtonStyle}" />
<Button x:Name="ButtonPinTile"
Margin="0,10,0,0"
HorizontalAlignment="Stretch"
Click="ButtonPinTile_Click"
Content="Pin Tile" />
Content="Pin Tile"
Style="{ThemeResource AccentButtonStyle}" />

<RichTextBlock Margin="0,10,0,0">
<Paragraph>The first button will pop a Toast notification displaying the weather forecast.</Paragraph>
Expand All @@ -52,9 +53,7 @@
<TextBlock
Text="TOAST"
Style="{StaticResource Box-Header}" />
<visualizer:PreviewToast x:Name="PreviewToastWeather"
MaxWidth="362"
HorizontalAlignment="Center" />
<Image Source="ms-appx:///Assets/NotificationAssets/WeatherToast.png" Width="362"/>
</StackPanel>

<TextBlock
Expand All @@ -74,9 +73,7 @@
<TextBlock
Text="SMALL"
Style="{StaticResource Box-Header}" />
<visualizer:PreviewTile x:Name="PreviewTileSmall"
IsAnimationEnabled="False"
TileSize="Small" />
<Image Source="ms-appx:///Assets/NotificationAssets/WeatherTileSmall.png" Width="48"/>
</StackPanel>

<StackPanel
Expand All @@ -87,9 +84,7 @@
<TextBlock
Text="MEDIUM"
Style="{StaticResource Box-Header}" />
<visualizer:PreviewTile x:Name="PreviewTileMedium"
IsAnimationEnabled="False"
TileSize="Medium" />
<Image Source="ms-appx:///Assets/NotificationAssets/WeatherTileMedium.png" Width="100"/>
</StackPanel>

<StackPanel
Expand All @@ -100,9 +95,7 @@
<TextBlock
Text="WIDE"
Style="{StaticResource Box-Header}" />
<visualizer:PreviewTile x:Name="PreviewTileWide"
IsAnimationEnabled="False"
TileSize="Wide" />
<Image Source="ms-appx:///Assets/NotificationAssets/WeatherTileWide.png" Width="204"/>
</StackPanel>

<StackPanel
Expand All @@ -113,9 +106,7 @@
<TextBlock
Text="LARGE"
Style="{StaticResource Box-Header}" />
<visualizer:PreviewTile x:Name="PreviewTileLarge"
IsAnimationEnabled="False"
TileSize="Large" />
<Image Source="ms-appx:///Assets/NotificationAssets/WeatherTileLarge.png" Width="204"/>
</StackPanel>
</controls:WrapPanel>
</StackPanel>
Expand Down
Loading

0 comments on commit fa96904

Please sign in to comment.