Пример #1
0
            public static async Task <DevInfo> CheckDevice2Async(ServiceAsync svc, int devId)
            {
                var lastKnownState = svc.GetKnownDevStateAsync(devId);

                DevAddr addr = await svc.GetDevAddrAsync(devId);

                DevReport devReport = await svc.GetCurrDevReportAsync(addr);

                return(new DevInfo(await lastKnownState, devReport));
            }
Пример #2
0
            public static Task <DevInfo> CheckDevice3Async(ServiceAsync svc, int devId)
            {
                var lastKnownState = svc.GetKnownDevStateAsync(devId);

                var t2 = svc.GetDevAddrAsync(devId)
                         .ContinueWith(ant => svc.GetCurrDevReportAsync(ant.Result))
                         .Unwrap();

                return(Task.WhenAll(lastKnownState, t2)
                       .ContinueWith(_ => new DevInfo(lastKnownState.Result, t2.Result)));
            }