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


C# IStText.AddNewTextPara方法代码示例

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


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

示例1: DoSetupFixture

		/// <summary>
		/// non-undoable task
		/// </summary>
		private void DoSetupFixture()
		{
			var textFactory = Cache.ServiceLocator.GetInstance<ITextFactory>();
			var stTextFactory = Cache.ServiceLocator.GetInstance<IStTextFactory>();
			m_text = textFactory.Create();
			//Cache.LangProject.TextsOC.Add(m_text);
			m_stText = stTextFactory.Create();
			m_text.ContentsOA = m_stText;
			m_para0 = m_stText.AddNewTextPara(null);
			m_para0.Contents = TsStringUtils.MakeTss("Xxxhope xxxthis xxxwill xxxdo. xxxI xxxhope.", Cache.DefaultVernWs);
			m_para1 = m_stText.AddNewTextPara(null);
			m_para1.Contents = TsStringUtils.MakeTss("Xxxcertain xxxto xxxcatch xxxa xxxfrog. xxxCertainly xxxcan. xxxOn xxxLake xxxMonroe.", Cache.DefaultVernWs);
			m_para2 = null;

			using (ParagraphParser pp = new ParagraphParser(Cache))
				foreach (IStTxtPara para in m_stText.ParagraphsOS)
					pp.Parse(para);

			m_expectedAnOcs = new List<AnalysisOccurrence>();
			foreach (IStTxtPara para in m_stText.ParagraphsOS)
				foreach (ISegment seg in para.SegmentsOS)
					for (int i = 0; i < seg.AnalysesRS.Count; i++)
						m_expectedAnOcs.Add(new AnalysisOccurrence(seg, i));

			m_expectedAnOcsPara0 = new List<AnalysisOccurrence>();
			foreach (ISegment seg in m_para0.SegmentsOS)
				for (int i = 0; i < seg.AnalysesRS.Count; i++)
					m_expectedAnOcsPara0.Add(new AnalysisOccurrence(seg, i));
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:32,代码来源:AnalysisOccurrenceTests.cs

示例2: DoSetupFixture

		/// <summary>non-undoable task because setting up an StText must be done in a Unit of Work</summary>
		private void DoSetupFixture()
		{
			m_application = new MockFwXApp(new MockFwManager { Cache = Cache }, null, null);
			var configFilePath = Path.Combine(FwDirectoryFinder.CodeDirectory, m_application.DefaultConfigurationPathname);
			m_window = new MockFwXWindow(m_application, configFilePath);
			((MockFwXWindow)m_window).Init(Cache); // initializes Mediator values
			m_mediator = m_window.Mediator;

			// set up default vernacular ws.
			m_wsDefaultVern = Cache.ServiceLocator.WritingSystemManager.Get("fr");
			m_wsOtherVern = Cache.ServiceLocator.WritingSystemManager.Get("es");
			m_wsEn = Cache.ServiceLocator.WritingSystemManager.Get("en");
			Cache.ServiceLocator.WritingSystems.VernacularWritingSystems.Add(m_wsOtherVern);
			Cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems.Add(m_wsOtherVern);
			Cache.ServiceLocator.WritingSystems.VernacularWritingSystems.Add(m_wsDefaultVern);
			Cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems.Insert(0, m_wsDefaultVern);

			// set up an StText with an empty paragraph with default Contents (empty English TsString)
			m_sttNoExplicitWs = Cache.ServiceLocator.GetInstance<IStTextFactory>().Create();
			Cache.ServiceLocator.GetInstance<ITextFactory>().Create().ContentsOA = m_sttNoExplicitWs;
			m_sttNoExplicitWs.AddNewTextPara(null);
			Assert.AreEqual(m_wsEn.Handle, m_sttNoExplicitWs.MainWritingSystem, "Our code counts on English being the defualt WS for very empty texts");

			// set up an StText with an empty paragraph with an empty TsString in a non-default vernacular
			m_sttEmptyButWithWs = Cache.ServiceLocator.GetInstance<IStTextFactory>().Create();
			Cache.ServiceLocator.GetInstance<ITextFactory>().Create().ContentsOA = m_sttEmptyButWithWs;
			m_sttEmptyButWithWs.AddNewTextPara(null);
			((IStTxtPara)m_sttEmptyButWithWs.ParagraphsOS[0]).Contents = TsStringUtils.MakeTss(string.Empty, m_wsOtherVern.Handle);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:30,代码来源:InterlinMasterTests.cs

示例3: TestSetup

		/// <summary>
		///
		/// </summary>
		public override void TestSetup()
		{
			base.TestSetup();

			m_wsVern = Cache.DefaultVernWs;
			m_wsTrans = Cache.DefaultAnalWs;
			m_book = Cache.ServiceLocator.GetInstance<IScrBookFactory>().Create(1);
			m_section = Cache.ServiceLocator.GetInstance<IScrSectionFactory>().Create();
			m_book.SectionsOS.Add(m_section);
			m_section.ContentOA = m_text = Cache.ServiceLocator.GetInstance<IStTextFactory>().Create(); ;
			m_para = m_text.AddNewTextPara(ScrStyleNames.NormalParagraph);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:15,代码来源:FreeTransEditMonitorTests.cs

示例4: DoSetupFixture

		/// <summary>
		/// non-undoable task
		/// </summary>
		private void DoSetupFixture()
		{
			// setup default vernacular ws.
			IWritingSystem wsXkal = Cache.ServiceLocator.WritingSystemManager.Set("qaa-x-kal");
			wsXkal.DefaultFontName = "Times New Roman";
			Cache.ServiceLocator.WritingSystems.VernacularWritingSystems.Add(wsXkal);
			Cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems.Insert(0, wsXkal);
			var textFactory = Cache.ServiceLocator.GetInstance<ITextFactory>();
			var stTextFactory = Cache.ServiceLocator.GetInstance<IStTextFactory>();
			m_text0 = textFactory.Create();
			//Cache.LangProject.TextsOC.Add(m_text0);
			m_stText0 = stTextFactory.Create();
			m_text0.ContentsOA = m_stText0;
			m_para0_0 = m_stText0.AddNewTextPara(null);
			m_para0_0.Contents = TsStringUtils.MakeTss("Xxxhope xxxthis xxxwill xxxdo. xxxI xxxhope.", wsXkal.Handle);

			InterlinMaster.LoadParagraphAnnotationsAndGenerateEntryGuessesIfNeeded(m_stText0, false);
			// paragraph 0_0 simply has wordforms as analyses
			foreach (var occurence in SegmentServices.GetAnalysisOccurrences(m_para0_0))
				if (occurence.HasWordform)
					m_analysis_para0_0.Add(new AnalysisTree(occurence.Analysis));

		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:26,代码来源:InterlinDocForAnalysisTests.cs

示例5: CreateParagraph

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Append a new <see cref="IStTxtPara"/> to the given <see cref="IStText"/>.
		/// Set it with data accumulated in this builder.
		/// </summary>
		/// <param name="owner">The <see cref="IStText"/> that is to own the new paragraph</param>
		/// <returns>A new StTextPara whose contents are built up from the prior calls
		/// to <see cref="AppendRun"/> and whose style is set based on the current value of
		/// <see cref="ParaStylePropsProxy"/>.</returns>
		/// ------------------------------------------------------------------------------------
		public IStTxtPara CreateParagraph(IStText owner)
		{
			// insert a new para in the owner's collection
			IStTxtPara para = owner.AddNewTextPara(ParaStyleName);
			SetStTxtParaPropertiesAndClearBuilder(para);

			return para;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:18,代码来源:StTxtParaBldr.cs

示例6: AddParaToMockedText

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Add an empty but properly initialized (with WS) content paragraph to the specified
		/// StText in the mock fdocache
		/// </summary>
		/// <param name="owner">the hvo of the StText</param>
		/// <param name="paraStyleName">the paragraph style name</param>
		/// ------------------------------------------------------------------------------------
		protected IStTxtPara AddParaToMockedText(IStText owner, string paraStyleName)
		{
			IStTxtPara para = owner.AddNewTextPara(paraStyleName);
			para.Contents = Cache.TsStrFactory.MakeString(string.Empty, Cache.DefaultVernWs);
			return para;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:14,代码来源:FdoTestBase.cs

示例7: InitializeText

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initialize the text for the paragraph with the specified builder, or create an
		/// empty paragraph if the builder is null.
		/// </summary>
		/// <param name="bldr">paragraph builder</param>
		/// <param name="text">StText</param>
		/// ------------------------------------------------------------------------------------
		private void InitializeText(StTxtParaBldr bldr, IStText text)
		{
			if (bldr == null)
			{
				IStTxtPara para = text.AddNewTextPara(ScrStyleNames.Remark);
				para.Contents = TsStringUtils.MakeTss(String.Empty, Cache.DefaultAnalWs);
			}
			else
			{
				bldr.CreateParagraph(text);
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:20,代码来源:ScrScriptureNote.cs

示例8: SetCustomStTextValues

 // TODO: If LanguageForge allows editing paragraph styles in multi-paragraph fields, the styleForNewParas parameter
 // will need to become a list of styles, one per paragraph. At that point we might as well add the style to the LfTxtPara
 // struct, and pass a list of such structs into SetCustomStTextValues.
 public static void SetCustomStTextValues(IStText fdoStText, IEnumerable<Guid> lfGuids, IEnumerable<string> lfParaContents, int wsId, string styleForNewParas)
 {
     LfTxtPara[] lfParas = lfGuids.Zip(lfParaContents, (g, s) => new LfTxtPara { Guid=g, Contents=s }).ToArray();
     // Step 1: Delete all FDO paragraphs that are no longer found in LF
     var guidsInLf = new HashSet<Guid>(lfGuids);
     var parasToDelete = new HashSet<IStTxtPara>();
     for (int i = 0, count = fdoStText.ParagraphsOS.Count; i < count; i++)
     {
         IStTxtPara para = fdoStText[i];
         if (!guidsInLf.Contains(para.Guid))
             parasToDelete.Add(para);
     }
     // Step 2: Step through LF and FDO paragraphs *by integer index* and copy texts over, adding new paras as needed
     for (int i = 0, count = lfParas.Length; i < count; i++)
     {
         LfTxtPara lfPara = lfParas[i];
         IStTxtPara fdoPara;
         if (i >= fdoStText.ParagraphsOS.Count)
         {
             // Past the end of existing FDO paras: create new para at end
             fdoPara = fdoStText.AddNewTextPara(styleForNewParas);
         }
         else
         {
             fdoPara = fdoStText[i];
             if (fdoPara.Guid != lfPara.Guid)
             {
                 // A new para was inserted into LF at this point; duplicate that in FDO
                 fdoPara = fdoStText.InsertNewTextPara(i, styleForNewParas);
             }
         }
         fdoPara.Contents = ConvertMongoToFdoTsStrings.SpanStrToTsString(lfPara.Contents, wsId, fdoStText.Cache.WritingSystemFactory);
     }
 }
开发者ID:ermshiperete,项目名称:LfMerge,代码行数:37,代码来源:ConvertUtilities.cs


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