namespace SMFD_Paragon_DisallowRussianChars
{
    #region Using
    using System;
    using System.Linq;

    using Aveva.ApplicationFramework;
    using Aveva.ApplicationFramework.Presentation;
    using Aveva.Pdms.Database;
    using Aveva.Pdms.Geometry;
    using Aveva.Pdms.Shared;
    #endregion

    public class Main : IAddin
    {
        public void Start(ServiceManager servMan)
        {
            if (servMan.ApplicationName == "Paragon") // подписываемся
                CurrentElement.CurrentElementChanged += CurrentElement_CurrentElementChanged;
        }

        public void Stop()
        {
            if (ServiceManager.Instance.ApplicationName == "Paragon") // отписываемся
                CurrentElement.CurrentElementChanged -= CurrentElement_CurrentElementChanged;
        }

        public string Description { get { return "Сервис запрещающий русские символы в именах элементов в модуле Paragon"; } }

        public string Name { get { return "SMFD.Paragon.DisallowRussianChars addin"; } }

        private void CurrentElement_CurrentElementChanged(object sender, CurrentElementChangedEventArgs e)
        {
 	        RussianCharsService.Instance.Elem = e.Element;
        }
    }
}
