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


C# IStText类代码示例

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


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

示例1: FilterTextsDialogTE

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the ChooseScriptureDialog class.
		/// WARNING: this constructor is called by reflection, at least in the Interlinear
		/// Text DLL. If you change its parameters be SURE to find and fix those callers also.
		/// </summary>
		/// <param name="cache">The cache.</param>
		/// <param name="objList">A list of texts and books to check as an array of hvos</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// <param name="importer">The Paratext book importer.</param>
		/// ------------------------------------------------------------------------------------
		public FilterTextsDialogTE(FdoCache cache, IStText[] objList,
			IHelpTopicProvider helpTopicProvider, IBookImporter importer)
			: base(cache, objList, helpTopicProvider)
		{
			m_bookImporter = importer;
			using (var progressDlg = new ProgressDialogWithTask(this))
			{
				// This somewhat duplicates some logic in FieldWorks.GetHelpTopicProvider, but it feels
				// wrong to reference the main exe even though I can't find an actual circular dependency.
				// As far as I can discover, the help topic provider is only used if the user has modified
				// TE styles and TE needs to display a dialog about it (possibly because it has loaded a
				// new version of the standard ones?). Anyway, I don't think it will be used at all if TE
				// is not installed, so it should be safe to use the regular FLEx one.
				IHelpTopicProvider helpProvider;
				if (FwUtils.FwUtils.IsTEInstalled)
				{
					helpProvider = (IHelpTopicProvider) DynamicLoader.CreateObject(FwDirectoryFinder.TeDll,
						"SIL.FieldWorks.TE.TeHelpTopicProvider");
				}
				else
				{
					helpProvider = (IHelpTopicProvider)DynamicLoader.CreateObject(FwDirectoryFinder.FlexDll,
						"SIL.FieldWorks.XWorks.LexText.FlexHelpTopicProvider");
				}
				NonUndoableUnitOfWorkHelper.Do(cache.ActionHandlerAccessor, () =>
				TeScrInitializer.EnsureMinimalScriptureInitialization(cache, progressDlg,
					helpProvider));
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:40,代码来源:FilterTextsDialogTE.cs

示例2: CreateTestData

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create minimal test data required for every test.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void CreateTestData()
		{
			base.CreateTestData();
			m_helper = new DiscourseTestHelper(Cache);
			m_firstPara = m_helper.FirstPara;
			m_stText = m_firstPara.Owner as IStText;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:12,代码来源:InMemoryDiscourseTestBase.cs

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

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

示例5: MoveTextContents

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Use this method to move the entire contents of one StText to an adjacent one.
		/// </summary>
		/// <param name="fromText">StText from which the contents is moved</param>
		/// <param name="toText">StText to which the contents is moved. This StText should be
		/// empty.</param>
		/// <param name="toIsPreceding">Should equal true if the toText preceeds the fromText.
		/// If true, the moved paragraphs will be appended to the toText.
		/// If false, they will be placed at the beginning of the toText.</param>
		/// ------------------------------------------------------------------------------------
		public static void MoveTextContents(IStText fromText, IStText toText, bool toIsPreceding)
		{
			int iLastFromPara = fromText.ParagraphsOS.Count -1;

			if(toIsPreceding)
				MoveWholeParas(fromText, 0, iLastFromPara, toText, toText.ParagraphsOS.Count);
			else
				MoveWholeParas(fromText, 0, iLastFromPara, toText, 0);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:20,代码来源:StText.cs

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

示例7: FixtureSetupInternal

		private void FixtureSetupInternal()
		{
			//IWritingSystem wsEn = Cache.WritingSystemFactory.get_Engine("en");
			// Setup default analysis ws
			//m_wsEn = Cache.ServiceLocator.GetInstance<ILgWritingSystemRepository>().GetObject(wsEn.WritingSystem);
			m_wsVern = Cache.DefaultVernWs;

			m_text = Cache.ServiceLocator.GetInstance<ITextFactory>().Create();
			//Cache.LangProject.TextsOC.Add(m_text);
			m_stText = Cache.ServiceLocator.GetInstance<IStTextFactory>().Create();
			m_text.ContentsOA = m_stText;
			m_para = Cache.ServiceLocator.GetInstance<IScrTxtParaFactory>().CreateWithStyle(m_stText, ScrStyleNames.NormalParagraph);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:13,代码来源:ScriptureSegmentLabelTests.cs

示例8: FwMultiParaTextBox

		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public FwMultiParaTextBox(IStText stText, IVwStylesheet styleSheet)
		{
			// Because a panel only allows single borders that are black, we'll
			// set it's border to none and manage the border ourselves.
			base.BorderStyle = BorderStyle.None;

			BorderStyle = (Application.RenderWithVisualStyles ?
				BorderStyle.FixedSingle : BorderStyle.Fixed3D);

			m_textBox = new InternalFwMultiParaTextBox(stText, styleSheet);
			m_textBox.Dock = DockStyle.Fill;
			Controls.Add(m_textBox);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:18,代码来源:FwMultiParaTextBox.cs

示例9: GetCustomStTextValuesAsLfMultiPara

        public static LfMultiParagraph GetCustomStTextValuesAsLfMultiPara(IStText obj, int flid,
			IWritingSystemManager wsManager, IFwMetaDataCache metaDataCacheAccessor, int fallbackWs)
        {
            if (obj == null || obj.ParagraphsOS == null || obj.ParagraphsOS.Count == 0) return null;
            var result = new LfMultiParagraph();
            result.Paragraphs = obj.ParagraphsOS.OfType<IStTxtPara>().Where(para => para.Contents != null).Select(para => FdoParaToLfPara(para, wsManager)).ToList();
            // StText objects in FDO have a single primary writing system, unlike MultiString or MultiUnicode objects
            int fieldWs = metaDataCacheAccessor.GetFieldWs(flid);
            string wsStr = wsManager.GetStrFromWs(fieldWs);
            if (wsStr == null) wsStr = wsManager.GetStrFromWs(fallbackWs);
            result.InputSystem = wsStr;
            return result;
        }
开发者ID:ermshiperete,项目名称:LfMerge,代码行数:13,代码来源:ConvertUtilities.cs

示例10: Show

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Shows the specified comment text for the specified cell in the tooltip.
		/// </summary>
		/// <param name="comment">The comment to display in the tooltip.</param>
		/// <param name="cell">The status cell whose comment is being displayed.</param>
		/// ------------------------------------------------------------------------------------
		public void Show(IStText comment, DataGridViewCell cell)
		{
			Debug.Assert(cell != null);
			Debug.Assert(cell.DataGridView != null);

			MakeTextBox(comment);

			Rectangle rcCell = cell.DataGridView.GetCellDisplayRectangle(
				cell.ColumnIndex, cell.RowIndex, true);

			// Subtract one from the bottom so the tooltip
			// covers the grey border between grid rows.
			Point pt = new Point(rcCell.Right - Width, rcCell.Bottom - 1);
			base.Show(cell.DataGridView, pt);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:22,代码来源:CommentToolTip.cs

示例11: CreateTestText

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates a text for testing.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void CreateTestText()
		{
			m_txt = m_servLoc.GetInstance<ITextFactory>().Create();
			//Cache.LangProject.TextsOC.Add(m_txt);
			m_stTxt = m_servLoc.GetInstance<IStTextFactory>().Create();
			m_txt.ContentsOA = m_stTxt;
			m_txtPara = m_txt.ContentsOA.AddNewTextPara(null);

			// 0         1         2         3         4
			// 0123456789012345678901234567890123456789012
			// This is a test string for CopyObject tests.

			int hvoVernWs = Cache.DefaultVernWs;
			m_txtPara.Contents = TsStringUtils.MakeTss("This is a test string for CopyObject tests.", hvoVernWs);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:20,代码来源:CopyObjectTests.cs

示例12: CreateTestText

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates a text for testing.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void CreateTestText()
		{
			m_txt = m_servLoc.GetInstance<ITextFactory>().Create();
			//Cache.LangProject.TextsOC.Add(m_txt);
			m_possTagList = Cache.LangProject.GetDefaultTextTagList();
			m_stTxt = m_servLoc.GetInstance<IStTextFactory>().Create();
			m_txt.ContentsOA = m_stTxt;
			m_txtPara = m_txt.ContentsOA.AddNewTextPara(null);

			// 0    1  2 3    4      5   6                        7    8
			// This is a test string for ReferenceAdjusterService tests.

			var hvoVernWs = Cache.DefaultVernWs;
			m_txtPara.Contents = TsStringUtils.MakeTss("This is a test string for ReferenceAdjusterService tests.", hvoVernWs);
			ParseText();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:21,代码来源:ReferenceAdjusterServiceTests.cs

示例13: MakeTextBox

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Makes the text box containing the specified text.
		/// </summary>
		/// <param name="text">The text.</param>
		/// ------------------------------------------------------------------------------------
		private void MakeTextBox(IStText text)
		{
			if (m_resolutionText != null)
			{
				Controls.Remove(m_resolutionText);
				m_resolutionText.Dispose();
			}

			Size = new Size(175, 1);
			m_resolutionText = new FwMultiParaTextBox(text, m_stylesheet);
			m_resolutionText.Dock = DockStyle.Fill;
			m_resolutionText.BackColor = SystemColors.Info;
			m_resolutionText.BorderStyle = BorderStyle.None;
			m_resolutionText.ReadOnly = true;
			m_resolutionText.AutoScroll = false;
			Controls.Add(m_resolutionText);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:23,代码来源:CommentToolTip.cs

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

示例15: CreateFootnote

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates a test footnote in the given location.
		/// </summary>
		/// <param name="book">The Scripture book.</param>
		/// <param name="text">The StText containing iPara.</param>
		/// <param name="iPara">The index of the Content paragraph where the footnote is to be
		/// inserted.</param>
		/// <param name="iFootnote">The index of the footnote to create.</param>
		/// <param name="ichOrc">The charaacter offset in the paragraph where the ORC (marker)
		/// is to be inserted.</param>
		/// <param name="sStyle">The style name (which determines whether it is a general
		/// footnote or a cross-reference).</param>
		/// <param name="fMakeOrphan">Flag indicating whether to make this footnote into an
		/// "orphan" by clearing the properties of the ORC.</param>
		/// ------------------------------------------------------------------------------------
		private IStFootnote CreateFootnote(IScrBook book, IStText text, int iPara, int iFootnote,
			int ichOrc, string sStyle, bool fMakeOrphan)
		{
			IScrTxtPara scrPara = (IScrTxtPara)text.ParagraphsOS[iPara];
			IStFootnote footnote = InsertTestFootnote(book, scrPara, iFootnote, ichOrc);
			IStTxtPara fnPara = AddParaToMockedText(footnote, sStyle);
			AddRunToMockedPara(fnPara, "Footnote " + Guid.NewGuid(), Cache.DefaultVernWs);

			if (fMakeOrphan)
			{
				ITsStrBldr bldr = scrPara.Contents.GetBldr();
				bldr.SetProperties(ichOrc, ichOrc + 1, TsStringUtils.PropsForWs(Cache.DefaultVernWs));
				scrPara.Contents = bldr.GetString();
			}
			return footnote;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:32,代码来源:TeScrInitializerTests.cs


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