Skip to content

Instantly share code, notes, and snippets.

@FrayxRulez
Last active March 4, 2016 16:28
Show Gist options
  • Save FrayxRulez/77209ffaf7af41213b2b to your computer and use it in GitHub Desktop.
Save FrayxRulez/77209ffaf7af41213b2b to your computer and use it in GitHub Desktop.
Interactive toast notifications with Silverlight and Runtime 8.1 apps
using System;
using Windows.ApplicationModel.Background;
using Windows.Foundation.Collections;
using Windows.Foundation.Metadata;
namespace TestInteractive.Tasks
{
public sealed class InteractiveTask : IBackgroundTask
{
public void Run(IBackgroundTaskInstance taskInstance)
{
var details = taskInstance.TriggerDetails as IToastNotificationActionTriggerDetail;
}
}
[Guid(2487554906, 14579, 17142, 150, 170, 121, 85, 176, 240, 61, 162)]
public interface IToastNotificationActionTriggerDetail
{
string Argument { get; }
ValueSet UserInput { get; }
}
}
var type = typeof(IBackgroundTrigger).Assembly.GetType("Windows.ApplicationModel.Background.ToastNotificationActionTrigger");
if (type != null)
{
var trigger = (IBackgroundTrigger)Activator.CreateInstance(type);
var builder = new BackgroundTaskBuilder();
builder.Name = "InteractiveTask";
builder.TaskEntryPoint = "TestInteractive.Tasks.InteractiveTask";
builder.SetTrigger(trigger);
builder.Register();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment