Navigation:  Application Architecture > Putting it All Together > Designing for Configurability >

Adding the options page

Previous pageReturn to chapter overviewNext page

At this point, we have all we need to launch the configuration component as a separate dialog box.  However, we would ideally like to add the configuration component to the Options dialog accessed from the Tools menu, along with all the other user options.  To do so, we need to create an extension of ConfigurationPageProviderExtensionPoint that, as the name would suggest, provides configuration pages.

using System;

using System.Collections.Generic;

using ClearCanvas.Common;

using ClearCanvas.Desktop.Configuration;

 

namespace MyPlugin.TextEditor

{

   [ExtensionOf(typeof (ConfigurationPageProviderExtensionPoint))]

   public class ConfigPageProvider : IConfigurationPageProvider

   {

      public IEnumerable<IConfigurationPage> GetPages()

      {

         throw new Exception("The method or operation is not implemented.");

      }

   }

}

 

The extension only has one method that returns the configuration pages to the Options dialog.  The standard ConfigurationPage<T> class provides an easy way to instantiate the configuration component we created earlier, so we just return an enumerable object comprised of these.

using System.Collections.Generic;

using ClearCanvas.Common;

using ClearCanvas.Desktop.Configuration;

 

namespace MyPlugin.TextEditor

{

   [ExtensionOf(typeof (ConfigurationPageProviderExtensionPoint))]

   public class ConfigPageProvider : IConfigurationPageProvider

   {

      public IEnumerable<IConfigurationPage> GetPages()

      {

         List<IConfigurationPage> list = new List<IConfigurationPage>();

         list.Add(new ConfigurationPage<TextEditorConfigComponent>("TextEditor"));

         return list.AsReadOnly();

      }

   }

}

 

Now, if we go to the Options dialog, there is a new page for Text Editor settings.