From 051a19fa5c78aab7564b3ed76c1edc18ac48164b Mon Sep 17 00:00:00 2001 From: alcexhim Date: Tue, 24 Jun 2014 09:59:00 -0400 Subject: [PATCH] Allow engines to hook in before and after initialization occurs, and use command ID if title is blank as caption for command item --- .../UniversalEditor.UserInterface/Engine.cs | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/CSharp/Libraries/UniversalEditor.UserInterface/Engine.cs b/CSharp/Libraries/UniversalEditor.UserInterface/Engine.cs index c2e4286e..96c6e7d4 100644 --- a/CSharp/Libraries/UniversalEditor.UserInterface/Engine.cs +++ b/CSharp/Libraries/UniversalEditor.UserInterface/Engine.cs @@ -61,6 +61,13 @@ namespace UniversalEditor.UserInterface return m_AvailableEngines; } + protected virtual void BeforeInitialization() + { + } + protected virtual void AfterInitialization() + { + } + public static bool Execute() { Engine[] engines = GetAvailableEngines(); @@ -182,10 +189,14 @@ namespace UniversalEditor.UserInterface cmd.ID = attID.Value; MarkupAttribute attTitle = tagCommand.Attributes["Title"]; - if (attTitle != null) - { - cmd.Title = attTitle.Value; - } + if (attTitle != null) + { + cmd.Title = attTitle.Value; + } + else + { + cmd.Title = cmd.ID; + } MarkupTagElement tagItems = (tagCommand.Elements["Items"] as MarkupTagElement); if (tagItems != null) @@ -283,7 +294,9 @@ namespace UniversalEditor.UserInterface // Set up the base path for the current application. Should this be able to be // overridden with a switch (/basepath:...) ? mvarBasePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); - + + BeforeInitialization(); + // Initialize the XML files InitializeXMLConfiguration(); @@ -310,6 +323,8 @@ namespace UniversalEditor.UserInterface } if (!SingleInstanceManager.CreateSingleInstance(INSTANCEID, new EventHandler(SingleInstanceManager_Callback))) return; + AfterInitialization(); + MainLoop(); } }