public void Run(IBackgroundTaskInstance taskInstance) { // Grab the deferral in case anything uses async. BackgroundTaskDeferral defferal = taskInstance.GetDeferral(); // Create the baconit manager BaconManager baconManager = new BaconManager(true); // Fire off the update, but don't do it async. We want to block this thread. baconManager.FireOffUpdate(false); }
/// <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() { BaconMan = new BaconManager(false); Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync( Microsoft.ApplicationInsights.WindowsCollectors.Metadata | Microsoft.ApplicationInsights.WindowsCollectors.UnhandledException | Microsoft.ApplicationInsights.WindowsCollectors.Session); this.InitializeComponent(); this.Suspending += OnSuspending_Fired; this.Resuming += OnResuming_Fired; this.UnhandledException += OnUnhandledException; }
public async void Run(IBackgroundTaskInstance taskInstance) { // Create the baconit manager m_baconMan = new BaconManager(true); // Setup the ref counted deferral RefCountedDeferral refDeferral = new RefCountedDeferral(taskInstance.GetDeferral(), OnDeferralCleanup); // Add a ref so everyone in this call is protected refDeferral.AddRef(); // Fire off the update await m_baconMan.BackgroundMan.RunUpdate(refDeferral); // After this returns the deferral will call complete unless someone else took a ref on it. refDeferral.ReleaseRef(); }
/// <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() { // Setup the exception handler first this.UnhandledException += OnUnhandledException; // Now setup the baconman BaconMan = new BaconManager(false); // Now telemetry Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync( Microsoft.ApplicationInsights.WindowsCollectors.Metadata | Microsoft.ApplicationInsights.WindowsCollectors.UnhandledException | Microsoft.ApplicationInsights.WindowsCollectors.Session); // Init the app this.InitializeComponent(); // Register for events. this.Suspending += OnSuspending_Fired; this.Resuming += OnResuming_Fired; }