private static async Task <int> ReadFileUnmarshalledAsync( int fileRef, IInvokeUnmarshalled invokeUnmarshalled, byte[] buffer, long position, int count, CancellationToken cancellationToken) { var taskCompletionSource = new TaskCompletionSource <long>(); cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()); var callBackId = Interlocked.Increment(ref nextPendingTaskId).ToString(); readFileAsyncCalls[callBackId] = taskCompletionSource; var startCallBack = invokeUnmarshalled.InvokeUnmarshalled <byte[], string, bool>( $"FileReaderComponent.ReadFileUnmarshalledAsync", buffer, Json.Serialize(new { position, count, callBackId, fileRef })); var longResult = await taskCompletionSource.Task; return((int)longResult); }
public FileReaderJsInterop(IJSRuntime jsRuntime, IInvokeUnmarshalled invokeUnmarshalled) { CurrentJSRuntime = jsRuntime; InvokeUnmarshalled = invokeUnmarshalled; }
public FileReaderService(IJSRuntime jsRuntime, IInvokeUnmarshalled invokeUnmarshalled) { this._fileReaderJsInterop = new FileReaderJsInterop(jsRuntime, invokeUnmarshalled); }