示例#1
0
        public async Task <GetBicycleOutputDTO> GetBicycleInformation(string bikeId)
        {
            GetBicycleFunction bicycleFunction = new GetBicycleFunction
            {
                FromAddress = Variables.adminAddress,
                Gas         = Variables.gas,
                BicycleId   = bikeId
            };
            GetBicycleOutputDTO details = await ContractHandler.QueryDeserializingToObjectAsync <GetBicycleFunction, GetBicycleOutputDTO>(bicycleFunction, null).ConfigureAwait(false);

            return(details);
        }
示例#2
0
        public async Task <ObservableCollection <Bicycle> > GetAvailableBicyclesFromDockingStationAsync(string dockingStation)
        {
            ObservableCollection <Bicycle> bicycles = new ObservableCollection <Bicycle>();
            List <string> keys = await GetBicycleKeys().ConfigureAwait(false);

            foreach (string key in keys)
            {
                GetBicycleOutputDTO bicycleDetails = await GetBicycleInformation(key).ConfigureAwait(false);

                if (bicycleDetails.ReturnValue2)
                {
                    bicycles.Add(new Bicycle {
                        ID = key, Status = bicycleDetails.ReturnValue2 == true ? "Available" : "Not Available", DockdeAt = bicycleDetails.ReturnValue1
                    });
                }
            }
            return(bicycles);
        }