示例#1
0
        // creates and returns a RegistryList object by calling
        // Eth functions IsRegistryActiveAtIndex, GetRegistryAddressAtIndex, and GetRegistryNameAtIndex
        public async Task <RegistryList> GetRegistryList()
        {
            RegistryList list = new RegistryList();

            // call number of registries function on library contract
            int count = await GetNumberOfRegistries.SendRequestAsync(MyWeb3);

            // for each receipt
            for (int i = 0; i < count; ++i)
            {
                // check if registry is active
                if (await IsRegistryActiveAtIndex.SendRequestAsync(MyWeb3, i))
                {
                    // get registry address at index
                    string address = await GetRegistryAddressAtIndex.SendRequestAsync(MyWeb3, i);

                    // get registry name at index
                    string name = await GetRegistryNameAtIndex.SendRequestAsync(MyWeb3, i);

                    // add values to RegistryList object
                    list.AddLine(name, address);
                }
            }

            return(list);
        }