private void Close() { VoIPCallTask.Log("Releasing background task", "Releasing VoIPCallTask"); VoIPCallTask.Mediator.Initialize(null as AppServiceConnection); _current = null; _connection = null; _deferral?.Complete(); }
public void Run(IBackgroundTaskInstance taskInstance) { try { _deferral = taskInstance.GetDeferral(); VoIPCallTask.Log("VoIPServiceTask started", "VoIPServiceTask started"); var details = taskInstance.TriggerDetails as AppServiceTriggerDetails; _connection = details.AppServiceConnection; _current = this; VoIPCallTask.Mediator.Initialize(details.AppServiceConnection); taskInstance.Canceled += (s, e) => Close(); details.AppServiceConnection.ServiceClosed += (s, e) => Close(); } catch (Exception e) { _deferral?.Complete(); } }