These are the steps to add the background task introduced in this post to a project
Add a project as portable class library
1.Right click on the project on solution explorer, 'Add' -> 'New Project..'
2.On the dialog shown, under 'Visual C#' -> 'Windows Universal',
then on right panel select 'Windows Runtime Component(Universal Windows)'
name it, I named "SxddBackgroundTasks"
3.Rename the Class1.cs if you want , I renamed it "DiceThrow.cs"
Set reference the project from the App
1.In 'Package.appmanifest file' navigate to 'Declarations' and in 'Available Declarations'
select the portable class library name ("SxddBackgroundTasks")
2.Select background task type from the options I selected "Timer"
3.Reference the added project
Register the background task to App
1.Write code as pic1 in Main.cs
2.Write code as pic2 in the Background class