Remove NotificationsVisualizerLibrary from sample app (#4259)

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.
This commit is contained in:
Andrew Leader 2021-09-20 13:46:54 -07:00 коммит произвёл GitHub
Родитель 7816189147
Коммит fa96904bd4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
14 изменённых файлов: 77 добавлений и 182 удалений

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 182 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 173 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 10 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 921 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 12 KiB

Просмотреть файл

@ -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>
@ -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" />
@ -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" />
@ -1562,4 +1566,4 @@
</Target>
<!-- No-op to avoid build error when packing solution from commandline -->
<Target Name="Pack" />
</Project>
</Project>

Просмотреть файл

@ -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>
@ -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>
@ -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>

Просмотреть файл

@ -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()));
}
}
}

Просмотреть файл

@ -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>
@ -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>
@ -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>

Просмотреть файл

@ -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());
}
}
}

Просмотреть файл

@ -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 @@
<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>
@ -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
@ -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
@ -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
@ -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
@ -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>

Просмотреть файл

@ -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();
}
}
}