Skip to content

Commit 1427242

Browse files
committed
Merge branch 'main' into winui
# Conflicts: # CommunityToolkit.WinUI.SampleApp.Package/Images/NotificationAssets/SampleLiveTiles.gif # CommunityToolkit.WinUI.SampleApp.Package/Images/NotificationAssets/SampleToast.gif # CommunityToolkit.WinUI.SampleApp.Package/Images/NotificationAssets/WeatherTileLarge.png # CommunityToolkit.WinUI.SampleApp.Package/Images/NotificationAssets/WeatherTileMedium.png # CommunityToolkit.WinUI.SampleApp.Package/Images/NotificationAssets/WeatherTileSmall.png # CommunityToolkit.WinUI.SampleApp.Package/Images/NotificationAssets/WeatherTileWide.png # CommunityToolkit.WinUI.SampleApp.Package/Images/NotificationAssets/WeatherToast.png # CommunityToolkit.WinUI.SampleApp/SamplePages/LiveTile/LiveTilePage.xaml # CommunityToolkit.WinUI.SampleApp/SamplePages/LiveTile/LiveTilePage.xaml.cs # CommunityToolkit.WinUI.SampleApp/SamplePages/Toast/ToastPage.xaml.cs # CommunityToolkit.WinUI.SampleApp/SamplePages/WeatherLiveTileAndToast/WeatherLiveTileAndToastPage.xaml # CommunityToolkit.WinUI.SampleApp/SamplePages/WeatherLiveTileAndToast/WeatherLiveTileAndToastPage.xaml.cs # Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj
2 parents 5c5c487 + fa96904 commit 1427242

14 files changed

+67
-187
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
Loading

CommunityToolkit.WinUI.SampleApp/CommunityToolkit.WinUI.SampleApp.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed">
3737
<Version>2.0.4</Version>
3838
</PackageReference>
39-
<PackageReference Include="NotificationsVisualizerLibrary.WinUI">
40-
<Version>2.0.1</Version>
41-
</PackageReference>
4239
<PackageReference Include="System.ValueTuple">
4340
<Version>4.5.0</Version>
4441
</PackageReference>

CommunityToolkit.WinUI.SampleApp/SamplePages/LiveTile/LiveTilePage.xaml

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6-
xmlns:visualizer="using:NotificationsVisualizerLibrary"
7-
xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
86
mc:Ignorable="d">
97

108
<Page.Resources>
@@ -23,7 +21,8 @@
2321
Margin="20,20,20,0"
2422
HorizontalAlignment="Stretch"
2523
Click="ButtonPinTile_Click"
26-
Content="Pin Tile" />
24+
Content="Pin Tile"
25+
Style="{ThemeResource AccentButtonStyle}" />
2726

2827
<RichTextBlock Margin="20,10,20,0">
2928
<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 @@
3534
</Paragraph>
3635
</RichTextBlock>
3736

38-
<controls:WrapPanel
39-
Margin="18"
40-
HorizontalAlignment="Center">
41-
42-
<StackPanel
43-
HorizontalAlignment="Center"
44-
Padding="20"
45-
Background="{ThemeResource Brush-Grey-04}"
46-
Margin="10">
47-
<TextBlock
48-
Text="MEDIUM"
49-
Style="{StaticResource Box-Header}" />
50-
<visualizer:PreviewTile x:Name="MediumPreviewTile"
51-
IsAnimationEnabled="False"
52-
TileSize="Medium"
53-
HorizontalAlignment="Center" />
54-
</StackPanel>
55-
56-
<StackPanel
57-
HorizontalAlignment="Center"
58-
Padding="20"
59-
Background="{ThemeResource Brush-Grey-04}"
60-
Margin="10">
61-
<TextBlock
62-
Text="WIDE"
63-
Style="{StaticResource Box-Header}" />
64-
<visualizer:PreviewTile x:Name="WidePreviewTile"
65-
IsAnimationEnabled="False"
66-
TileSize="Wide"
67-
HorizontalAlignment="Center" />
68-
</StackPanel>
69-
70-
<StackPanel
71-
HorizontalAlignment="Center"
72-
Padding="20"
73-
Background="{ThemeResource Brush-Grey-04}"
74-
Margin="10">
75-
<TextBlock
76-
Text="LARGE"
77-
Style="{StaticResource Box-Header}" />
78-
<visualizer:PreviewTile x:Name="LargePreviewTile"
79-
IsAnimationEnabled="False"
80-
TileSize="Large"
81-
HorizontalAlignment="Center" />
82-
</StackPanel>
83-
</controls:WrapPanel>
37+
<Border Background="{ThemeResource Brush-Grey-04}" Padding="20" HorizontalAlignment="Center" Margin="18">
38+
<Image Source="ms-appx:///Assets/NotificationAssets/SampleLiveTiles.gif" Width="400"/>
39+
</Border>
40+
8441
</StackPanel>
8542
</ScrollViewer>
8643
</Page>

CommunityToolkit.WinUI.SampleApp/SamplePages/LiveTile/LiveTilePage.xaml.cs

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,18 @@
55
using System;
66
using CommunityToolkit.WinUI.Notifications;
77
using CommunityToolkit.WinUI.SampleApp.Common;
8-
using CommunityToolkit.WinUI.SampleApp.Models;
98
using Microsoft.UI.Xaml;
109
using Microsoft.UI.Xaml.Controls;
11-
using Microsoft.UI.Xaml.Navigation;
12-
using NotificationsVisualizerLibrary;
1310
using Windows.UI.Notifications;
1411
using Windows.UI.StartScreen;
1512

1613
namespace CommunityToolkit.WinUI.SampleApp.SamplePages
1714
{
1815
public sealed partial class LiveTilePage : Page
1916
{
20-
private TileContent _tileContent;
21-
2217
public LiveTilePage()
2318
{
2419
InitializeComponent();
25-
Initialize();
2620
}
2721

2822
public static TileContent GenerateTileContent(string username, string avatarLogoSource)
@@ -149,34 +143,9 @@ private async void PinTile()
149143
return;
150144
}
151145

152-
TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Update(new TileNotification(_tileContent.GetXml()));
153-
}
154-
155-
private void Initialize()
156-
{
157-
// Generate the tile notification content
158-
_tileContent = GenerateTileContent("MasterHip", "Assets/Photos/Owl.jpg");
159-
160-
// Prepare and update the preview tiles
161-
var previewTiles = new PreviewTile[]
162-
{
163-
MediumPreviewTile, WidePreviewTile, LargePreviewTile
164-
};
165-
foreach (var tile in previewTiles)
166-
{
167-
tile.DisplayName = "Xbox";
168-
tile.VisualElements.BackgroundColor = Constants.ApplicationBackgroundColor;
169-
tile.VisualElements.ShowNameOnSquare150x150Logo = true;
170-
tile.VisualElements.ShowNameOnSquare310x310Logo = true;
171-
tile.VisualElements.ShowNameOnWide310x150Logo = true;
172-
tile.VisualElements.Square44x44Logo = Constants.Square44x44Logo;
173-
tile.VisualElements.Square150x150Logo = Constants.Square150x150Logo;
174-
tile.VisualElements.Wide310x150Logo = Constants.Wide310x150Logo;
175-
tile.VisualElements.Square310x310Logo = Constants.Square310x310Logo;
176-
_ = tile.UpdateAsync(); // Commit changes (no need to await)
177-
178-
tile.CreateTileUpdater().Update(new TileNotification(_tileContent.GetXml()));
179-
}
146+
// Generate the tile notification content and update the tile
147+
TileContent content = GenerateTileContent("MasterHip", "Assets/Photos/Owl.jpg");
148+
TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Update(new TileNotification(content.GetXml()));
180149
}
181150
}
182151
}

0 commit comments

Comments
 (0)