コード例 #1
0
ファイル: IssueView.cs プロジェクト: Jeff-Lewis/CodeBucket
		public void RenderIssue()
		{
			if (ViewModel.Issue == null)
				return;

            var avatar = new Avatar(ViewModel.Issue.ReportedBy?.Avatar);

			NavigationItem.RightBarButtonItem.Enabled = true;
            HeaderView.Text = ViewModel.Issue.Title;
            HeaderView.SetImage(avatar.ToUrl(), Images.Avatar);
            HeaderView.SubText = ViewModel.Issue.Content ?? "Updated " + ViewModel.Issue.UtcLastUpdated.Humanize();
            RefreshHeaderView();

            var split = new SplitButtonElement();
            split.AddButton("Comments", ViewModel.Comments.Items.Count.ToString());
            split.AddButton("Watches", ViewModel.Issue.FollowerCount.ToString());

            var root = new RootElement(Title);
            root.Add(new Section { split });

			var secDetails = new Section();

			if (!string.IsNullOrEmpty(ViewModel.Issue.Content))
			{
                _descriptionElement.LoadContent(new MarkdownRazorView { Model = ViewModel.Issue.Content }.GenerateString());
				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 : "******", 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;
		}
コード例 #2
0
 public PullRequestView()
 {
     Root.UnevenRows = true;
     _split1 = new SplitElement(new SplitElement.Row { Image1 = Images.Create, Image2 = Images.Merge }) { BackgroundColor = UIColor.White };
 }