public ObservableStarredClient(IGitHubClient client)
        {
            Ensure.ArgumentNotNull(client, "client");

            _client     = client.Activity.Starring;
            _connection = client.Connection;
        }
        public ObservableStarredClient(IGitHubClient client)
        {
            Ensure.ArgumentNotNull(client, "client");

            _client = client.Activity.Starring;
            _connection = client.Connection;
        }
Exemple #3
0
        public HomeViewModel(IScreen host, IGitHubClient GHClient)
        {
            HostScreen = host;

            // Default to the normal (read: "tacky") user name
            if (GHClient.Connection.Credentials.Login == null)
            {
                UserName = UnknownUser;
            }

            //try
            //{
            //    var creds = GHClient.Connection.Credentials;
            //    Debug.Print("Current user: {0}", creds.Login.ToString());

            //    if (GHClient.Connection.Credentials.Login != null)
            //    {
            //        UserName = GHClient.Connection.Credentials.Login;
            //    }
            //    else
            //    {
            //        UserName = UnknownUser;
            //    }
            //}
            //catch (Exception ex)
            //{
            //    Debug.Print(ex.Message);
            //    UserName = UnknownUser;
            //}

            var loggedIn = this.WhenAny(x => x.UserName, x => x.Value == UnknownUser);

            // Log in is necessary if the anonymous user text is the current user name
            LogIn = new ReactiveCommand(loggedIn);

            SClient = GHClient.Activity.Starring;
            var starredRepos = SClient.GetAllForCurrent().Result
                               .Select(star => new StarRowViewModel(star)).ToArray();

            Stars = new ReactiveList <StarRowViewModel>(starredRepos);

            //todo: once i get this working we can use actual log ins
            //IObservable<User> user = BlobCache.UserAccount.GetOrCreateObject<User>("MyUser", () =>
            //{
            //    return null;
            //});

            //user.Subscribe(u =>
            // {
            //     if (u == null)
            //     {
            //         UserName = "******";
            //     }
            //     else
            //     {
            //         UserName = u.Login;
            //     }
            // });
        }
        public HomeViewModel(IScreen host, IGitHubClient GHClient)
        {
            HostScreen = host;

            // Default to the normal (read: "tacky") user name
            if (GHClient.Connection.Credentials.Login == null)
            {
                UserName = UnknownUser;
            }

            //try
            //{
            //    var creds = GHClient.Connection.Credentials;
            //    Debug.Print("Current user: {0}", creds.Login.ToString());

            //    if (GHClient.Connection.Credentials.Login != null)
            //    {
            //        UserName = GHClient.Connection.Credentials.Login;
            //    }
            //    else
            //    {
            //        UserName = UnknownUser;
            //    }
            //}
            //catch (Exception ex)
            //{
            //    Debug.Print(ex.Message);
            //    UserName = UnknownUser;
            //}

            var loggedIn = this.WhenAny(x => x.UserName, x => x.Value == UnknownUser);

            // Log in is necessary if the anonymous user text is the current user name
            LogIn = new ReactiveCommand(loggedIn);

            SClient = GHClient.Activity.Starring;
            var starredRepos = SClient.GetAllForCurrent().Result
                .Select(star => new StarRowViewModel(star)).ToArray();

            Stars = new ReactiveList<StarRowViewModel>(starredRepos);

            //todo: once i get this working we can use actual log ins
            //IObservable<User> user = BlobCache.UserAccount.GetOrCreateObject<User>("MyUser", () =>
            //{
            //    return null;
            //});

            //user.Subscribe(u =>
            // {
            //     if (u == null)
            //     {
            //         UserName = "******";
            //     }
            //     else
            //     {
            //         UserName = u.Login;
            //     }
            // });
        }
        public StarredClientTests()
        {
            _client  = Helper.GetAuthenticatedClient();
            _fixture = _client.Activity.Starring;

            var github   = Helper.GetAuthenticatedClient();
            var repoName = Helper.MakeNameWithTimestamp("public-repo1");

            _repositoryContext = github.CreateRepositoryContext(new NewRepository(repoName)).Result;

            _fixture.RemoveStarFromRepo(_repositoryContext.RepositoryOwner, _repositoryContext.RepositoryName).Wait();
            _fixture.RemoveStarFromRepo("octokit", "octokit.net").Wait();
            _fixture.StarRepo(_repositoryContext.RepositoryOwner, _repositoryContext.RepositoryName).Wait();
            _fixture.StarRepo("octokit", "octokit.net").Wait();
        }
        public StarredClientTests()
        {
            _client = Helper.GetAuthenticatedClient();
            _fixture = _client.Activity.Starring;

            var github = Helper.GetAuthenticatedClient();
            var repoName = Helper.MakeNameWithTimestamp("public-repo1");

            _repositoryContext = github.CreateRepositoryContext(new NewRepository(repoName)).Result;

            _fixture.RemoveStarFromRepo(_repositoryContext.RepositoryOwner, _repositoryContext.RepositoryName).Wait();
            _fixture.RemoveStarFromRepo("octokit", "octokit.net").Wait();
            _fixture.StarRepo(_repositoryContext.RepositoryOwner, _repositoryContext.RepositoryName).Wait();
            _fixture.StarRepo("octokit", "octokit.net").Wait();
        }
 public StarredClientTests()
 {
     _client  = Helper.GetAuthenticatedClient();
     _fixture = _client.Activity.Starring;
 }
 public StarredClientTests()
 {
     _client = Helper.GetAuthenticatedClient();
     _fixture = _client.Activity.Starring;
 }