public IAsyncAction CloseAsync() { return(Task.Run(async() => { await BodyIndexReader?.CloseAsync(); BodyIndexReader?.Dispose(); BodyIndexReader = null; await BodyReader?.CloseAsync(); BodyReader?.Dispose(); BodyReader = null; await ColorReader?.CloseAsync(); ColorReader?.Dispose(); ColorReader = null; await DepthReader?.CloseAsync(); DepthReader?.Dispose(); DepthReader = null; AudioReader?.Close(); AudioReader?.Dispose(); AudioReader = null; _mediaCapture?.Dispose(); _mediaCapture = null; _networkClient?.CloseConnection(); _networkClient = null; _networkServer?.CloseConnection(); _networkServer = null; }).AsAsyncAction()); }