SIL.FieldWorks.FwCoreDlgs.CharContextCtrl.Initialize C# (CSharp) Method

Initialize() public method

Initializes this CharContextCtrl
public Initialize ( SIL.FieldWorks.FDO.FdoCache cache, IWritingSystemContainer wsContainer, IWritingSystem ws, IApp app, Font contextFont, System.Windows.Forms.DataGridView tokenGrid ) : void
cache SIL.FieldWorks.FDO.FdoCache The cache.
wsContainer IWritingSystemContainer The writing system container.
ws IWritingSystem The language definition.
app IApp The application.
contextFont System.Drawing.Font The context font.
tokenGrid System.Windows.Forms.DataGridView The token grid.
return void
		public void Initialize(FdoCache cache, IWritingSystemContainer wsContainer,
			IWritingSystem ws, IApp app, Font contextFont, DataGridView tokenGrid)
		{
			m_cache = cache;
			m_wsContainer = wsContainer;
			m_ws = ws;
			m_app = app;
			ContextFont = contextFont;
			TokenGrid = tokenGrid;

			if (FwUtils.IsOkToDisplayScriptureIfPresent)
				m_scrChecksDllFile = FwDirectoryFinder.BasicEditorialChecksDll;

			if (m_ws != null)
			{
				bool modifyingVernWs = (m_wsContainer.DefaultVernacularWritingSystem != null &&
					m_ws.Id == m_wsContainer.DefaultVernacularWritingSystem.Id);

				// If TE isn't installed, we can't support creating an inventory
				// based on Scripture data. Likewise if we don't yet have any books (which also guards
				// against showing the option in the SE edition, unless it has been paired with Paratext).
				cmnuScanScripture.Visible = (FwUtils.IsOkToDisplayScriptureIfPresent &&
					File.Exists(m_scrChecksDllFile) &&
					m_cache != null && m_cache.LanguageProject.TranslatedScriptureOA != null
					&& m_cache.LanguageProject.TranslatedScriptureOA.ScriptureBooksOS.Count > 0
					&& modifyingVernWs);

				if (m_ws.RightToLeftScript)
				{
					// Set the order of the columns for right-to-left text.
					colContextAfter.DisplayIndex = colContextBefore.DisplayIndex;
					colContextBefore.DisplayIndex = gridContext.ColumnCount - 1;
				}
			}
		}

Usage Example

Ejemplo n.º 1
0
        public void GetTokenSubstrings_ValidatorThatRemovesSomeResults()
        {
            using (var ctrl = new CharContextCtrl())
            {
                ctrl.Initialize(Cache, Cache.ServiceLocator.WritingSystems,
                                null, null, null, null);
                ctrl.ListValidator = RemoveFirstAndLastSubString;

                var        tokens = new List <ITextToken>();
                ITextToken token  = new ScrCheckingToken();
                ReflectionHelper.SetField(token, "m_sText", "Mom. Dad! Brother(Sister)");
                tokens.Add(token);
                var inventory = new DummyScrInventory
                {
                    m_references = new List <TextTokenSubstring>
                    {
                        new TextTokenSubstring(token, 3, 2),
                        new TextTokenSubstring(token, 8, 2),
                        new TextTokenSubstring(token, 17, 1),
                        new TextTokenSubstring(token, 24, 1)
                    }
                };
                var validatedList =
                    (List <TextTokenSubstring>)ReflectionHelper.GetResult(ctrl, "GetTokenSubstrings",
                                                                          inventory, tokens);
                Assert.AreEqual(2, validatedList.Count);
                Assert.AreEqual("! ", validatedList[0].Text);
                Assert.AreEqual("(", validatedList[1].Text);
            }
        }
All Usage Examples Of SIL.FieldWorks.FwCoreDlgs.CharContextCtrl::Initialize