예제 #1
0
        private static async Task RunGetInstancesAsync()
        {
            string continuationToken;

            // Limit the total instances received.
            int limit = 1000;
            int totalInstanceCount           = 0;
            TimeSeriesInstance firstInstance = null;

            do
            {
                GetInstancesPage instancesPage = await _client.GetInstancesPagedAsync();

                if (instancesPage.Instances != null)
                {
                    totalInstanceCount += instancesPage.Instances.Count;

                    Console.WriteLine("Received instances : {0}", totalInstanceCount);

                    if (firstInstance == null)
                    {
                        firstInstance = instancesPage.Instances.FirstOrDefault();
                    }
                }

                continuationToken = instancesPage.ContinuationToken;
            }while (continuationToken != null && totalInstanceCount < limit);

            Console.WriteLine("First Instance:");
            PrintResponse(firstInstance);
        }