using System;
using System.Xml.XPath;
using BDK;
using update.Crm.BusinessObjects;
using update.Crm.Collections;
using update.Crm.Contracts;
using update.Crm.Contracts.Data;
using update.Crm.Contracts.Events;
using update.Crm.Contracts.Views;
using update.Crm.Data;
using update.Crm.Schema;
using update.Lib.Contracts.Events;
using update.Lib.Contracts.Hosting;
using update.Lib.Contracts.Services;
using update.Lib.Extensions;
using update.Lib.Logging;
using update.Web.Base.Extensions;
using update.Lib.Contracts;
using update.Configuration.Contracts;


namespace BDK.Template
{
    public class PlugIn : IPlugIn, IDisposable
    {
        public static IServiceContainer _services;

        #region Implementation of IDisposable
        public void Dispose()
        {
            //BuiltInEventHandlers.StopObserving()
            GC.SuppressFinalize(this);
        }
        #endregion

        #region Implementation of IPlugIn
        public void Init(IServiceContainer services, XPathNavigator settingsNavigator)
        {
            _services = services;
            IServiceFactory factory = _services.Get<IServiceFactory>();
            //Neu 01.02.14
            var assembly = this.GetType().Assembly;
            factory.Register(assembly);
            factory.RegisterChannels(assembly);

            //factory.RegisterChannel(typeof(SMC.Template.Channels.SMCChannel), "SMC.Template.Channels.SMCChannel");

            //BuiltInEventHandlers.StartObserving(services);
        }

        public void Load()
        {
            // do nothing
        }
        #endregion
    }
}