public void FastReadReport(ReadReportCallback callback, int timeout)
        {
            var readReportDelegate = new ReadReportDelegate(FastReadReport);
            var asyncState         = new HidAsyncState(readReportDelegate, callback);

            readReportDelegate.BeginInvoke(timeout, EndReadReport, asyncState);
        }
Exemplo n.º 2
0
        public void ReadReport(ReadReportCallback callback)
        {
            var readReportDelegate = new ReadReportDelegate(ReadReport);
            var asyncState         = new HidAsyncState(readReportDelegate, callback);

            readReportDelegate.BeginInvoke(EndReadReport, asyncState);
        }
Exemplo n.º 3
0
        public void ReadReport(ReadReportCallback callback)
        {
            ReadReportDelegate readReportDelegate = ReadReport;
            HidAsyncState      @object            = new HidAsyncState(readReportDelegate, callback);

            readReportDelegate.BeginInvoke(EndReadReport, @object);
        }
Exemplo n.º 4
0
        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
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
 public void ReadReport(ReadReportCallback callback)
 {
     var readReportDelegate = new ReadReportDelegate(ReadReport);
     var asyncState = new HidAsyncState(readReportDelegate, callback);
     readReportDelegate.BeginInvoke(EndReadReport, asyncState);
 }
Exemplo n.º 8
0
 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);
 }
Exemplo n.º 9
0
 public void FastReadReport(ReadReportCallback callback, int timeout)
 {
     var readReportDelegate = new ReadReportDelegate(FastReadReport);
     var asyncState = new HidAsyncState(readReportDelegate, callback);
     readReportDelegate.BeginInvoke(timeout, EndReadReport, asyncState);
 }