Esempio n. 1
0
        protected Element CreateElement(IssueItemViewModel x)
        {
            var assigned      = x.Issue.Assignee != null ? x.Issue.Assignee.Login : "******";
            var kind          = x.IsPullRequest ? "Pull" : "Issue";
            var commentString = x.Issue.Comments == 1 ? "1 comment" : x.Issue.Comments + " comments";
            var el            = new IssueElement(x.Issue.Number.ToString(CultureInfo.InvariantCulture), x.Issue.Title, assigned, x.Issue.State, commentString, kind, x.Issue.UpdatedAt);

            el.Tapped += () => ViewModel.GoToIssueCommand.ExecuteIfCan(x);
            return(el);
        }
Esempio n. 2
0
        protected IssueElement CreateElement(IssueModel x)
        {
            var weakVm        = new WeakReference <IBaseIssuesViewModel>(ViewModel);
            var isPullRequest = x.PullRequest != null && !(string.IsNullOrEmpty(x.PullRequest.HtmlUrl));
            var assigned      = x.Assignee != null ? x.Assignee.Login : "******";
            var kind          = isPullRequest ? "Pull" : "Issue";
            var commentString = x.Comments == 1 ? "1 comment" : x.Comments + " comments";
            var el            = new IssueElement(x.Number.ToString(), x.Title, assigned, x.State, commentString, kind, x.UpdatedAt);

            el.Tapped += () => weakVm.Get()?.GoToIssueCommand.Execute(x);
            return(el);
        }
Esempio n. 3
0
        protected Element CreateElement(IssueModel x)
        {
            var isPullRequest = x.PullRequest != null && !(string.IsNullOrEmpty(x.PullRequest.HtmlUrl));
            var assigned      = x.Assignee != null ? x.Assignee.Login : "******";
            var kind          = isPullRequest ? "Pull" : "Issue";
            var commentString = x.Comments == 1 ? "1 comment" : x.Comments + " comments";
            var el            = new IssueElement(x.Number.ToString(CultureInfo.InvariantCulture), x.Title, assigned, x.State, commentString, kind, x.UpdatedAt);

            el.Tag = x;

            el.Tapped += () => {
                //Make sure the first responder is gone.
                View.EndEditing(true);
                ViewModel.GoToIssueCommand.Execute(x);
            };

            return(el);
        }
Esempio n. 4
0
        protected Element CreateElement(IssueModel x)
        {
            var assigned = x.Responsible != null ? x.Responsible.Username : "******";
            var kind     = x.Metadata.Kind;

            if (kind == "enhancement")
            {
                kind = "enhance";
            }

            var commentString = x.CommentCount == 1 ? "1 comment" : x.CommentCount + " comments";
            var el            = new IssueElement(x.LocalId.ToString(), x.Title, assigned, x.Status, commentString, kind, x.UtcLastUpdated);

            el.Tapped += () => {
                //Make sure the first responder is gone.
                View.EndEditing(true);
                ViewModel.GoToIssueCommand.Execute(x);
            };

            return(el);
        }
Esempio n. 5
0
        protected MonoTouch.Dialog.Element CreateElement(IssueModel x)
        {
            var isPullRequest = x.PullRequest != null && !(string.IsNullOrEmpty(x.PullRequest.HtmlUrl));
            var assigned      = x.Assignee != null ? x.Assignee.Login : "******";
            var kind          = isPullRequest ? "Pull" : "Issue";
            var commentString = x.Comments == 1 ? "1 comment".t() : x.Comments + " comments".t();
            var el            = new IssueElement(x.Number.ToString(), x.Title, assigned, x.State, commentString, kind, x.UpdatedAt);

            el.Tag = x;

            if (isPullRequest)
            {
                el.Tapped += () => {
                    //Make sure the first responder is gone.
                    View.EndEditing(true);
                    var s1     = x.Url.Substring(x.Url.IndexOf("/repos/") + 7);
                    var repoId = new CodeHub.Utils.RepositoryIdentifier(s1.Substring(0, s1.IndexOf("/issues")));
                    var info   = new PullRequestViewController(repoId.Owner, repoId.Name, x.Number);
                    //info.Controller.ModelChanged = newModel => ChildChangedModel(newModel, x);
                    NavigationController.PushViewController(info, true);
                };
            }
            else
            {
                el.Tapped += () => {
                    //Make sure the first responder is gone.
                    View.EndEditing(true);
                    var s1     = x.Url.Substring(x.Url.IndexOf("/repos/") + 7);
                    var repoId = new CodeHub.Utils.RepositoryIdentifier(s1.Substring(0, s1.IndexOf("/issues")));
                    var info   = new IssueViewController(repoId.Owner, repoId.Name, x.Number);
                    //info.ViewModel.ModelChanged = newModel => ChildChangedModel(newModel, x);
                    NavigationController.PushViewController(info, true);
                };
            }
            return(el);
        }