using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Composite.UnityExtensions;
using System.Windows;
using Microsoft.Practices.Composite.Modularity;
using System.IO;
using StatusBar;
using DevToolManager.CodeModel;
using System.Diagnostics;
using Microsoft.Practices.Unity;

namespace DevToolManager
{
    public class Bootstrapper : UnityBootstrapper
    {
        protected override DependencyObject CreateShell()
        {
            IShell shell = Container.Resolve<IShell>();
            shell.Show();

            return shell as DependencyObject;
        }

        protected override void ConfigureContainer()
        {
            base.ConfigureContainer();
            Container.RegisterType<IShell, Shell>(new ContainerControlledLifetimeManager());
        }

        protected override Microsoft.Practices.Composite.Modularity.IModuleCatalog GetModuleCatalog()
        {
            string modulePath = @".\Modules";
            if (Directory.Exists(modulePath) == false)
            {
                Directory.CreateDirectory(modulePath);
            }

            DirectoryModuleCatalog catalog = new DirectoryModuleCatalog() { ModulePath = modulePath };
            catalog.AddModule(typeof(StatusBarModule));
            return catalog;
        }
    }
}
