void IInitializable.Initialize() { m_commandService.RegisterCommand( ExprCommands.Expression, StandardMenu.Edit, StandardCommandGroup.EditOther, "Expression".Localize(), "Create and edit expressions".Localize(), Keys.None, null, CommandVisibility.All, this); m_documentRegistry.DocumentAdded += (sender, e) => { ExpressionManager em = e.Item.As <ExpressionManager>(); if (em != null) { em.SetPythonScriptService(m_scriptingService); } }; // run expressions if needed. Application.Idle += (sender, e) => { if (m_documentRegistry == null) { return; } foreach (var doc in m_documentRegistry.Documents) { ExpressionManager em = doc.As <ExpressionManager>(); if (em != null) { em.Update(); } } }; }