Ejemplo n.º 1
0
        private async Task ExecuteLoadRepositoriesAsync(RepositoryQueryArguments arguments)
        {
            Cursor cursor = this.Cursor;

            this.Cursor = Cursors.AppStarting;

            try
            {
                this.resultContainer.Children.Clear();

                IPublicRepositoryReader accessor = AccessorFactory.Create <IPublicRepositoryReader>(this.model.RepositoryName, this.model.IsOrganization);

                IResult <IRepository> result = await accessor.ReadAsync(arguments);

                if (result != null)
                {
                    this.ApplyResults(result.Results);
                    this.ApplyPagings(result.Pagination);

                    if (result.Limitation != null)
                    {
                        Shared.StatusHandler.GlobalStatus.LimitationMaximum    = result.Limitation.Maximum;
                        Shared.StatusHandler.GlobalStatus.LimitationRemaining  = result.Limitation.Remaining;
                        Shared.StatusHandler.GlobalStatus.LimitationExpiration = result.Limitation.Expiration.DateTime;
                    }
                }
            }
            finally
            {
                this.Cursor = cursor;
            }
        }
Ejemplo n.º 2
0
        private static void TestRepositories(String value, Boolean organization)
        {
            IPublicRepositoryReader accessor = AccessorFactory.Create <IPublicRepositoryReader>(value, organization);

            IResult <IRepository> result = null;

            Task.Run(async() =>
            {
                var count = await accessor.TotalCountAsync();

                Console.WriteLine($"total count: {count}");

                RepositoryQueryArguments arguments = new RepositoryQueryArguments(new PagingArgument(50));

                while (true)
                {
                    result = await accessor.ReadAsync(arguments);

                    if (!result.Results.Any())
                    {
                        break;
                    }

                    Console.WriteLine(result);

                    foreach (IRepository repository in result.Results)
                    {
                        Console.WriteLine(repository);
                    }

                    Console.WriteLine($"count: {result.Results.Count()}");

                    if (result.Pagination == null || result.Pagination.Next == null)
                    {
                        break;
                    }

                    arguments.Paging = new PagingArgument(result.Pagination.Next);
                }

                Console.WriteLine($"total count: {count}");
            })
            .Wait();
        }