Add back top level action type in samples

This commit is contained in:
Andrew Leader 2020-11-05 18:50:28 -08:00
Родитель 305dd6fb37
Коммит 89ed383f5d
7 изменённых файлов: 22 добавлений и 9 удалений

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

@ -2,6 +2,7 @@ private void PopToast()
{
// Generate the toast notification content and pop the toast
new ToastContentBuilder().SetToastScenario(ToastScenario.Reminder)
.AddArgument("action", "viewEvent")
.AddArgument("eventId", 1983)
.AddText("Adaptive Tiles Meeting")
.AddText("Conf Room 2001 / Building 135")

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

@ -30,6 +30,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
var builder = new ToastContentBuilder()
.SetToastScenario(ToastScenario.Reminder)
.AddArgument("action", "viewEvent")
.AddArgument("eventId", 1983)
.AddText("Adaptive Tiles Meeting")
.AddText("Conf Room 2001 / Building 135")

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

@ -4,6 +4,7 @@ private void PopToast()
ToastContentBuilder builder = new ToastContentBuilder();
// 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

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

@ -29,6 +29,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
ToastContentBuilder builder = new ToastContentBuilder();
// 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

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

@ -50,18 +50,21 @@ namespace Microsoft.Toolkit.Win32.WpfCore.SampleApp
int conversationId = args.GetInt("conversationId");
// If no specific action, view the conversation
if (!args.TryGetValue("action", out MyToastActions action))
{
// Make sure we have a window open and in foreground
OpenWindowIfNeeded();
// And then show the conversation
(Current.Windows[0] as MainWindow).ShowConversation(conversationId);
}
else
if (args.TryGetValue("action", out MyToastActions action))
{
switch (action)
{
// View conversation
case MyToastActions.ViewConversation:
// Make sure we have a window open and in foreground
OpenWindowIfNeeded();
// And then show the conversation
(Current.Windows[0] as MainWindow).ShowConversation(conversationId);
break;
// Open the image
case MyToastActions.ViewImage:

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

@ -36,6 +36,7 @@ namespace Microsoft.Toolkit.Win32.WpfCore.SampleApp
new ToastContentBuilder()
// Arguments that are returned when the user clicks the toast or a button
.AddArgument("action", MyToastActions.ViewConversation)
.AddArgument("conversationId", conversationId)
// Visual content

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

@ -6,6 +6,11 @@ namespace Microsoft.Toolkit.Win32.WpfCore.SampleApp
{
public enum MyToastActions
{
/// <summary>
/// View the conversation
/// </summary>
ViewConversation,
/// <summary>
/// Inline reply to a message
/// </summary>