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

C# IStText类代码示例

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

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



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


示例16: AddChartToLangProj

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds an empty chart on the specified text.
		/// </summary>
		/// <param name="name">Chart name.</param>
		/// <param name="stText">Chart is BasedOn this text.</param>
		/// ------------------------------------------------------------------------------------
		private IDsConstChart AddChartToLangProj(string name, IStText stText)
		{
			IFdoServiceLocator servloc = Cache.ServiceLocator;
			IDsConstChart chart = servloc.GetInstance<IDsConstChartFactory>().Create();
			if (Cache.LangProject.DiscourseDataOA == null)
				Cache.LangProject.DiscourseDataOA = servloc.GetInstance<IDsDiscourseDataFactory>().Create();

			Cache.LangProject.DiscourseDataOA.ChartsOC.Add(chart);

			// Setup the new chart
			chart.Name.AnalysisDefaultWritingSystem = TsStringUtils.MakeTss(name, Cache.DefaultAnalWs);
			chart.BasedOnRA = stText;

			return chart; // This chart has no template or rows, so far!!
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:22,代码来源:StTextTests.cs


示例17: TextPosition

		/// <summary>
		/// Return an index we can use to order StTexts in Scripture.
		/// Take the book index * 10,000.
		/// if not in the title, add (section index + 1)*2.
		/// If in contents add 1.
		/// </summary>
		/// <param name="hvoText"></param>
		/// <returns></returns>
		int TextPosition(IStText text)
		{
			ICmObject owner = text.Owner;
			int flid = text.OwningFlid;
			if (flid != ScrSectionTags.kflidContent &&
				flid != ScrSectionTags.kflidHeading
				&& flid != ScrBookTags.kflidTitle)
			{
				return -1;
			}
			if (flid == ScrBookTags.kflidTitle)
				return BookPosition((IScrBook)owner);
			var section = (IScrSection)owner;
			var book = (IScrBook)section.Owner;
			return BookPosition(book)
				   + section.IndexInOwner * 2 + 2
				   + (flid == ScrSectionTags.kflidContent ? 1 : 0);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:26,代码来源:InterestingTextList.cs


示例18: AddAfter

		private int AddAfter(int indexAfter, IStText item)
		{
			if (item == null)
				return indexAfter; // nothing to add
			if (indexAfter >= m_scriptureTexts.Count - 1 || m_scriptureTexts[indexAfter] != item)
			{
				// Not already present, add it.
				m_scriptureTexts.Insert(indexAfter, item);
			}
			return indexAfter + 1; // in either case next text goes after this one.
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:11,代码来源:InterestingTextList.cs


示例19: AddBefore

		private int AddBefore(int index, IStText item)
		{
			if (item == null)
				return index; // nothing to add
			if (index == 0 || m_scriptureTexts[index - 1] != item)
			{
				// Not present, add it.
				m_scriptureTexts.Insert(index, item);
				return index; // no change, things moved up.
			}
			return index - 1; // next earlier item goes before one already present.
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:12,代码来源:InterestingTextList.cs


示例20: AddChapterToInterestingTexts

		/// <summary>
		/// This is invoked when TE (or some other program) invokes a link, typically to a Scripture Section text not in our filter.
		/// If possible, add it to the filter and return true. Also add any other sections in the same chapter.
		/// Also when jumping from Notebook to a text that is excluded.
		/// Todo JohnT: get it called from TE and test it; not currently used by TE (ported from parts of old InterlinearTextsVirtualHandler)
		/// </summary>
		public bool AddChapterToInterestingTexts(IStText newText)
		{
			int oldCount = m_scriptureTexts.Count;
			int targetPosition = TextPosition(newText);
			if (targetPosition < 0)
			{
				var excludedCoreTextIdList = ExcludedCoreTextIdList();
				if (newText.Owner is IText && excludedCoreTextIdList.Contains(newText.Guid))
				{
					CoreTexts.Add(newText);
					if (m_interestingTests != null)
						m_interestingTests.Add(newText);
					excludedCoreTextIdList.Remove(newText.Guid);
					UpdateExcludedCoreTexts(excludedCoreTextIdList);
					RaiseInterestingTextsChanged(CoreTexts.Count - 1, 1, 0);
					return true; // added sucessfully
				}
				return false; // not a text in current Scripture.
			}
			int index;
			for (index = 0; index < m_scriptureTexts.Count; index++)
			{
				if (TextPosition(m_scriptureTexts[index]) > targetPosition)
				{
					break;
				}
			}
			m_scriptureTexts.Insert(index, newText);
			// Also insert the other text in the same section
			var sec = newText.Owner as IScrSection;
			if (sec != null) // not a book title
			{
				if (newText == sec.ContentOA && sec.HeadingOA != null)
				{
					if (index == 0 || m_scriptureTexts[index - 1] != sec.HeadingOA)
						m_scriptureTexts.Insert(index, sec.HeadingOA);
					else
						index--; // move index to point at heading
				}
				else if (sec.ContentOA != null)
				{
					if (index >= m_scriptureTexts.Count - 1 || m_scriptureTexts[index + 1] != sec.ContentOA)
						m_scriptureTexts.Insert(index + 1, sec.ContentOA);
				}
				// At this point the heading and contents of the section for the inserted text
				// are at index. We look for adjacent sections in the same chapter and if necessary
				// add them too.
				int indexAfter = index + 1;
				if (sec.ContentOA != null && sec.HeadingOA != null)
					indexAfter++;
				// It would be nicer to use ScrReference, but not worth adding a whole project reference.
				int chapMax = sec.VerseRefMax / 1000;
				int chapMin = sec.VerseRefMin / 1000;
				var book = (IScrBook)sec.Owner;
				int csec = book.SectionsOS.Count;
				int isecCur = sec.IndexInOwner;
				for (int isec = isecCur + 1; isec < csec; isec++)
				{
					IScrSection secNext = book.SectionsOS[isec];
					if (secNext.VerseRefMin / 1000 != chapMax)
						break; // different chapter.
					indexAfter = AddAfter(indexAfter, secNext.HeadingOA);
					indexAfter = AddAfter(indexAfter, secNext.ContentOA);
				}
				for (int isec = isecCur - 1; isec >= 0; isec--)
				{
					IScrSection secPrev = book.SectionsOS[isec];
					if (secPrev.VerseRefMax / 1000 != chapMin)
						break;
					index = AddBefore(index, secPrev.ContentOA);
					index = AddBefore(index, secPrev.HeadingOA);
				}
			}
			// We could get fancy and try to figure the exact range that changed, but this is close enough.
			RaiseInterestingTextsChanged(CoreTexts.Count, m_scriptureTexts.Count, oldCount);
			return true;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:83,代码来源:InterestingTextList.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IStTxtPara类代码示例发布时间:2022-05-24
下一篇:
C# ISqlObject类代码示例发布时间: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