Exemple #1
0
        private void WireUpEvents()
        {
            _dteEvents = Dte.Events;

            _solutionEvents = _dteEvents.SolutionEvents;
            _solutionEvents.ProjectAdded   += project => _templateController.ResetTemplates();
            _solutionEvents.ProjectRemoved += project => _templateController.ResetTemplates();
            _solutionEvents.ProjectRenamed += (project, oldName) => _templateController.ResetTemplates();

            _solutionMonitor.AdviseTrackProjectDocumentsEvents();
            _solutionMonitor.TemplateAdded   += (sender, args) => _templateController.ResetTemplates();
            _solutionMonitor.TemplateDeleted += (sender, args) => _templateController.ResetTemplates();
            _solutionMonitor.TemplateRenamed += (sender, args) => _templateController.ResetTemplates();

            _solutionMonitor.CsFileAdded   += (sender, args) => _generationController.OnCsFileChanged(args.Paths);
            _solutionMonitor.CsFileDeleted += (sender, args) => _generationController.OnCsFileDeleted(args.Paths);
            _solutionMonitor.CsFileRenamed += (sender, args) => _generationController.OnCsFileRenamed(args.Paths, args.OldPaths);

            _documentEvents = _dteEvents.DocumentEvents;
            _documentEvents.DocumentSaved += document =>
            {
                if (document.FullName.EndsWith(Constants.CsExtension, StringComparison.InvariantCultureIgnoreCase))
                {
                    _generationController.OnCsFileChanged(new[] { document.FullName });
                }
                else if (document.FullName.EndsWith(Constants.TemplateExtension, StringComparison.InvariantCultureIgnoreCase))
                {
                    _generationController.OnTemplateChanged(document.FullName);
                }
            };

            RenderTemplate.Instance.RenderTemplateClicked += (sender, args) => _generationController.OnTemplateChanged(args.Path, true);
        }
Exemple #2
0
        private void WireupEvents()
        {
            solutionMonitor.ProjectAdded   += (sender, args) => templateController.ResetTemplates();
            solutionMonitor.ProjectRemoved += (sender, args) => templateController.ResetTemplates();

            solutionMonitor.TemplateAdded   += (sender, args) => templateController.ResetTemplates();
            solutionMonitor.TemplateDeleted += (sender, args) => templateController.ResetTemplates();
            solutionMonitor.TemplateRenamed += (sender, args) => templateController.ResetTemplates();
            solutionMonitor.TemplateChanged += (sender, args) => generationController.OnTemplateChanged(args.Path);


            solutionMonitor.CsFileAdded   += (sender, args) => generationController.OnCsFileChanged(args.Paths);
            solutionMonitor.CsFileChanged += (sender, args) => generationController.OnCsFileChanged(args.Paths);

            solutionMonitor.CsFileDeleted += (sender, args) => generationController.OnCsFileDeleted(args.Paths);


            solutionMonitor.CsFileRenamed += (sender, args) => generationController.OnCsFileRenamed(args.Paths, args.OldPaths);

            RenderTemplate.Instance.RenderTemplateClicked += (sender, args) => generationController.OnTemplateChanged(args.Path, true);
        }