1
I am programming for Windows 10, and at a certain time in a day I want my background task to be faced.
Here is my registration code:
on the home screen:
var trigger = new SystemTrigger(SystemTriggerType.TimeZoneChange, false);
var condition = new SystemCondition(SystemConditionType.InternetAvailable);
var tarefa = RegistrarTarefasSegundoPlanoAsync.RegisterBackgroundTask(typeof(SalvaImagemTask).FullName, "SalvaImagemTask", trigger, condition);
Registerbackgroundtask.Cs
public static BackgroundTaskRegistration RegisterBackgroundTask(
string taskEntryPoint,
string name,
IBackgroundTrigger trigger,
IBackgroundCondition condition)
{
foreach (var cur in BackgroundTaskRegistration.AllTasks)
{
if (cur.Value.Name == name)
{
return (BackgroundTaskRegistration)(cur.Value);
}
}
var builder = new BackgroundTaskBuilder();
builder.Name = name;
builder.TaskEntryPoint = taskEntryPoint;
builder.SetTrigger(trigger);
if (condition != null)
{
builder.AddCondition(condition);
}
BackgroundTaskRegistration task = builder.Register();
return task;
}
here is how it is registered in my manifest
I believe you can use the Time class. https://msdn.microsoft.com/pt-br/library/system.timers.timer(v=vs.110). aspx
– Marconi