0

My app is using Windows phone silverlight 8.1 and visual studio express 2013.

I need a scheduled task for my app, so I added a Schedule Task project as here: https://msdn.microsoft.com/en-us/library/windows/apps/hh202941%28v=vs.105%29.aspx

I managed to add the ScheduledTaskAgent but when I try to add it as reference to my project (right click->add Reference), I get such a message:

"Impossible to add the selected reference as not supported by background agents"

I tried the same on a new simple project and it works properly.

So I tried to remove my other references and adding the reference to my scheduled task but it is still not working.

How to fix it and finally add my scheduled task? Is there another way to add a scheduled task as reference?

my background agent:

using System.Diagnostics;
using System.Windows;
using Microsoft.Phone.Scheduler;

namespace ScheduledTaskAgent3
{
public class ScheduledAgent : ScheduledTaskAgent
{

    static ScheduledAgent()
    {
        Deployment.Current.Dispatcher.BeginInvoke(delegate
        {
            Application.Current.UnhandledException += UnhandledException;
        });
    }

    private static void UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
    {
        if (Debugger.IsAttached)
        {

            Debugger.Break();
        }
    }


    protected override void OnInvoke(ScheduledTask task)
    {

        NotifyComplete();
    }
}
}
eeadev
  • 3,662
  • 8
  • 47
  • 100

0 Answers0