using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

#region 추가 레퍼런스
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Prism.MefExtensions;
using System.ComponentModel.Composition.Hosting;
using MarkOn.Infrastructure;
using MarkOn_Content;
using MarkOn_Menu;
using MarkOn_Search;
using MarkOn_Favorite;
using SimpleMefApplication.Infrastructure;
#endregion

namespace MarkOn
{
	public class MefApplicationBootstrapper : MefBootstrapper
	{
		protected override DependencyObject CreateShell()
		{
			return this.Container.GetExportedValue<Shell>();
		}

		protected override void InitializeShell()
		{
			base.InitializeShell();
			Application.Current.RootVisual = (UIElement)Shell;
		}


		protected override IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
		{
			var factory = base.ConfigureDefaultRegionBehaviors();
			factory.AddIfMissing("AutoPopulateExportedViewsBehavior", typeof(AutoPopulateExportedViewsBehavior));
			return factory;
		}


		protected override void ConfigureAggregateCatalog()
		{
			base.ConfigureAggregateCatalog();
			this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(ViewExportAttribute).Assembly));
			this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(MefApplicationBootstrapper).Assembly));
			this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(ContentModule).Assembly));
			this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(MenuModule).Assembly));
			this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(SearchModule).Assembly));
			this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(FavoriteModule).Assembly));
		}
	}
}
