当前位置: 首页>>代码示例>>C#>>正文


C# Section.AddAll方法代码示例

本文整理汇总了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);
	}
开发者ID:semuserable,项目名称:Cloud9,代码行数:30,代码来源:PopoverContentViewControllerOld.cs

示例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);
            }
        }
开发者ID:GitWatcher,项目名称:CodeHub,代码行数:28,代码来源:LanguagesViewController.cs

示例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();
        }
开发者ID:RaineriOS,项目名称:CodeHub,代码行数:17,代码来源:AccountsViewController.cs

示例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));
//.........这里部分代码省略.........
开发者ID:xNUTs,项目名称:CodeBucket,代码行数:101,代码来源:CommitView.cs

示例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);

//.........这里部分代码省略.........
开发者ID:Jeff-Lewis,项目名称:CodeBucket,代码行数:101,代码来源:CommitView.cs

示例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);
        }
开发者ID:GitWatcher,项目名称:CodeHub,代码行数:34,代码来源:GistView.cs

示例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();
        }
开发者ID:Jeff-Lewis,项目名称:CodeBucket,代码行数:13,代码来源:AccountsView.cs


注:本文中的Section.AddAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。