示例#1
0
        private void Initialize()
        {
            tracer.Trace("Initializing...", "VsProjectScope");
            try
            {
                specFlowProjectConfiguration = LoadConfiguration();
                gherkinDialectServices       = new GherkinDialectServices(specFlowProjectConfiguration.GeneratorConfiguration.FeatureLanguage);

                appConfigTracker                 = new VsProjectFileTracker(project, "App.config", dteWithEvents, tracer);
                appConfigTracker.FileChanged    += AppConfigTrackerOnFileChanged;
                appConfigTracker.FileOutOfScope += AppConfigTrackerOnFileOutOfScope;

                var enableAnalysis = integrationOptionsProvider.GetOptions().EnableAnalysis;
                if (enableAnalysis)
                {
                    featureFilesTracker        = new ProjectFeatureFilesTracker(this);
                    featureFilesTracker.Ready += FeatureFilesTrackerOnReady;

                    bindingFilesTracker = new BindingFilesTracker(this);

                    stepSuggestionProvider        = new VsStepSuggestionProvider(this);
                    stepSuggestionProvider.Ready += StepSuggestionProviderOnReady;
                    stepDefinitionMatchService    = new StepDefinitionMatchServiceWithOnlySimpleTypeConverter(stepSuggestionProvider);
                }
                tracer.Trace("Initialized", "VsProjectScope");
                initialized = true;

                if (enableAnalysis)
                {
                    tracer.Trace("Starting analysis services...", "VsProjectScope");

                    stepSuggestionProvider.Initialize();
                    bindingFilesTracker.Initialize();
                    featureFilesTracker.Initialize();

                    LoadStepMap();

                    bindingFilesTracker.Run();
                    featureFilesTracker.Run();

                    dteWithEvents.OnBuildDone += BuildEventsOnOnBuildDone;

                    tracer.Trace("Analysis services started", "VsProjectScope");
                }
                else
                {
                    tracer.Trace("Analysis services disabled", "VsProjectScope");
                }
            }
            catch (Exception exception)
            {
                tracer.Trace("Exception: " + exception, "VsProjectScope");
            }
        }
        private void Initialize()
        {
            _tracer.Trace("Initializing...", VsProjectScopeTraceCategory);
            try
            {
                _specFlowConfiguration  = LoadSpecFlowConfiguration();
                _gherkinDialectServices = new GherkinDialectServices(_specFlowConfiguration.FeatureLanguage);

                InitializeConfigTrackers();

                bool enableAnalysis = _integrationOptionsProvider.GetOptions().EnableAnalysis;
                if (enableAnalysis)
                {
                    _featureFilesTracker        = new ProjectFeatureFilesTracker(this);
                    _featureFilesTracker.Ready += FeatureFilesTrackerOnReady;

                    _bindingFilesTracker = new BindingFilesTracker(this);

                    _stepSuggestionProvider        = new VsStepSuggestionProvider(this);
                    _stepSuggestionProvider.Ready += StepSuggestionProviderOnReady;
                    _stepDefinitionMatchService    = new StepDefinitionMatchServiceWithOnlySimpleTypeConverter(_stepSuggestionProvider);
                }
                _tracer.Trace("Initialized", VsProjectScopeTraceCategory);
                _initialized = true;

                if (enableAnalysis)
                {
                    _tracer.Trace("Starting analysis services...", VsProjectScopeTraceCategory);

                    _stepSuggestionProvider.Initialize();
                    _bindingFilesTracker.Initialize();
                    _featureFilesTracker.Initialize();

                    LoadStepMap();

                    _bindingFilesTracker.Run();
                    _featureFilesTracker.Run();

                    _dteWithEvents.OnBuildDone += BuildEventsOnOnBuildDone;

                    _tracer.Trace("Analysis services started", VsProjectScopeTraceCategory);
                }
                else
                {
                    _tracer.Trace("Analysis services disabled", VsProjectScopeTraceCategory);
                }
            }
            catch (Exception exception)
            {
                _tracer.Trace("Exception: " + exception, VsProjectScopeTraceCategory);
            }
        }