示例#1
0
        public IssueViewModel(GithubService githubService, INavigationService navigationService, string username, string repo, string number)
        {
            RepoName  = String.Format("{0}/{1}", username, repo);
            IssueName = "Issue #" + number;

            Issue           = githubService.Load(new IssueRequest(username, repo, number), i => Issue = i);
            CommentsRequest = new IssueCommentsRequest(username, repo, number);

            ShareCommand = new RelayCommand(() =>
            {
                new ShareLinkTask
                {
                    LinkUri = new Uri(Issue.HtmlUrl),
                    Title   = "Issue on" + RepoName + " is on Github: " + Issue.Title,
                    Message = "I found this issue on Github, you might want to see it: " + Issue.Body,
                }.Show();
            }, () => Issue != null);

            RepoSelectedCommand = new RelayCommand(() => { navigationService.NavigateTo(String.Format(ViewModelLocator.REPOSITORY_URL, username, repo)); });

            CommentCommand = new RelayCommand(() =>
            {
                githubService.Load(new IssueCommentRequest(username, repo, number, Comment), r =>
                {
                    Comment         = null;
                    CommentsRequest = new IssueCommentsRequest(username, repo, number);
                });
            }, () => githubService.IsAuthenticated && Comment != null && Comment.Trim().Length > 0);
        }
示例#2
0
        public IssueViewModel(GithubService githubService, INavigationService navigationService, string username, string repo, string number)
        {
            RepoName = String.Format("{0}/{1}", username, repo);
            IssueName = "Issue #" + number;

            Issue = githubService.Load(new IssueRequest(username, repo, number), i => Issue = i);
            CommentsRequest = new IssueCommentsRequest(username, repo, number);

            ShareCommand = new RelayCommand(() =>
            {
                new ShareLinkTask
                {
                    LinkUri = new Uri(Issue.HtmlUrl),
                    Title = "Issue on" + RepoName + " is on Github: " + Issue.Title,
                    Message = "I found this issue on Github, you might want to see it: " + Issue.Body,
                }.Show();
            }, () => Issue != null);

            RepoSelectedCommand = new RelayCommand(() => { navigationService.NavigateTo(String.Format(ViewModelLocator.REPOSITORY_URL, username, repo)); });

            CommentCommand = new RelayCommand(() =>
            {
                githubService.Load(new IssueCommentRequest(username, repo, number, Comment), r =>
                {
                    Comment = null;
                    CommentsRequest = new IssueCommentsRequest(username, repo, number);
                });
            }, () => githubService.IsAuthenticated && Comment != null && Comment.Trim().Length > 0);
        }