SIL.FieldWorks.FwCoreDlgs.ReplaceAllCollectorEnv.ReplaceAll C# (CSharp) Method

ReplaceAll() public method

Replaces all.
public ReplaceAll ( ) : int
return int
		public virtual int ReplaceAll()
		{
			m_fEmptySearch = (m_Pattern.Pattern.Length == 0);
			m_vc.Display(this, m_hvoCurr, m_frag);
			return m_cReplace;
		}

Usage Example

        public void ReplaceAllWithMultipleRuns()
        {
            ITsStrBldr stringBuilder = TsStrBldrClass.Create();

            stringBuilder.Replace(0, 0, "blaBLA", null);
            stringBuilder.SetIntPropValues(0, 6, (int)FwTextPropType.ktptWs, 0, Cache.DefaultVernWs);
            stringBuilder.SetStrPropValue(0, 3, (int)FwTextPropType.ktptNamedStyle, "CStyle3");
            m_pattern.ReplaceWith = stringBuilder.GetString();

            ReplaceAllCollectorEnv collectorEnv = new ReplaceAllCollectorEnv(m_vc,
                                                                             Cache.MainCacheAccessor, m_para1.Owner.Hvo, (int)StTextFrags.kfrText,
                                                                             m_pattern, null);
            int nReplaces = collectorEnv.ReplaceAll();

            Assert.AreEqual(8, nReplaces);
            Assert.AreEqual("This is some text so thblaBLAt we cblaBLAn test the find functionblaBLAlity.",
                            m_para1.Contents.Text);
            Assert.AreEqual("Some more text so thblaBLAt we cblaBLAn test the find blaBLAnd replblaBLAce functionblaBLAlity.",
                            m_para2.Contents.Text);
            Assert.AreEqual("This purugruph doesn't contuin the first letter of the ulphubet.",
                            m_para3.Contents.Text);
            ITsString para1Contents = m_para1.Contents;

            Assert.AreEqual(7, para1Contents.RunCount);
            Assert.AreEqual("bla", para1Contents.get_RunText(1));
            Assert.AreEqual("CStyle3", para1Contents.get_Properties(1).GetStrPropValue(
                                (int)FwTextPropType.ktptNamedStyle));
        }
All Usage Examples Of SIL.FieldWorks.FwCoreDlgs.ReplaceAllCollectorEnv::ReplaceAll