public static void RunBackgroundTask(IBackgroundTask task, IBackgroundTaskInstance taskInstance, IShinyStartup startup) { if (!ShinyHost.IsInitialized) { UwpPlatform.SetBackgroundTask(task.GetType()); ShinyHost.Init(new UwpPlatform(null), startup); } var services = ShinyHost.ServiceProvider; //if (taskInstance.Task.Name.StartsWith("JOB-")) //{ // services // .Resolve<JobManager>(true)! // .Process(taskInstance); //} //else //{ // var targetType = Type.GetType(taskInstance.Task.Name); // var processor = ActivatorUtilities.GetServiceOrCreateInstance(services, targetType) as IBackgroundTaskProcessor; // processor?.Process(taskInstance); //} }
public static void ShinyInit <TBgTask>(this Windows.UI.Xaml.Application app, IShinyStartup startup) where TBgTask : IBackgroundTask { UwpPlatform.SetBackgroundTask(typeof(TBgTask)); ShinyHost.Init(new UwpPlatform(app), startup); }
public static void ShinyRunBackgroundTask(this IBackgroundTask task, IBackgroundTaskInstance taskInstance, IShinyStartup startup) => UwpPlatform.RunBackgroundTask(task, taskInstance, startup);