public async void Initialize(AppServiceConnection connection) { if (connection != null) { VoIPCallTask.Log("Mediator initialized", "Connecting app service"); _connection = connection; _connection.RequestReceived -= OnRequestReceived; _connection.RequestReceived += OnRequestReceived; } else { VoIPCallTask.Log("Mediator initialized", "Disconnetting app service"); if (_connection != null) { _connection.RequestReceived -= OnRequestReceived; _connection = null; } } if (_protoService != null && _connection != null) { VoIPCallTask.Log("Mediator initialized", "Disposing proto service"); _protoService.Dispose(); _transportService.Close(); } if (_phoneCall != null && _connection != null) { await UpdateCallAsync(); } }