private void RegisterDebugSessionConnectedTask() { // This task runs every time the user logs in, which then invokes the same code as the preinstall task would. Used only for testing purposes. var trigger = new SystemTrigger(SystemTriggerType.SessionConnected, oneShot: false); BackgroundTasksHelper.RegisterBackgroundTask("EdgeToastBackgroundProject.PreinstallTask", "SessionConnectedTask", trigger, null); }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; var dontWaitResetPrimaryTile = ResetPrimaryTileWorker.Instance.Start(); var dontWaitBackgroundTasks = BackgroundTasksHelper.ConfigureBackgroundTasks(); }
private async void Shell_Loaded(object sender, RoutedEventArgs e) { var startup = await StartupTask.GetAsync("{F4E0CA22-ABB1-4310-AC20-0F72BF3A869B}"); var state = startup.State; if (state == StartupTaskState.Disabled) { state = await startup.RequestEnableAsync(); } Debug.WriteLine($"Info: Startup task state : {state}"); var task = await BackgroundTasksHelper.RegisterThrottling(); var trigger = task?.Trigger as ApplicationTrigger; var result = await trigger.RequestAsync(); }