• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Content类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Content的典型用法代码示例。如果您正苦于以下问题:C# Content类的具体用法?C# Content怎么用?C# Content使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Content类属于命名空间,在下文中一共展示了Content类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Initialize

        public override void Initialize(Content context, string backUri, Application application, object parameters)
        {
            base.Initialize(context, backUri, application, parameters);

            if (!SecurityHandler.HasPermission(NodeHead.Get("/Root/System/WebRoot/Explore.html"), PermissionType.Open))
                this.Forbidden = true;
        }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:7,代码来源:ExploreAction.cs


示例2: OnContentRestored

 public void OnContentRestored(Content category)
 {
     if (ContentRestored != null)
     {
         ContentRestored(new SingleItemEventArgs<Content>(category));
     }
 }
开发者ID:vivekmalikymca,项目名称:BetterCMS,代码行数:7,代码来源:ContentEvents.cs


示例3: HxS

        public HxS(string workingDir, string hxsFile,
            string title, string copyright, string locale,
            TreeNodeCollection nodes,
            Content contentDataSet,
            Dictionary<string, string> links)
        {
            this.locale = locale;
            this.title = title;
            this.copyright = copyright;
            this.nodes = nodes;
            this.contentDataSet = contentDataSet;
            this.links = links;

            this.outputFile = Path.GetFullPath(hxsFile);
            this.rawDir = Path.Combine(workingDir, "raw");

            // The source shouldn't be hidden away. If an error happens (likely) the user needs to check logs etc.
            //this.hxsDir = Path.Combine(workingDir, "hxs");
            this.hxsDir = GetUniqueDir(hxsFile);
            this.withinHxsDir = Path.Combine(hxsDir, hxsSubDir);
            this.baseFilename = Path.GetFileNameWithoutExtension(hxsFile);
            this.baseFilename = this.baseFilename.Replace(" ", "_");  //replace spaces with _ otherwise we get compile errors

            this.logFile = Path.Combine(hxsDir, this.baseFilename + ".log");
            this.projectFile = Path.Combine(hxsDir, baseFilename + ".hxc");

            if (xform == null)
            {
                xform = new XslCompiledTransform(true);
                xform.Load(transformFile);
            }
        }
开发者ID:mark-s,项目名称:MSDN-to-Kindle,代码行数:32,代码来源:Hxs.cs


示例4: ContentDeserializationTest_DeserializeFromJson_Success

		public void ContentDeserializationTest_DeserializeFromJson_Success()
		{
			var valuesToFill = new Content(
				// Add field.
				new FieldContent("Report date", new DateTime(2000, 01, 01).ToShortDateString()),
				// Add table.
				new TableContent("Team Members Table")
					.AddRow(
						new FieldContent("Name", "Eric"),
						new FieldContent("Role", "Program Manager"))
					.AddRow(
						new FieldContent("Name", "Bob"),
						new FieldContent("Role", "Developer")),
				// Add nested list.	
				new ListContent("Team Members Nested List")
					.AddItem(new ListItemContent("Role", "Program Manager")
						.AddNestedItem(new FieldContent("Name", "Eric"))
						.AddNestedItem(new FieldContent("Name", "Ann")))
					.AddItem(new ListItemContent("Role", "Developer")
						.AddNestedItem(new FieldContent("Name", "Bob"))
						.AddNestedItem(new FieldContent("Name", "Richard"))),
				// Add image
				new ImageContent("photo", new byte[] { 1, 2, 3 })
				);


			const string serialized = "{\"Tables\":[{\"Name\":\"Team Members Table\",\"Rows\":[{\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Name\",\"Value\":\"Eric\"},{\"Name\":\"Role\",\"Value\":\"Program Manager\"}],\"Images\":[]},{\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Name\",\"Value\":\"Bob\"},{\"Name\":\"Role\",\"Value\":\"Developer\"}],\"Images\":[]}],\"FieldNames\":[\"Name\",\"Role\"]}],\"Lists\":[{\"Name\":\"Team Members Nested List\",\"Items\":[{\"NestedFields\":[{\"NestedFields\":null,\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Name\",\"Value\":\"Eric\"}],\"Images\":[]},{\"NestedFields\":null,\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Name\",\"Value\":\"Ann\"}],\"Images\":[]}],\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Role\",\"Value\":\"Program Manager\"}],\"Images\":[]},{\"NestedFields\":[{\"NestedFields\":null,\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Name\",\"Value\":\"Bob\"}],\"Images\":[]},{\"NestedFields\":null,\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Name\",\"Value\":\"Richard\"}],\"Images\":[]}],\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Role\",\"Value\":\"Developer\"}],\"Images\":[]}],\"FieldNames\":[\"Role\",\"Name\"]}],\"Fields\":[{\"Name\":\"Report date\",\"Value\":\"01.01.2000\"}],\"Images\":[{\"Name\":\"photo\",\"Binary\":\"AQID\"}]}";

			var deserialized = JsonConvert.DeserializeObject<Content>(serialized);

			Assert.IsTrue(valuesToFill.Equals(deserialized));
		}
开发者ID:UNIT6-open,项目名称:TemplateEngine.Docx,代码行数:32,代码来源:ContentTests.cs


示例5: CreateAgreementDoc

 public static byte[] CreateAgreementDoc(string WebPath, string AgreementNumber, string AgreementDate, string UserName, string SignerName, string TargetPosition, string TargetDepartment, string SignerShortName, string SignerPositionWithDepartment, string UserShortName)
 {
     FileInfo file = new FileInfo(Path.Combine(WebPath, @"StaffMovements\Dogovor.docx"));
     string newfilename = Path.Combine(WebPath,Guid.NewGuid().ToString()+".docx");
     var newfile = file.CopyTo(newfilename,true);
     using (var outputDocument = new TemplateProcessor(newfilename)
         .SetRemoveContentControls(true))
     {
         var documentenc = Encoding.GetEncoding(outputDocument.Document.Declaration.Encoding);
         var valuesToFill = new Content(
             new FieldContent("AgreementNumber", AgreementNumber),
             new FieldContent("AgreementDate", AgreementDate),
             new FieldContent("UserName", UserName),
             new FieldContent("Signer", SignerName),
             new FieldContent("TargetPosition", TargetPosition),
             new FieldContent("TargetDepartment", TargetDepartment),
             new FieldContent("SignerShortName", SignerShortName),
             new FieldContent("SignerPositionWithDepartment", SignerPositionWithDepartment),
             new FieldContent("UserShortName", UserShortName)
         );
         outputDocument.FillContent(valuesToFill);
         outputDocument.SaveChanges();
     }
     StreamReader reader = new StreamReader(newfilename);
     var result =  NoteCreator.ReadFull(reader.BaseStream);
     //newfile.Delete();
     return result;
 }
开发者ID:andreyu,项目名称:Reports,代码行数:28,代码来源:StaffMovementsDocsCreator.cs


示例6: Markup_client_retrieves_last_known_good_content_from_local_cache_if_service_throws_exception

        public void Markup_client_retrieves_last_known_good_content_from_local_cache_if_service_throws_exception()
        {
            // Arrange
            var service = new Mock<IContentService>();

            service.Setup(x => x.Get(ContentTypes.Intranet_FatFooter)).Throws(new Exception("Unit test exception"));
            var cache = new Mock<ILocalCache<Content>>();
            cache.Setup(x => x.WriteToCache(ContentTypes.Intranet_FatFooter, It.IsAny<Content>(), It.IsAny<DateTime>()));
            var content = new Content
            {
                RefreshDate = DateTime.Now,
                Sections = new List<ContentSection>
                {
                    new ContentSection
                    {
                        Id = ContentTypes.Intranet_FatFooter.ToString()
                    }
                }
            };
            cache.Setup(x => x.ReadFromCache(ContentTypes.Intranet_FatFooter)).Returns(content);
            var client = new ContentClient(service.Object, cache.Object);

            // Act
            client.Get(ContentTypes.Intranet_FatFooter);

            // Assert
            service.Verify(x => x.Get(ContentTypes.Intranet_FatFooter), Times.Once);
            cache.Verify(x => x.ReadFromCache(ContentTypes.Intranet_FatFooter), Times.Once);
            cache.Verify(x => x.WriteToCache(ContentTypes.Intranet_FatFooter, It.IsAny<Content>(), It.IsAny<DateTime>()), Times.Never);
        }
开发者ID:ukp-webdev,项目名称:veneer-client,代码行数:30,代码来源:ContentClientTests.cs


示例7: SetupTestContentData

        public static Content SetupTestContentData(Guid newGuid, Guid newGuidRedHerring, ProviderSetup providerSetup)
        {
            var baseEntity = HiveModelCreationHelper.MockTypedEntity();
            var entity = new Content(baseEntity); 
            entity.Id = new HiveId(newGuid);
            entity.EntitySchema.Alias = "schema-alias1";

            var existingDef = entity.EntitySchema.AttributeDefinitions[0];
            var newDef = HiveModelCreationHelper.CreateAttributeDefinition("aliasForQuerying", "", "", existingDef.AttributeType, existingDef.AttributeGroup, true);
            entity.EntitySchema.AttributeDefinitions.Add(newDef);
            entity.Attributes.Add(new TypedAttribute(newDef, "my-new-value"));

            entity.Attributes[1].DynamicValue = "not-on-red-herring";
            entity.Attributes[NodeNameAttributeDefinition.AliasValue].Values["UrlName"] = "my-test-route";

            var redHerringEntity = HiveModelCreationHelper.MockTypedEntity();
            redHerringEntity.Id = new HiveId(newGuidRedHerring);
            redHerringEntity.EntitySchema.Alias = "redherring-schema";

            using (var uow = providerSetup.UnitFactory.Create())
            {
                var publishedRevision = new Revision<TypedEntity>(entity)
                    { MetaData = { StatusType = FixedStatusTypes.Published } };

                uow.EntityRepository.Revisions.AddOrUpdate(publishedRevision);
                // Only add extra entity if caller wants it
                if (newGuidRedHerring != Guid.Empty) uow.EntityRepository.AddOrUpdate(redHerringEntity);
                uow.Complete();
            }

            return entity;
        }
开发者ID:paulsuart,项目名称:rebelcmsxu5,代码行数:32,代码来源:HiveModelCreationHelper.cs


示例8: Add_AddOneBookWithParamsNull

 public void Add_AddOneBookWithParamsNull()
 {
     string[] testContentParams = new string[] { null };
     IContent testContent = new Content(ContentType.Book, testContentParams);
     ICatalog currentCatalog = new Catalog();
     currentCatalog.Add(testContent);
 }
开发者ID:quela,项目名称:myprojects,代码行数:7,代码来源:ICatalogTests.cs


示例9: Add_AddTwoIndenticalBooksAndThreeOtherItems

        public void Add_AddTwoIndenticalBooksAndThreeOtherItems()
        {
            string[] testBookContentParams = new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" };
            IContent testBookContent = new Content(ContentType.Book, testBookContentParams);
            ICatalog currentCatalog = new Catalog();
            currentCatalog.Add(testBookContent);
            currentCatalog.Add(testBookContent);

            string[] testMovieContentParams = new string[] { "The Secret", "Drew Heriot, Sean Byrne & others (2006)", "832763834", "http://t.co/dNV4d" };
            IContent testMovieContent = new Content(ContentType.Book, testMovieContentParams);
            currentCatalog.Add(testMovieContent);

            string[] testApplicationContentParams = new string[] { "Firefox v.11.0", "Mozilla", "16148072", "http://www.mozilla.org" };
            IContent testApplicationContent = new Content(ContentType.Book, testApplicationContentParams);
            currentCatalog.Add(testApplicationContent);

            string[] testSongContentParams = new string[] { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" };
            IContent testSongContent = new Content(ContentType.Book, testSongContentParams);
            currentCatalog.Add(testSongContent);

            IEnumerable<IContent> currentContent = currentCatalog.GetListContent("One", 10);
            int numberOfRenurnedResults = currentContent.Count();

            Assert.AreEqual(1, numberOfRenurnedResults);
        }
开发者ID:quela,项目名称:myprojects,代码行数:25,代码来源:ICatalogTests.cs


示例10: Create

 public  Content Create(Content content, HttpPostedFileBase picture)
 {
     try
     {
         if (picture != null && picture.ContentLength > 0)
         {
             string ext = VirtualPathUtility.GetExtension(picture.FileName);
             MemoryStream ms = new MemoryStream();
             Image bitmap = Image.FromStream(picture.InputStream);
             string filename = content.UniqueKey + ".jpg";
             bitmap.Save(Path.Combine(DBNLConfigurationManager.FileResponsity.PictureFolder, filename), ImageFormat.Jpeg);
             content.Picture = filename;
             bitmap.Dispose();
             ms.Close();
         }
     }
     catch (IOException ex)
     {
     }
     //content.CreatedDate = DateTime.Now;
     content.UpdatedDate = DateTime.Now;
     
     Contents.InsertOnSubmit(content);
     Commit();
     return content;
 }
开发者ID:samuraitruong,项目名称:dubaonhanluc,代码行数:26,代码来源:ContentService.cs


示例11: IsInvalidVersioningAction

        private static bool IsInvalidVersioningAction(Content context, string actionName)
        {
            if (string.IsNullOrEmpty(actionName) || context == null)
                return false;

            actionName = actionName.ToLower();

            var generic = context.ContentHandler as GenericContent;
            if (generic == null)
                return false;

            switch (actionName)
            {
                case "checkin":
                    return !SavingAction.HasCheckIn(generic);
                case "checkout":
                    return (generic.VersioningMode <= VersioningType.None && !(generic is IFile || generic.NodeType.IsInstaceOfOrDerivedFrom("Page"))) || !SavingAction.HasCheckOut(generic);
                case "undocheckout":
                    return !SavingAction.HasUndoCheckOut(generic);
                case "forceundocheckout":
                    return !SavingAction.HasForceUndoCheckOutRight(generic);
                case "publish":
                    return (generic.VersioningMode <= VersioningType.None || !SavingAction.HasPublish(generic));
                case "approve":
                case "reject":
                    return !generic.Approvable;
                default:
                    return false;
            }
        }
开发者ID:jhuntsman,项目名称:FlexNet,代码行数:30,代码来源:ActionFactory.cs


示例12: IsEqual

 public static HtmlString IsEqual(this Content content, Content comparer, string valueIfTrue, string valueIfFalse)
 {
     if (comparer.Id == content.Id)
         return new HtmlString(valueIfTrue);
     else
         return new HtmlString(valueIfFalse);
 }
开发者ID:perploug,项目名称:JubRazorExtensions,代码行数:7,代码来源:IsHelpers.cs


示例13: IsDescendantOrSelf

 public static HtmlString IsDescendantOrSelf(this Content content, Content ancestor, string valueIfTrue, string valueIfFalse)
 {
     if (ancestor.AllDescendantIdsOrSelf().Contains(content.Id))
         return new HtmlString(valueIfTrue);
     else
         return new HtmlString(valueIfFalse);
 }
开发者ID:perploug,项目名称:JubRazorExtensions,代码行数:7,代码来源:IsHelpers.cs


示例14: IsAncestorOrSelf

 public static HtmlString IsAncestorOrSelf(this Content content, Content child, string valueIfTrue, string valueIfFalse)
 {
     if (child.AllAncestorIdsOrSelf().Contains(content.Id))
         return new HtmlString(valueIfTrue);
     else
         return new HtmlString(valueIfFalse);
 }
开发者ID:perploug,项目名称:JubRazorExtensions,代码行数:7,代码来源:IsHelpers.cs


示例15: AttachButtonEvent

		private void AttachButtonEvent(Content.TowerSelectionPanel buttonName, TowerType type)
		{
			var button = (InteractiveButton)GetSceneControl(buttonName.ToString());
			button.AddTag(type.ToString());
			button.Clicked += () => BuildTower(type);
			towerButtonPanel.Add(button);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:TowerSelectionPanel.cs


示例16: Save

        public void Save(Content content)
        {
            if (content.Id == 0)
                _dataContext.Content.Add(content);

            _dataContext.SaveChanges();
        }
开发者ID:stack72,项目名称:GiveCamp-London,代码行数:7,代码来源:ContentRepository.cs


示例17: GameInfo

 /// <summary>
 /// Constructs a default GameInfo object, with 0 handicap, 5.5 komi 19x19 board and
 /// black as the starting player.
 /// </summary>
 public GameInfo()
 {
     Komi = 5.5;
     StartingPlayer = Content.Black;
     Handicap = 0;
     BoardSizeX = BoardSizeY = 19;
 }
开发者ID:nerai,项目名称:GoSharp,代码行数:11,代码来源:GameInfo.cs


示例18: CopyDataTo

        public override Content CopyDataTo(Content content)
        {
            var copy = (Widget)base.CopyDataTo(content);
            copy.Category = Category;

            return copy;
        }
开发者ID:tkirda,项目名称:BetterCMS,代码行数:7,代码来源:Widget.cs


示例19: HttpContent

 HttpContent(Content content, string contentType, long? contentLength)
 {
     this.content = content;
     this.contentType = contentType;
     this.contentLength = contentLength;
     this.state = ContentState.Created;
 }
开发者ID:o2platform,项目名称:O2.Platform.Projects,代码行数:7,代码来源:HttpContent.cs


示例20: Initialize

        public override void Initialize(Content context, string backUri, Application application, object parameters)
        {
            base.Initialize(context, backUri, application, parameters);

            if (!context.Path.Contains("/(apps)/This/"))
                this.Forbidden = true;
        }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:7,代码来源:DeleteLocalAppAction.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ContentAPI类代码示例发布时间:2022-05-24
下一篇:
C# ContainmentOperator类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap