Esempio n. 1
0
 public static void AddGroup(RepoGroup group)
 {
     if (All.Where(x => x.Title == group.Title).Count() == 0)
     {
         All.Add(group);
     }
 }
Esempio n. 2
0
        private async void ContentPage_Appearing(object sender, EventArgs e)
        {
            var avImage = this.FindByName <Image>("AvatarImage");

            var user = await GitHubLoaders.GetUser();

            if (user != null)
            {
                var userEmailLabel = this.FindByName <Label>("UserEmail");
                userEmailLabel.Text = user.name;
                htmlLink            = user.html_url;

                avImage.Source = new UriImageSource
                {
                    Uri            = new Uri(user.avatar_url),
                    CachingEnabled = true,
                    CacheValidity  = new TimeSpan(1, 0, 0, 0)
                };
            }

            var pubRepo = await GitHubLoaders.GetPublicRepos();

            if (pubRepo != null)
            {
                var group = new RepoGroup("Public", "Public");

                foreach (var repo in pubRepo)
                {
                    group.Add(new RepoData(repo.name, String.IsNullOrEmpty(repo.language) ? "No Coding Language": repo.language, repo.html_url));
                }

                RepoGroup.AddGroup(group);
            }

            var privRepo = await GitHubLoaders.GetPublicRepos();

            if (privRepo != null)
            {
                var group = new RepoGroup("Private", "Private");

                foreach (var repo in privRepo)
                {
                    group.Add(new RepoData(repo.name, String.IsNullOrEmpty(repo.language) ? "No Coding Language" : repo.language, repo.html_url));
                }

                RepoGroup.AddGroup(group);
            }
        }