コード例 #1
0
        public static async Task <TruckDto> VerifyCredentials(TruckDto newTruck)
        {
            var result = await Task.Run <TruckDto>(async() =>
            {
                return(await CredentialsManager.VerifyCredentials(newTruck));
            });

            return(result);
        }
コード例 #2
0
        public static async Task <bool> EstablishVerifiedCredentials()
        {
            bool result = false;

            Credentials = null;
            var truckCredentials = CredentialsManager.GetLoginCredentials(); // try running the damn thing synchronously

            if (truckCredentials.TruckId > 0)
            {
                // run api tasks on thread pool
                var validCredentials = await Task.Run <TruckDto>(async() =>
                {
                    return(await CredentialsManager.VerifyCredentials(truckCredentials));
                });

                if (validCredentials.TruckId > 0)
                {
                    Credentials = validCredentials;
                    result      = true;
                }
            }
            return(result);
        }