protected override void Initialize()
        {
            base.Initialize();

            var componentModel = (IComponentModel)GetService(typeof(SComponentModel));

            _assemblyResolver  = componentModel.GetService <IRazorEngineAssemblyResolver>();
            _documentGenerator = componentModel.GetService <IRazorEngineDocumentGenerator>();
            _directiveResolver = componentModel.GetService <IRazorEngineDirectiveResolver>();
            _tagHelperResolver = componentModel.GetService <ITagHelperResolver>();

            _workspace = componentModel.GetService <VisualStudioWorkspace>();
            _workspace.WorkspaceChanged += Workspace_WorkspaceChanged;

            Reset(_workspace.CurrentSolution);
        }
예제 #2
0
        public RazorInfoViewModel(
            IServiceProvider services,
            Workspace workspace,
            IRazorEngineAssemblyResolver assemblyResolver,
            IRazorEngineDirectiveResolver directiveResolver,
            ITagHelperResolver tagHelperResolver,
            IRazorEngineDocumentGenerator documentGenerator,
            Action <Exception> errorHandler)
        {
            _services          = services;
            _workspace         = workspace;
            _assemblyResolver  = assemblyResolver;
            _directiveResolver = directiveResolver;
            _tagHelperResolver = tagHelperResolver;
            _documentGenerator = documentGenerator;
            _errorHandler      = errorHandler;

            GenerateCommand = new RelayCommand <object>(ExecuteGenerate, CanExecuteGenerate);
            LoadCommand     = new RelayCommand <object>(ExecuteLoad, CanExecuteLoad);
        }