private void OnTaskCanceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason) { _appServiceDeferral?.Complete(); _appServiceDeferral = null; _appServiceConnection = null; Application.Current.Exit(); }
private void OnTaskCanceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason) { _appServiceDeferral?.Complete(); _appServiceDeferral = null; _appServiceConnection = null; // ReSharper disable once ArrangeStaticMemberQualifier Application.Current.Exit(); }
protected override void OnBackgroundActivated(BackgroundActivatedEventArgs args) { base.OnBackgroundActivated(args); if (args.TaskInstance.TriggerDetails is AppServiceTriggerDetails details) { if (details.CallerPackageFamilyName == Package.Current.Id.FamilyName) { _appServiceDeferral = args.TaskInstance.GetDeferral(); args.TaskInstance.Canceled += OnTaskCanceled; _appServiceConnection = new AppServiceConnectionAdapter(details.AppServiceConnection); _trayReady.SetResult(0); } } }
public void Initialize(IAppTaskInstance task) { if (_initialized) { return; } task.Canceled += Task_Canceled; var triggerDetails = task.TriggerDetails; _deferral = task.GetDeferral(); _connection = triggerDetails.AppServiceConnection; _connection.RequestReceived += Connection_RequestReceived; _connection.ServiceClosed += Connection_ServiceClosed; _initialized = true; }
public void Initialize(IAppServiceConnection appServiceConnection) { _appServiceConnection = appServiceConnection; _appServiceConnection.MessageReceived += OnMessageReceived; }
public Task Initialize(IAppServiceConnection appServiceConnection) { _appServiceConnection = appServiceConnection; return(UpdateToggleWindowKeyBindings()); }