public void FastReadReport(ReadReportCallback callback, int timeout) { var readReportDelegate = new ReadReportDelegate(FastReadReport); var asyncState = new HidAsyncState(readReportDelegate, callback); readReportDelegate.BeginInvoke(timeout, EndReadReport, asyncState); }
public void ReadReport(ReadReportCallback callback) { var readReportDelegate = new ReadReportDelegate(ReadReport); var asyncState = new HidAsyncState(readReportDelegate, callback); readReportDelegate.BeginInvoke(EndReadReport, asyncState); }
public void ReadReport(ReadReportCallback callback) { ReadReportDelegate readReportDelegate = ReadReport; HidAsyncState @object = new HidAsyncState(readReportDelegate, callback); readReportDelegate.BeginInvoke(EndReadReport, @object); }
protected static void EndReadReport(IAsyncResult ar) { HidAsyncState hidAsyncState = (HidAsyncState)ar.AsyncState; ReadReportDelegate readReportDelegate = (ReadReportDelegate)hidAsyncState.CallerDelegate; ReadReportCallback readReportCallback = (ReadReportCallback)hidAsyncState.CallbackDelegate; HidReport report = readReportDelegate.EndInvoke(ar); readReportCallback?.Invoke(report); }
public async Task <HidReport> FastReadReportAsync(int timeout = 0) { var readReportDelegate = new ReadReportDelegate(FastReadReport); #if NET20 || NET35 || NET5_0_OR_GREATER return(await Task <HidReport> .Factory.StartNew(() => readReportDelegate.Invoke(timeout))); #else return(await Task <HidReport> .Factory.FromAsync(readReportDelegate.BeginInvoke, readReportDelegate.EndInvoke, timeout, null)); #endif }
public async Task <HidReport> ReadReportAsync(int timeout = 0) { var readReportDelegate = new ReadReportDelegate(ReadReport); return(await Task <HidReport> .Factory.FromAsync(readReportDelegate.BeginInvoke, readReportDelegate.EndInvoke, timeout, null)); }
public async Task<HidReport> FastReadReportAsync(int timeout = 0) { var readReportDelegate = new ReadReportDelegate(FastReadReport); return await Task<HidReport>.Factory.FromAsync(readReportDelegate.BeginInvoke, readReportDelegate.EndInvoke, timeout, null); }