SIL.Utils.ActivationContextHelper.Activate C# (CSharp) Метод

Activate() публичный Метод

Activates this instance.
Error activating context
public Activate ( ) : IDisposable
Результат IDisposable
		public IDisposable Activate()
		{
			IntPtr cookie = IntPtr.Zero;
#if !__MonoCS__
			if (!ActivateActCtx(m_activationContext, out cookie))
				throw new Win32Exception(Marshal.GetLastWin32Error(), "Error activating context");
#endif
			return new Activation(cookie);
		}

Usage Example

Пример #1
0
		public void SetUp()
		{
			m_activationContext = new ActivationContextHelper("FwParatextLexiconPlugin.dll.manifest");
			using (m_activationContext.Activate())
			{
				m_threadHelper = new ThreadHelper();
				var ui = new DummyFdoUI(m_threadHelper);
				var projectId = new ParatextLexiconPluginProjectID(FDOBackendProviderType.kMemoryOnly, "Test.fwdata");
				m_cache = FdoCache.CreateCacheWithNewBlankLangProj(projectId, "en", "fr", "en", ui, ParatextLexiconPluginDirectoryFinder.FdoDirectories, new FdoSettings());
				NonUndoableUnitOfWorkHelper.Do(m_cache.ActionHandlerAccessor, () =>
					{
						m_cache.ServiceLocator.WritingSystems.AddToCurrentAnalysisWritingSystems(m_cache.ServiceLocator.WritingSystemManager.Get("fr"));
						m_cache.LangProject.MorphologicalDataOA.ParserParameters = "<ParserParameters><XAmple><MaxNulls>1</MaxNulls><MaxPrefixes>5</MaxPrefixes><MaxInfixes>1</MaxInfixes><MaxSuffixes>5</MaxSuffixes><MaxInterfixes>0</MaxInterfixes><MaxAnalysesToReturn>10</MaxAnalysesToReturn></XAmple><ActiveParser>XAmple</ActiveParser></ParserParameters>";
					});
			}
			m_lexicon = new FdoLexicon("Test", "FieldWorks:Test", m_cache, m_cache.DefaultVernWs, m_activationContext);
		}
All Usage Examples Of SIL.Utils.ActivationContextHelper::Activate