Skip to content

Commit 89ed383

Browse files
committed
Add back top level action type in samples
1 parent 305dd6f commit 89ed383

File tree

7 files changed

+22
-9
lines changed

7 files changed

+22
-9
lines changed

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Toast/ToastCode.bind

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ private void PopToast()
22
{
33
// Generate the toast notification content and pop the toast
44
new ToastContentBuilder().SetToastScenario(ToastScenario.Reminder)
5+
.AddArgument("action", "viewEvent")
56
.AddArgument("eventId", 1983)
67
.AddText("Adaptive Tiles Meeting")
78
.AddText("Conf Room 2001 / Building 135")

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Toast/ToastPage.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public static ToastContent GenerateToastContent()
3030
{
3131
var builder = new ToastContentBuilder()
3232
.SetToastScenario(ToastScenario.Reminder)
33+
.AddArgument("action", "viewEvent")
3334
.AddArgument("eventId", 1983)
3435
.AddText("Adaptive Tiles Meeting")
3536
.AddText("Conf Room 2001 / Building 135")

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/WeatherLiveTileAndToast/WeatherLiveTileAndToastCode.bind

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ private void PopToast()
44
ToastContentBuilder builder = new ToastContentBuilder();
55

66
// Include launch string so we know what to open when user clicks toast
7+
builder.AddArgument("action", "viewForecast");
78
builder.AddArgument("zip", 98008);
89

910
// We'll always have this summary text on our toast notification

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/WeatherLiveTileAndToast/WeatherLiveTileAndToastPage.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public static ToastContent GenerateToastContent()
2929
ToastContentBuilder builder = new ToastContentBuilder();
3030

3131
// Include launch string so we know what to open when user clicks toast
32+
builder.AddArgument("action", "viewForecast");
3233
builder.AddArgument("zip", 98008);
3334

3435
// We'll always have this summary text on our toast notification

Microsoft.Toolkit.Win32.WpfCore.SampleApp/App.xaml.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,21 @@ private void ToastNotificationManagerCompat_OnActivated(ToastNotificationActivat
5050
int conversationId = args.GetInt("conversationId");
5151

5252
// If no specific action, view the conversation
53-
if (!args.TryGetValue("action", out MyToastActions action))
54-
{
55-
// Make sure we have a window open and in foreground
56-
OpenWindowIfNeeded();
57-
58-
// And then show the conversation
59-
(Current.Windows[0] as MainWindow).ShowConversation(conversationId);
60-
}
61-
else
53+
if (args.TryGetValue("action", out MyToastActions action))
6254
{
6355
switch (action)
6456
{
57+
// View conversation
58+
case MyToastActions.ViewConversation:
59+
60+
// Make sure we have a window open and in foreground
61+
OpenWindowIfNeeded();
62+
63+
// And then show the conversation
64+
(Current.Windows[0] as MainWindow).ShowConversation(conversationId);
65+
66+
break;
67+
6568
// Open the image
6669
case MyToastActions.ViewImage:
6770

Microsoft.Toolkit.Win32.WpfCore.SampleApp/MainWindow.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ private async void ButtonPopToast_Click(object sender, RoutedEventArgs e)
3636
new ToastContentBuilder()
3737

3838
// Arguments that are returned when the user clicks the toast or a button
39+
.AddArgument("action", MyToastActions.ViewConversation)
3940
.AddArgument("conversationId", conversationId)
4041

4142
// Visual content

Microsoft.Toolkit.Win32.WpfCore.SampleApp/MyToastActions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ namespace Microsoft.Toolkit.Win32.WpfCore.SampleApp
66
{
77
public enum MyToastActions
88
{
9+
/// <summary>
10+
/// View the conversation
11+
/// </summary>
12+
ViewConversation,
13+
914
/// <summary>
1015
/// Inline reply to a message
1116
/// </summary>

0 commit comments

Comments
 (0)