本文整理汇总了C#中Section.AddAll方法的典型用法代码示例。如果您正苦于以下问题:C# Section.AddAll方法的具体用法?C# Section.AddAll怎么用?C# Section.AddAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section.AddAll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Core
private void Core()
{
var rootStyles = new RootElement ("Add New Styles");
var styleHeaderElement = new Section ("Style Header");
var manualEntryRootElement = new RootElement ("Manual Entry");
styleHeaderElement.Add (manualEntryRootElement);
var quickFillElement = new Section ("Quick Fill");
var womenTops = new RootElement ("Womens Tops");
var womenOutwear = new RootElement ("Womens Outerwear");
var womenSweaters = new RootElement ("Womens Sweaters");
quickFillElement.AddAll (new [] { womenTops, womenOutwear, womenSweaters });
rootStyles.Add (new [] { styleHeaderElement, quickFillElement });
// DialogViewController derives from UITableViewController, so access all stuff from it
var rootDialog = new DialogViewController (rootStyles);
rootDialog.NavigationItem.BackBarButtonItem = new UIBarButtonItem("Back", UIBarButtonItemStyle.Bordered, null);
EventHandler handler = (s, e) => {
if(_popover != null)
_popover.Dismiss(true);
};
rootDialog.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Bordered, handler), true);
rootDialog.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem("Create", UIBarButtonItemStyle.Bordered, null), true);
NavigationPopoverContentViewController = new UINavigationController (rootDialog);
}
示例2: LoadLanguages
private async Task LoadLanguages()
{
var lRepo = new LanguageRepository();
var langs = await lRepo.GetLanguages();
var sec = new Section();
langs.Insert(0, new Language("All Languages", null));
sec.AddAll(langs.Select(x =>
{
var el = new StringElement(x.Name) { Accessory = UITableViewCellAccessory.None };
el.Clicked.Subscribe(_ => _languageSubject.OnNext(x));
return el;
}));
Root.Reset(sec);
if (SelectedLanguage != null)
{
var el = sec.Elements.OfType<StringElement>().FirstOrDefault(x => string.Equals(x.Caption, SelectedLanguage.Name));
if (el != null)
el.Accessory = UITableViewCellAccessory.Checkmark;
var indexPath = el?.IndexPath;
if (indexPath != null)
TableView.ScrollToRow(indexPath, UITableViewScrollPosition.Middle, false);
}
}
示例3: ViewWillAppear
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
var accountsService = Mvx.Resolve<IAccountsService>();
var weakVm = new WeakReference<AccountsViewController>(this);
var accountSection = new Section();
accountSection.AddAll(accountsService.Select(account =>
{
var t = new AccountElement(account, account.Equals(accountsService.ActiveAccount));
t.Tapped += () => weakVm.Get()?.SelectAccount(account);
return t;
}));
Root.Reset(accountSection);
SetCancelButton();
}
示例4: Render
public void Render()
{
if (ViewModel.Commits == null || ViewModel.Commit == null)
return;
var titleMsg = (ViewModel.Commit.Message ?? string.Empty).Split(new [] { '\n' }, 2).FirstOrDefault();
var avatarUrl = ViewModel.Commit.Author?.User?.Links?.Avatar?.Href;
var node = ViewModel.Node.Substring(0, ViewModel.Node.Length > 10 ? 10 : ViewModel.Node.Length);
Title = node;
HeaderView.Text = titleMsg ?? node;
HeaderView.SubText = "Commited " + (ViewModel.Commit.Date).Humanize();
HeaderView.SetImage(new Avatar(avatarUrl).ToUrl(128), Images.Avatar);
RefreshHeaderView();
var split = new SplitButtonElement();
split.AddButton("Comments", ViewModel.Comments.Items.Count.ToString());
split.AddButton("Participants", ViewModel.Commit.Participants.Count.ToString());
split.AddButton("Approvals", ViewModel.Commit.Participants.Count(x => x.Approved).ToString());
var commitModel = ViewModel.Commits;
ICollection<Section> root = new LinkedList<Section>();
root.Add(new Section { split });
var detailSection = new Section();
root.Add(detailSection);
var user = ViewModel.Commit.Author?.User?.DisplayName ?? ViewModel.Commit.Author.Raw ?? "Unknown";
detailSection.Add(new MultilinedElement(user, ViewModel.Commit.Message));
if (ViewModel.ShowRepository)
{
var repo = new StringElement(ViewModel.Repository) {
Accessory = UIKit.UITableViewCellAccessory.DisclosureIndicator,
Lines = 1,
TextColor = StringElement.DefaultDetailColor,
Image = AtlassianIcon.Devtoolsrepository.ToImage()
};
repo.Clicked.BindCommand(ViewModel.GoToRepositoryCommand);
detailSection.Add(repo);
}
if (_viewSegment.SelectedSegment == 0)
{
var paths = ViewModel.Commits.GroupBy(y =>
{
var filename = "/" + y.File;
return filename.Substring(0, filename.LastIndexOf("/", System.StringComparison.Ordinal) + 1);
}).OrderBy(y => y.Key);
foreach (var p in paths)
{
var fileSection = new Section(p.Key);
foreach (var x in p)
{
var y = x;
var file = x.File.Substring(x.File.LastIndexOf('/') + 1);
var sse = new ChangesetElement(file, x.Type, x.Diffstat.Added, x.Diffstat.Removed);
sse.Clicked.Select(_ => y).BindCommand(ViewModel.GoToFileCommand);
fileSection.Add(sse);
}
root.Add(fileSection);
}
}
else if (_viewSegment.SelectedSegment == 1)
{
var commentSection = new Section();
foreach (var comment in ViewModel.Comments)
{
var name = comment.User.DisplayName ?? comment.User.Username;
var avatar = new Avatar(comment.User.Links?.Avatar?.Href);
commentSection.Add(new CommentElement(name, comment.Content.Raw, comment.CreatedOn, avatar));
}
if (commentSection.Elements.Count > 0)
root.Add(commentSection);
var addComment = new StringElement("Add Comment") { Image = AtlassianIcon.Addcomment.ToImage() };
addComment.Clicked.Subscribe(_ => AddCommentTapped());
root.Add(new Section { addComment });
}
else if (_viewSegment.SelectedSegment == 2)
{
var likeSection = new Section();
likeSection.AddAll(ViewModel.Commit.Participants.Where(x => x.Approved).Select(l => {
var avatar = new Avatar(l.User?.Links?.Avatar?.Href);
var el = new UserElement(l.User.DisplayName, string.Empty, string.Empty, avatar);
el.Clicked.Select(_ => l.User.Username).BindCommand(ViewModel.GoToUserCommand);
return el;
}));
if (likeSection.Elements.Count > 0)
root.Add(likeSection);
StringElement approveButton;
if (ViewModel.Commit.Participants.Any(x => x.User.Username.Equals(ViewModel.GetApplication().Account.Username) && x.Approved))
{
approveButton = new StringElement("Unapprove") { Image = AtlassianIcon.Approve.ToImage() };
approveButton.Clicked.Subscribe(_ => this.DoWorkAsync("Unapproving...", ViewModel.Unapprove));
//.........这里部分代码省略.........
示例5: Render
public void Render()
{
if (ViewModel.Commits == null || ViewModel.Commit == null)
return;
var titleMsg = (ViewModel.Commit.Message ?? string.Empty).Split(new [] { '\n' }, 2).FirstOrDefault();
var avatarUrl = ViewModel.Commit.Author?.User?.Links?.Avatar?.Href;
var node = ViewModel.Node.Substring(0, ViewModel.Node.Length > 10 ? 10 : ViewModel.Node.Length);
Title = node;
HeaderView.Text = titleMsg ?? node;
HeaderView.SubText = "Commited " + (ViewModel.Commit.Date).Humanize();
HeaderView.SetImage(new Avatar(avatarUrl).ToUrl(128), Images.Avatar);
RefreshHeaderView();
var split = new SplitButtonElement();
split.AddButton("Comments", ViewModel.Comments.Items.Count.ToString());
split.AddButton("Participants", ViewModel.Commit.Participants.Count.ToString());
split.AddButton("Approvals", ViewModel.Commit.Participants.Count(x => x.Approved).ToString());
var commitModel = ViewModel.Commits;
var root = new RootElement(Title) { UnevenRows = Root.UnevenRows };
root.Add(new Section { split });
var detailSection = new Section();
root.Add(detailSection);
var user = ViewModel.Commit.Author?.User?.DisplayName ?? ViewModel.Commit.Author.Raw ?? "Unknown";
detailSection.Add(new MultilinedElement(user, ViewModel.Commit.Message)
{
CaptionColor = Theme.CurrentTheme.MainTextColor,
ValueColor = Theme.CurrentTheme.MainTextColor,
BackgroundColor = UIColor.White
});
if (ViewModel.ShowRepository)
{
var repo = new StyledStringElement(ViewModel.Repository) {
Accessory = UIKit.UITableViewCellAccessory.DisclosureIndicator,
Lines = 1,
Font = StyledStringElement.DefaultDetailFont,
TextColor = StyledStringElement.DefaultDetailColor,
Image = Images.Repo
};
repo.Tapped += () => ViewModel.GoToRepositoryCommand.Execute(null);
detailSection.Add(repo);
}
if (_viewSegment.SelectedSegment == 0)
{
var paths = ViewModel.Commits.GroupBy(y =>
{
var filename = "/" + y.File;
return filename.Substring(0, filename.LastIndexOf("/", System.StringComparison.Ordinal) + 1);
}).OrderBy(y => y.Key);
foreach (var p in paths)
{
var fileSection = new Section(p.Key);
foreach (var x in p)
{
var y = x;
var file = x.File.Substring(x.File.LastIndexOf('/') + 1);
var sse = new ChangesetElement(file, x.Type, x.Diffstat.Added, x.Diffstat.Removed);
sse.Tapped += () => ViewModel.GoToFileCommand.Execute(y);
fileSection.Add(sse);
}
root.Add(fileSection);
}
}
else if (_viewSegment.SelectedSegment == 1)
{
var commentSection = new Section();
foreach (var comment in ViewModel.Comments)
{
var name = comment.User.DisplayName ?? comment.User.Username;
var imgUri = new Avatar(comment.User.Links?.Avatar?.Href);
commentSection.Add(new NameTimeStringElement(name, comment.Content.Raw, comment.CreatedOn, imgUri.ToUrl(), Images.Avatar));
}
if (commentSection.Elements.Count > 0)
root.Add(commentSection);
var addComment = new StyledStringElement("Add Comment") { Image = Images.Pencil };
addComment.Tapped += AddCommentTapped;
root.Add(new Section { addComment });
}
else if (_viewSegment.SelectedSegment == 2)
{
var likeSection = new Section();
likeSection.AddAll(ViewModel.Commit.Participants.Where(x => x.Approved).Select(l => {
var el = new UserElement(l.User.DisplayName, string.Empty, string.Empty, l.User.Links.Avatar.Href);
el.Tapped += () => ViewModel.GoToUserCommand.Execute(l.User.Username);
return el;
}));
if (likeSection.Elements.Count > 0)
root.Add(likeSection);
//.........这里部分代码省略.........
示例6: RenderGist
public void RenderGist()
{
if (ViewModel.Gist == null) return;
var model = ViewModel.Gist;
ICollection<Section> sections = new LinkedList<Section>();
sections.Add(new Section { _split });
sections.Add(new Section { _splitRow1, _splitRow2, _ownerElement });
var sec2 = new Section();
sections.Add(sec2);
var weakVm = new WeakReference<GistViewModel>(ViewModel);
foreach (var file in model.Files.Keys)
{
var sse = new ButtonElement(file, Octicon.FileCode.ToImage())
{
LineBreakMode = UILineBreakMode.TailTruncation,
};
var fileSaved = file;
var gistFileModel = model.Files[fileSaved];
sse.Clicked.Subscribe(MakeCallback(weakVm, gistFileModel));
sec2.Add(sse);
}
if (ViewModel.Comments.Items.Count > 0)
{
var sec3 = new Section("Comments");
sec3.AddAll(ViewModel.Comments.Select(x => new CommentElement(x.User?.Login ?? "Anonymous", x.Body, x.CreatedAt, x.User?.AvatarUrl)));
sections.Add(sec3);
}
Root.Reset(sections);
}
示例7: ViewWillAppear
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
var root = new RootElement(Title);
var accountSection = new Section();
var accounts = PopulateAccounts();
accountSection.AddAll(accounts);
root.Add(accountSection);
Root = root;
CheckEntries();
}