public PullRequestView()
        {
            Root.UnevenRows = true;
            _header = new HeaderView() { ShadowImage = false };
			_split1 = new SplitElement(new SplitElement.Row { Image1 = Images.Cog, Image2 = Images.Merge });
            _split2 = new SplitElement(new SplitElement.Row { Image1 = Images.User, Image2 = Images.Create });
        }
Beispiel #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _split1 = new SplitElement(new SplitElement.Row { Image1 = Images.Cog, Image2 = Images.Merge });
            _split2 = new SplitElement(new SplitElement.Row { Image1 = Images.Person, Image2 = Images.Create });

            ViewModel.Bind(x => x.PullRequest, () =>
            {
                var merged = (ViewModel.PullRequest.Merged != null && ViewModel.PullRequest.Merged.Value);

                _split1.Value.Text1 = ViewModel.PullRequest.State;
                _split1.Value.Text2 = merged ? "Merged" : "Not Merged";

                _split2.Value.Text1 = ViewModel.PullRequest.User.Login;
                _split2.Value.Text2 = ViewModel.PullRequest.CreatedAt.ToString("MM/dd/yy");
                Render();
            });
        }
Beispiel #3
0
 public PullRequestView()
 {
     Root.UnevenRows = true;
     _header = new HeaderView() { ShadowImage = false };
     _split1 = new SplitElement(new SplitElement.Row { Image1 = Images.Cog, Image2 = Images.Merge }) { BackgroundColor = UIColor.White };
 }
Beispiel #4
0
        public override void ViewDidLoad()
        {
            Root.UnevenRows = true;

            base.ViewDidLoad();

            _header = new HeaderView();
            _hud = this.CreateHud();

            var content = System.IO.File.ReadAllText("WebCell/body.html", System.Text.Encoding.UTF8);
            _descriptionElement = new WebElement(content, "body", false);
            _descriptionElement.UrlRequested = ViewModel.GoToUrlCommand.Execute;

            var content2 = System.IO.File.ReadAllText("WebCell/comments.html", System.Text.Encoding.UTF8);
            _commentsElement = new WebElement(content2, "comments", true);
            _commentsElement.UrlRequested = ViewModel.GoToUrlCommand.Execute;

            _milestoneElement = new StyledStringElement("Milestone", "No Milestone", UITableViewCellStyle.Value1) { Image = Images.Milestone };
            _milestoneElement.Tapped += () => ViewModel.GoToMilestoneCommand.Execute(null);

            _assigneeElement = new StyledStringElement("Assigned", "Unassigned".t(), UITableViewCellStyle.Value1) { Image = Images.Person };
            _assigneeElement.Tapped += () => ViewModel.GoToAssigneeCommand.Execute(null);

            _labelsElement = new StyledStringElement("Labels", "None", UITableViewCellStyle.Value1) { Image = Images.Tag };
            _labelsElement.Tapped += () => ViewModel.GoToLabelsCommand.Execute(null);

            _addCommentElement = new StyledStringElement("Add Comment") { Image = Images.Pencil };
            _addCommentElement.Tapped += AddCommentTapped;

            _split1 = new SplitElement(new SplitElement.Row { Image1 = Images.Cog, Image2 = Images.Merge });
            _split2 = new SplitElement(new SplitElement.Row { Image1 = Images.Person, Image2 = Images.Create });

            ViewModel.Bind(x => x.PullRequest, x =>
            {
                var merged = (x.Merged != null && x.Merged.Value);

                _split1.Value.Text1 = x.State;
                _split1.Value.Text2 = merged ? "Merged" : "Not Merged";

                _split2.Value.Text1 = x.User.Login;
                _split2.Value.Text2 = x.CreatedAt.ToString("MM/dd/yy");

                _descriptionElement.Value = ViewModel.MarkdownDescription;
                _header.Title = x.Title;
                _header.Subtitle = "Updated " + x.UpdatedAt.ToDaysAgo();

                Render();
            });

            NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Action, (s, e) => ShowExtraMenu());
            NavigationItem.RightBarButtonItem.Enabled = false;
            ViewModel.Bind(x => x.IsLoading, x =>
            {
                if (!x)
                {
                    NavigationItem.RightBarButtonItem.Enabled = ViewModel.PullRequest != null;
                }
            });

            ViewModel.Bind(x => x.IsModifying, x =>
            {
                if (x)
                    _hud.Show("Loading...");
                else
                    _hud.Hide();
            });

            ViewModel.Bind(x => x.Issue, x =>
            {
                _assigneeElement.Value = x.Assignee != null ? x.Assignee.Login : "******".t();
                _milestoneElement.Value = x.Milestone != null ? x.Milestone.Title : "No Milestone";
                _labelsElement.Value = x.Labels.Count == 0 ? "None" : string.Join(", ", x.Labels.Select(i => i.Name));
                Render();
            });

            ViewModel.GoToLabelsCommand.CanExecuteChanged += (sender, e) =>
            {
                var before = _labelsElement.Accessory;
                _labelsElement.Accessory = ViewModel.GoToLabelsCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None;
                if (_labelsElement.Accessory != before && _labelsElement.GetImmediateRootElement() != null)
                    Root.Reload(_labelsElement, UITableViewRowAnimation.Fade);
            };
            ViewModel.GoToAssigneeCommand.CanExecuteChanged += (sender, e) =>
            {
                var before = _assigneeElement.Accessory;
                _assigneeElement.Accessory = ViewModel.GoToAssigneeCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None;
                if (_assigneeElement.Accessory != before && _assigneeElement.GetImmediateRootElement() != null)
                    Root.Reload(_assigneeElement, UITableViewRowAnimation.Fade);
            };
            ViewModel.GoToMilestoneCommand.CanExecuteChanged += (sender, e) =>
            {
                var before = _milestoneElement.Accessory;
                _milestoneElement.Accessory = ViewModel.GoToMilestoneCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None;
                if (_milestoneElement.Accessory != before && _milestoneElement.GetImmediateRootElement() != null)
                    Root.Reload(_milestoneElement, UITableViewRowAnimation.Fade);
            };

            ViewModel.BindCollection(x => x.Comments, e => RenderComments());
            ViewModel.BindCollection(x => x.Events, e => RenderComments());
        }
        public IssueInfoController(string user, string slug, int id)
            : base(typeof(InternalIssueInfoModel))
        {
            User = user;
            Slug = slug;
            Id = id;
            Title = "Issue #" + id;

            NavigationItem.RightBarButtonItem = new UIBarButtonItem(NavigationButton.Create(CodeFramework.Images.Buttons.Edit, () => {
                var m = Model as InternalIssueInfoModel;
                var editController = new IssueEditController {
                     ExistingIssue = m.Issue,
                     Username = User,
                     RepoSlug = Slug,
                     Title = "Edit Issue",
                     Success = EditingComplete,
                 };
                NavigationController.PushViewController(editController, true);
            }));
            NavigationItem.RightBarButtonItem.Enabled = false;

            Style = UITableViewStyle.Grouped;
            Root.UnevenRows = true;
            _header = new HeaderView(View.Bounds.Width) { ShadowImage = false };
            Root.Add(new Section(_header));

            _desc = new MultilinedElement("") { BackgroundColor = UIColor.White };
            _desc.CaptionFont = _desc.ValueFont;
            _desc.CaptionColor = _desc.ValueColor;

            _split1 = new SplitElement(new SplitElement.Row { Image1 = Images.Buttons.Cog, Image2 = Images.Priority }) { BackgroundColor = UIColor.White };
            _split2 = new SplitElement(new SplitElement.Row { Image1 = Images.Buttons.Flag, Image2 = Images.ServerComponents }) { BackgroundColor = UIColor.White };
            _split3 = new SplitElement(new SplitElement.Row { Image1 = Images.SitemapColor, Image2 = Images.Milestone }) { BackgroundColor = UIColor.White };

            _responsible = new StyledElement("Unassigned", Images.Buttons.Person)
            {
                Font = StyledElement.DefaultDetailFont,
                TextColor = StyledElement.DefaultDetailColor,
            };
            _responsible.Tapped += () =>
            {
                var m = Model as InternalIssueInfoModel;
                if (m != null && m.Issue.Responsible != null)
                    NavigationController.PushViewController(new ProfileController(m.Issue.Responsible.Username), true);
            };

            var addComment = new StyledElement("Add Comment", Images.Pencil);
            addComment.Tapped += AddCommentTapped;

            _comments = new Section();
            _details = new Section { _split1, _split2, _split3, _responsible };

            Root.Add(_details);
            Root.Add(_comments);
            Root.Add(new Section { addComment });
        }
Beispiel #6
0
		public void RenderIssue()
		{
			if (ViewModel.Issue == null)
				return;

			NavigationItem.RightBarButtonItem.Enabled = true;

			var root = new RootElement(Title);
			_header.Title = ViewModel.Issue.Title;
			_header.Subtitle = "Updated " + ViewModel.Issue.UtcLastUpdated.ToDaysAgo();
			root.Add(new Section(_header));


			var secDetails = new Section();

			if (!string.IsNullOrEmpty(ViewModel.Issue.Content))
			{
				_descriptionElement.Value = ViewModel.MarkdownDescription;
				secDetails.Add(_descriptionElement);
			}

			var split1 = new SplitElement(new SplitElement.Row { Image1 = Images.Cog, Image2 = Images.Priority });
			split1.Value.Text1 = ViewModel.Issue.Status;
			split1.Value.Text2 = ViewModel.Issue.Priority;
			secDetails.Add(split1);


			var split2 = new SplitElement(new SplitElement.Row { Image1 = Images.Flag, Image2 = Images.ServerComponents });
			split2.Value.Text1 = ViewModel.Issue.Metadata.Kind;
			split2.Value.Text2 = ViewModel.Issue.Metadata.Component ?? "No Component";
			secDetails.Add(split2);


			var split3 = new SplitElement(new SplitElement.Row { Image1 = Images.SitemapColor, Image2 = Images.Milestone });
			split3.Value.Text1 = ViewModel.Issue.Metadata.Version ?? "No Version";
			split3.Value.Text2 = ViewModel.Issue.Metadata.Milestone ?? "No Milestone";
			secDetails.Add(split3);

			var assigneeElement = new StyledStringElement("Assigned", ViewModel.Issue.Responsible != null ? ViewModel.Issue.Responsible.Username : "******".t(), UITableViewCellStyle.Value1) {
				Image = Images.Person,
				Accessory = UITableViewCellAccessory.DisclosureIndicator
			};
			assigneeElement.Tapped += () => ViewModel.GoToAssigneeCommand.Execute(null);
			secDetails.Add(assigneeElement);

			root.Add(secDetails);

            if (ViewModel.Comments.Any(x => !string.IsNullOrEmpty(x.Content)))
			{
				root.Add(new Section { _commentsElement });
			}

			var addComment = new StyledStringElement("Add Comment") { Image = Images.Pencil };
			addComment.Tapped += AddCommentTapped;
			root.Add(new Section { addComment });
			Root = root;
		}