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


C# Section.Add方法代码示例

本文整理汇总了C#中Section.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Section.Add方法的具体用法?C# Section.Add怎么用?C# Section.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Section的用法示例。


在下文中一共展示了Section.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: It_holds_parts_added_to_it

        public void It_holds_parts_added_to_it()
        {
            var section = new Section("foo");

            section.Add(new LiteralText("bar"));
            section.Add(new LiteralText("baz"));

            section.Parts.IsEqualTo(new LiteralText("bar"),
                                    new LiteralText("baz"));
        }
开发者ID:Romanx,项目名称:Nustache,代码行数:10,代码来源:Describe_Section.cs

示例2: It_does_not_hold_template_definitions_with_other_parts

        public void It_does_not_hold_template_definitions_with_other_parts()
        {
            var section = new Section("foo");

            section.Add(new LiteralText("bar"));
            section.Add(new TemplateDefinition("baz"));
            section.Add(new LiteralText("quux"));

            section.Parts.IsEqualTo(new LiteralText("bar"),
                                    new LiteralText("quux"));
        }
开发者ID:Romanx,项目名称:Nustache,代码行数:11,代码来源:Describe_Section.cs

示例3: CreateDynamicContent

		// Creates the dynamic content from the twitter results
		RootElement CreateDynamicContent (XDocument doc)
		{
			var users = doc.XPathSelectElements ("./statuses/status/user").ToArray ();
			var texts = doc.XPathSelectElements ("./statuses/status/text").Select (x=>x.Value).ToArray ();
			var people = doc.XPathSelectElements ("./statuses/status/user/name").Select (x=>x.Value).ToArray ();
			
			var section = new Section ();
			var root = new RootElement ("Tweets") { section };
			
			for (int i = 0; i < people.Length; i++){
				var line = new RootElement (people [i]) { 
					new Section ("Profile"){
						new StringElement ("Screen name", users [i].XPathSelectElement ("./screen_name").Value),
						new StringElement ("Name", people [i]),
						new StringElement ("oFllowers:", users [i].XPathSelectElement ("./followers_count").Value)
					},
					new Section ("Tweet"){
						new StringElement (texts [i])
					}
				};
				section.Add((Element) line);
			}
			
			return root;
		}
开发者ID:moljac,项目名称:MonoMobile.Dialog,代码行数:26,代码来源:DemoDynamic.cs

示例4: DemoHeadersFooters

		public void DemoHeadersFooters () 
		{
			var section = new Section () { 
				HeaderView = new UIImageView (UIImage.FromFile ("caltemplate.png")),
				FooterView = new UISwitch (new RectangleF (0, 0, 80, 30)),
			};
			
			// Fill in some data 
			var linqRoot = new RootElement ("LINQ source"){
				from x in new string [] { "one", "two", "three" }
					select new Section (x) {
						from y in "Hello:World".Split (':')
							select (Element) new StringElement (y)
				}
			};

			section.Add ((Element) new RootElement ("Desert", new RadioGroup ("desert", 0)){
				new Section () {
					new RadioElement ("Ice Cream", "desert"),
					new RadioElement ("Milkshake", "desert"),
					new RadioElement ("Chocolate Cake", "desert")
				},
			});
			
			var root = new RootElement ("Headers and Footers") {
				section,
				new Section () { (Element) linqRoot }
			};
			var dvc = new DialogViewController (root, true);
			navigation.PushViewController (dvc, true);
		}
开发者ID:moljac,项目名称:MonoMobile.Dialog,代码行数:31,代码来源:DemoHeadersFooters.cs

示例5: 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

示例6: MultipleChoiceEntryElement

 public MultipleChoiceEntryElement (string caption, params string[] options): base(caption, new RadioGroup(-1)) {
     var section = new Section(caption);
     foreach(var s in options) {
         section.Add(new RadioEntryElement(s));
     }
     Add(section);
 }
开发者ID:cmckeegan,项目名称:MonoTouch.Dialog,代码行数:7,代码来源:MultipleChoiceEntryElement.cs

示例7: accept_visitor_calls_into_steps_as_well

        public void accept_visitor_calls_into_steps_as_well()
        {
            var visitor = MockRepository.GenerateMock<ITestVisitor>();
            var step1 = MockRepository.GenerateMock<IStep>();
            var step2 = MockRepository.GenerateMock<IStep>();
            var step3 = MockRepository.GenerateMock<IStep>();

            var section = new Section("something");
            section.Add(step1);
            section.Add(step2);
            section.Add(step3);

            section.AcceptVisitor(visitor);

            step1.AssertWasCalled(x => x.AcceptVisitor(visitor));
            step2.AssertWasCalled(x => x.AcceptVisitor(visitor));
            step3.AssertWasCalled(x => x.AcceptVisitor(visitor));
        }
开发者ID:adymitruk,项目名称:storyteller,代码行数:18,代码来源:SectionTester.cs

示例8: It_allows_you_to_look_up_template_definitions_by_name

        public void It_allows_you_to_look_up_template_definitions_by_name()
        {
            var section = new Section("foo");
            var templateDefinition = new TemplateDefinition("bar");
            section.Add(templateDefinition);

            var actual = section.GetTemplateDefinition(templateDefinition.Name);

            Assert.AreSame(templateDefinition, actual);
        }
开发者ID:Romanx,项目名称:Nustache,代码行数:10,代码来源:Describe_Section.cs

示例9: DemoLoadMore

		public void DemoLoadMore () 
		{
			Section loadMore = new Section();
			
			var s = new StyledStringElement ("Hola") {
				BackgroundUri = new Uri ("http://www.google.com/images/logos/ps_logo2.png")
				//BackgroundColor = UIColor.Red
			};
			loadMore.Add (s);
			loadMore.Add (new StringElement("Element 1"));
			loadMore.Add (new StringElement("Element 2"));
			loadMore.Add (new StringElement("Element 3"));
						
			
			loadMore.Add (new LoadMoreElement("Load More Elements...", "Loading Elements...", lme => {
				// Launch a thread to do some work
				ThreadPool.QueueUserWorkItem (delegate {
					
					// We just wait for 2 seconds.
					System.Threading.Thread.Sleep(2000);
				
					// Now make sure we invoke on the main thread the updates
					navigation.BeginInvokeOnMainThread(delegate {
						lme.Animating = false;
						loadMore.Insert(loadMore.Count - 1, new StringElement("Element " + (loadMore.Count + 1)),
				    		            new StringElement("Element " + (loadMore.Count + 2)),
				            		    new StringElement("Element " + (loadMore.Count + 3)));
					
					});
				});
				
			}, UIFont.BoldSystemFontOfSize(14.0f), UIColor.Blue));
							
			var root = new RootElement("Load More") {
				loadMore
			};
			
			var dvc = new DialogViewController (root, true);
			navigation.PushViewController (dvc, true);
		}
开发者ID:moljac,项目名称:MonoMobile.Dialog,代码行数:40,代码来源:DemoLoadMore.cs

示例10: OnSaveClicked

		public void OnSaveClicked(object sender, EventArgs args)
		{
			// create flow document and register necessary styles
			FlowDocument doc = new FlowDocument();
			doc.Margin = new Thickness (10,10,10,10);
			// the style for all document's textblocks
			doc.StyleManager.RegisterStyle("TextBlock, TextBox", new Style()
				{				
					Font = new Font("Helvetica",20),
					Color = RgbColors.Black,
					Display = Display.Block						
				});

			// the style for the section that contains employee data
			doc.StyleManager.RegisterStyle ("#border", new Style ()
				{
					Padding = new Thickness(10,10,10,10),
					BorderColor = RgbColors.DarkRed,
					Border = new Border(5),
					BorderRadius=5
				}
			);

			// add PDF form fields for later processing
			doc.Fields.Add (new TextField ("firstName", currentEmployee.FirstName));
			doc.Fields.Add (new TextField ("lastName", currentEmployee.LastName));
			doc.Fields.Add (new TextField ("position", currentEmployee.CurrentPosition));

			// create section and add text block inside
			Section section = new Section (){Id="border"};

			//  ios PDF preview doesn't display fields correctly, 
			//  uncomment this code to use simple text blocks instead of text boxes	  		  
//			section.Add(new TextBlock(string.Format("First name: {0}",currentEmployee.FirstName)));
//		    section.Add(new TextBlock(string.Format("Last name: {0}",currentEmployee.LastName)));
//		    section.Add(new TextBlock(string.Format("Position: {0}",currentEmployee.CurrentPosition)));
			    
			section.Add(new TextBlock("First name: "));
			section.Add(new TextBox("firstName"));
			section.Add(new TextBlock("Last name: "));
			section.Add(new TextBox("lastName"));
			section.Add(new TextBlock("Position: "));
			section.Add(new TextBox("position"));

			doc.Add (section);

			// get io service and generate output file path
			var fileManager = DependencyService.Get<IFileIO>();
			string filePath = Path.Combine (fileManager.GetMyDocumentsPath (), "form.pdf");

			// generate document
			using(Stream outputStream = fileManager.CreateFile(filePath))
		    {
				doc.Write (outputStream, new ResourceManager());
			}

			// request preview
			DependencyService.Get<IPDFPreviewProvider>().TriggerPreview (filePath);
		}
开发者ID:apitron,项目名称:Xamarin.Forms.Samples,代码行数:59,代码来源:MyPage.xaml.cs

示例11: BuildRoot

        private RootElement BuildRoot(string url)
        {
            var root = new RootElement (String.Empty);
            var section = new Section("TodoItems");
            root.Add (section);
            var result = GetAzureResult (url);

            foreach (JsonObject item in result) {
                section.Add (new StringElement(item["text"]));
            }

            return root;
        }
开发者ID:BerndtHamboeck,项目名称:AndroidAzure,代码行数:13,代码来源:Activity1.cs

示例12: DeserializeBinary

        private static Configuration DeserializeBinary(BinaryReader reader, Stream stream)
        {
            if (stream == null)
                throw new ArgumentNullException("stream");

            bool ownReader = false;

            if (reader == null)
            {
                reader = new BinaryReader(stream);
                ownReader = true;
            }

            try
            {
                var config = new Configuration();

                int sectionCount = reader.ReadInt32();

                for (int i = 0; i < sectionCount; i++)
                {
                    string sectionName = reader.ReadString();
                    int settingCount = reader.ReadInt32();

                    Section section = new Section(sectionName);

                    DeserializeComments(reader, section);

                    for (int j = 0; j < settingCount; j++)
                    {
                        Setting setting = new Setting(
                            reader.ReadString(),
                            reader.ReadString());

                        DeserializeComments(reader, setting);

                        section.Add(setting);
                    }

                    config.Add(section);
                }

                return config;
            }
            finally
            {
                if (ownReader)
                    reader.Close();
            }
        }
开发者ID:SepCat,项目名称:SharpConfig,代码行数:50,代码来源:Configuration.Deserialization.cs

示例13: MultipleChoiceViewController

        public MultipleChoiceViewController(string title, object obj)
        {
            _obj = obj;
            Title = title;
            Style = UITableViewStyle.Grouped;

            var sec = new Section();
            var fields = obj.GetType().GetProperties();
            foreach (var s in fields)
            {
                var copy = s;
                sec.Add(new StyledStringElement(s.Name, () => OnValueSelected(copy)) { 
                    Accessory = (bool)s.GetValue(_obj) ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None 
                });
            }
            Root.Add(sec);
        }
开发者ID:Jeff-Lewis,项目名称:CodeBucket,代码行数:17,代码来源:MultipleChoiceViewController.cs

示例14: IssueMilestonesFilterViewController

        public IssueMilestonesFilterViewController(string user, string repo, bool alreadySelected)
            : base(UIKit.UITableViewStyle.Plain)
        {
            _username = user;
            _repository = repo;
            Title = "Milestones";
            SearchPlaceholder = "Search Milestones";

            var clearMilestone = new MilestoneModel { Title = "Clear milestone filter" };
            var noMilestone = new MilestoneModel { Title = "Issues with no milestone" };
            var withMilestone = new MilestoneModel { Title = "Issues with milestone" };

            _milestones.CollectionChanged += (sender, e) => {
                var items = _milestones.ToList();

                items.Insert(0, noMilestone);
                items.Insert(1, withMilestone);

                if (alreadySelected)
                    items.Insert(0, clearMilestone);

                var sec = new Section();
                foreach (var item in items)
                {
                    var x = item;
                    var element = new StringElement(x.Title);
                    element.Clicked.Subscribe(_ => {
                        if (MilestoneSelected != null)
                        {
                            if (x == noMilestone)
                                MilestoneSelected(x.Title, null, "none");
                            else if (x == withMilestone)
                                MilestoneSelected(x.Title, null, "*");
                            else if (x == clearMilestone)
                                MilestoneSelected(null, null, null);
                            else
                                MilestoneSelected(x.Title, x.Number, x.Number.ToString());
                        }
                    });
                    sec.Add(element);
                }

                InvokeOnMainThread(() => Root.Reset(sec));
            };
        }
开发者ID:RaineriOS,项目名称:CodeHub,代码行数:45,代码来源:IssueMilestonesFilterViewController.cs

示例15: MultipleChoiceViewController

        public MultipleChoiceViewController(string title, object obj)
            : base(UITableViewStyle.Grouped)
        {
            _obj = obj;
            Title = title;

            var sec = new Section();
            var fields = obj.GetType().GetProperties();
            foreach (var s in fields)
            {
                var copy = s;
                var accessory = (bool)s.GetValue(_obj) ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None;
                var e = new StringElement(s.Name) { Accessory = accessory };
                e.Clicked.Subscribe(_ => OnValueSelected(copy));
                sec.Add(e);
            }
            Root.Add(sec);
        }
开发者ID:RaineriOS,项目名称:CodeHub,代码行数:18,代码来源:MultipleChoiceViewController.cs


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