Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
 protected virtual void Dispose(bool disposing)
 {
     System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
     if (disposing)
     {
         m_application?.Dispose();
         m_application = null;
         m_window?.Dispose();
         m_window = null;
         m_mediator?.Dispose();
         m_mediator = null;
         m_propertyTable?.Dispose();
         m_propertyTable = null;
     }
 }