コード例 #1
0
        public SwMacroFeatureDefinition()
        {
            string provider = "";

            this.GetType().TryGetAttribute <MissingDefinitionErrorMessage>(a =>
            {
                provider = a.Message;
            });

            m_Provider = provider;

            var svcColl = new ServiceCollection();

            svcColl.AddOrReplace <IXLogger>(() => new TraceLogger($"xCad.MacroFeature.{this.GetType().FullName}"));
            svcColl.AddOrReplace <IIconsCreator>(() => new BaseIconsCreator());

            ConfigureServices?.Invoke(this, svcColl);
            OnConfigureServices(svcColl);

            m_SvcProvider = svcColl.CreateProvider();

            m_Logger = m_SvcProvider.GetService <IXLogger>();

            CustomFeatureDefinitionInstanceCache.RegisterInstance(this);

            var iconsConv = m_SvcProvider.GetService <IIconsCreator>();

            iconsConv.KeepIcons   = true;
            iconsConv.IconsFolder = MacroFeatureIconInfo.GetLocation(this.GetType());
            TryCreateIcons(iconsConv);
        }
コード例 #2
0
        public SwMacroFeatureDefinition()
        {
            string provider = "";

            this.GetType().TryGetAttribute <MissingDefinitionErrorMessage>(a =>
            {
                provider = a.Message;
            });

            m_Provider = provider;

            var svcColl = new ServiceCollection();

            svcColl.AddOrReplace <IXLogger>(() => new TraceLogger($"xCad.MacroFeature.{this.GetType().FullName}"));

            ConfigureServices(svcColl);

            m_SvcProvider = svcColl.CreateProvider();

            m_Logger = m_SvcProvider.GetService <IXLogger>();

            CustomFeatureDefinitionInstanceCache.RegisterInstance(this);

            TryCreateIcons();
        }