Beispiel #1
0
 private void CaptureClickEventForSSISMenu()
 {
     foreach (Command cmd in this.ApplicationObject.Commands)
     {
         if (cmd.Name == "SSIS.PackageConfigurations")
         {
             this.cmdPackageConfigurations = this.ApplicationObject.Events.get_CommandEvents(cmd.Guid, cmd.ID);
             this.cmdPackageConfigurations.BeforeExecute += new _dispCommandEvents_BeforeExecuteEventHandler(cmdEvent_BeforeExecute);
             return;
         }
     }
 }
Beispiel #2
0
 private void CaptureClickEventForSSISMenu()
 {
     foreach (Command cmd in this.ApplicationObject.Commands)
     {
         if (cmd.Name == "SSIS.PackageConfigurations")
         {
             this.cmdPackageConfigurations = this.ApplicationObject.Events.get_CommandEvents(cmd.Guid, cmd.ID);
             this.cmdPackageConfigurations.BeforeExecute += new _dispCommandEvents_BeforeExecuteEventHandler(cmdEvent_BeforeExecute);
             return;
         }
     }
 }
        public VisualStudioHelper(CmdArgsPackage package)
        {
            this.package   = package;
            this.appObject = package.GetService <SDTE, EnvDTE.DTE>();

            // see: https://support.microsoft.com/en-us/kb/555430
            this.solutionEvents = this.appObject.Events.SolutionEvents;
            this.commandEvents  = this.appObject.Events.CommandEvents;

            this.solutionEvents.Opened         += SolutionEvents_Opened;
            this.solutionEvents.AfterClosing   += SolutionEvents_AfterClosing;
            this.solutionEvents.BeforeClosing  += SolutionEvents_BeforeClosing;
            this.solutionEvents.ProjectAdded   += SolutionEvents_ProjectAdded;
            this.solutionEvents.ProjectRemoved += SolutionEvents_ProjectRemoved;
            this.solutionEvents.ProjectRenamed += SolutionEvents_ProjectRenamed;
        }
        public VisualStudioHelper(CmdArgsPackage package)
        {
            this.package = package;
            this.appObject = package.GetService<SDTE, EnvDTE.DTE>();

            // see: https://support.microsoft.com/en-us/kb/555430
            this.solutionEvents = this.appObject.Events.SolutionEvents;
            this.commandEvents = this.appObject.Events.CommandEvents;

            this.solutionEvents.Opened += SolutionEvents_Opened;
            this.solutionEvents.AfterClosing += SolutionEvents_AfterClosing;
            this.solutionEvents.BeforeClosing += SolutionEvents_BeforeClosing;
            this.solutionEvents.ProjectAdded += SolutionEvents_ProjectAdded;
            this.solutionEvents.ProjectRemoved += SolutionEvents_ProjectRemoved;
            this.solutionEvents.ProjectRenamed += SolutionEvents_ProjectRenamed;
        }
Beispiel #5
0
        public void TransformAllT4Templates()
        {
            // At this point the generic .tt files have been renamed to Domain specific names and all the generic words
            // in the .tt files have been replaced with Domain specific words. Now run the Transform on all the
            // .tt files to generate Domain specific code.
            MessageService.WriteMessage(string.Empty);
            MessageService.WriteMessage("==================================================================================================");
            MessageService.WriteMessage("Transforming templates....Generating Target Code....Please be patient....Takes about 30 seconds...");
            MessageService.WriteMessage("==================================================================================================");
            Application.DoEvents();

            try {
                OpenSolution();
                ce = dte2.Events.CommandEvents;
                ce.AfterExecute += new _dispCommandEvents_AfterExecuteEventHandler(TransformAllT4Templates_AfterExecute);

                dte2.ExecuteCommand("Build.TransformAllT4Templates");
            }
            catch (Exception ex) {
                MessageService.WriteMessage(ex.Message);
            }
        }
        public void TransformAllT4Templates() {
            // At this point the generic .tt files have been renamed to Domain specific names and all the generic words 
            // in the .tt files have been replaced with Domain specific words. Now run the Transform on all the 
            // .tt files to generate Domain specific code.
            MessageService.WriteMessage(string.Empty);
            MessageService.WriteMessage("==================================================================================================");
            MessageService.WriteMessage("Transforming templates....Generating Target Code....Please be patient....Takes about 30 seconds...");
            MessageService.WriteMessage("==================================================================================================");
            Application.DoEvents();

            try {
                OpenSolution();
                ce = dte2.Events.CommandEvents;
                ce.AfterExecute += new _dispCommandEvents_AfterExecuteEventHandler(TransformAllT4Templates_AfterExecute); 
                
                dte2.ExecuteCommand("Build.TransformAllT4Templates");
            }
            catch (Exception ex) {
                MessageService.WriteMessage(ex.Message);
            }
        }
        public void Attach(_DTE app)
        {
            applicationObject = app;

            EnvDTE.Events events       = applicationObject.Events;
            OutputWindow  outputWindow = (OutputWindow)applicationObject.Windows.Item(Constants.vsWindowKindOutput).Object;


            //IObjectExplorerService objectExplorer = ServiceCache.GetObjectExplorer();
            //var provider = (IObjectExplorerEventProvider)objectExplorer.GetService(typeof(IObjectExplorerEventProvider));

            //provider.SelectionChanged += new NodesChangedEventHandler(provider_SelectionChanged);

            _outputWindowPane = outputWindow.OutputWindowPanes.Add("DTE Event Information - C# Event Watcher");

            //Retrieve the event objects from the automation model
            _windowsEvents       = (EnvDTE.WindowEvents)events.get_WindowEvents(null);
            _textEditorEvents    = (EnvDTE.TextEditorEvents)events.get_TextEditorEvents(null);
            _taskListEvents      = (EnvDTE.TaskListEvents)events.get_TaskListEvents("");
            _solutionEvents      = (EnvDTE.SolutionEvents)events.SolutionEvents;
            _selectionEvents     = (EnvDTE.SelectionEvents)events.SelectionEvents;
            _outputWindowEvents  = (EnvDTE.OutputWindowEvents)events.get_OutputWindowEvents("");
            _findEvents          = (EnvDTE.FindEvents)events.FindEvents;
            _dteEvents           = (EnvDTE.DTEEvents)events.DTEEvents;
            _documentEvents      = (EnvDTE.DocumentEvents)events.get_DocumentEvents(null);
            _debuggerEvents      = (EnvDTE.DebuggerEvents)events.DebuggerEvents;
            _commandEvents       = (EnvDTE.CommandEvents)events.get_CommandEvents("{00000000-0000-0000-0000-000000000000}", 0);
            _buildEvents         = (EnvDTE.BuildEvents)events.BuildEvents;
            _miscFilesEvents     = (EnvDTE.ProjectItemsEvents)events.MiscFilesEvents;
            _solutionItemsEvents = (EnvDTE.ProjectItemsEvents)events.SolutionItemsEvents;

            _globalProjectItemsEvents           = ((EnvDTE80.Events2)events).ProjectItemsEvents;
            _globalProjectsEvents               = ((EnvDTE80.Events2)events).ProjectsEvents;
            _textDocumentKeyPressEvents         = ((EnvDTE80.Events2)events).get_TextDocumentKeyPressEvents(null);
            _codeModelEvents                    = ((EnvDTE80.Events2)events).get_CodeModelEvents(null);
            _windowVisibilityEvents             = ((EnvDTE80.Events2)events).get_WindowVisibilityEvents(null);
            _debuggerProcessEvents              = ((EnvDTE80.Events2)events).DebuggerProcessEvents;
            _debuggerExpressionEvaluationEvents = ((EnvDTE80.Events2)events).DebuggerExpressionEvaluationEvents;
            _publishEvents = ((EnvDTE80.Events2)events).PublishEvents;

            //Connect to each delegate exposed from each object retrieved above
            _windowsEvents.WindowActivated     += new _dispWindowEvents_WindowActivatedEventHandler(this.WindowActivated);
            _windowsEvents.WindowClosing       += new _dispWindowEvents_WindowClosingEventHandler(this.WindowClosing);
            _windowsEvents.WindowCreated       += new _dispWindowEvents_WindowCreatedEventHandler(this.WindowCreated);
            _windowsEvents.WindowMoved         += new _dispWindowEvents_WindowMovedEventHandler(this.WindowMoved);
            _textEditorEvents.LineChanged      += new _dispTextEditorEvents_LineChangedEventHandler(this.LineChanged);
            _taskListEvents.TaskAdded          += new _dispTaskListEvents_TaskAddedEventHandler(this.TaskAdded);
            _taskListEvents.TaskModified       += new _dispTaskListEvents_TaskModifiedEventHandler(this.TaskModified);
            _taskListEvents.TaskNavigated      += new _dispTaskListEvents_TaskNavigatedEventHandler(this.TaskNavigated);
            _taskListEvents.TaskRemoved        += new _dispTaskListEvents_TaskRemovedEventHandler(this.TaskRemoved);
            _solutionEvents.AfterClosing       += new _dispSolutionEvents_AfterClosingEventHandler(this.AfterClosing);
            _solutionEvents.BeforeClosing      += new _dispSolutionEvents_BeforeClosingEventHandler(this.BeforeClosing);
            _solutionEvents.Opened             += new _dispSolutionEvents_OpenedEventHandler(this.Opened);
            _solutionEvents.ProjectAdded       += new _dispSolutionEvents_ProjectAddedEventHandler(this.ProjectAdded);
            _solutionEvents.ProjectRemoved     += new _dispSolutionEvents_ProjectRemovedEventHandler(this.ProjectRemoved);
            _solutionEvents.ProjectRenamed     += new _dispSolutionEvents_ProjectRenamedEventHandler(this.ProjectRenamed);
            _solutionEvents.QueryCloseSolution += new _dispSolutionEvents_QueryCloseSolutionEventHandler(this.QueryCloseSolution);
            _solutionEvents.Renamed            += new _dispSolutionEvents_RenamedEventHandler(this.Renamed);
            _selectionEvents.OnChange          += new _dispSelectionEvents_OnChangeEventHandler(this.OnChange);
            _outputWindowEvents.PaneAdded      += new _dispOutputWindowEvents_PaneAddedEventHandler(this.PaneAdded);
            _outputWindowEvents.PaneClearing   += new _dispOutputWindowEvents_PaneClearingEventHandler(this.PaneClearing);
            _outputWindowEvents.PaneUpdated    += new _dispOutputWindowEvents_PaneUpdatedEventHandler(this.PaneUpdated);
            _findEvents.FindDone                       += new _dispFindEvents_FindDoneEventHandler(this.FindDone);
            _dteEvents.ModeChanged                     += new _dispDTEEvents_ModeChangedEventHandler(this.ModeChanged);
            _dteEvents.OnBeginShutdown                 += new _dispDTEEvents_OnBeginShutdownEventHandler(this.OnBeginShutdown);
            _dteEvents.OnMacrosRuntimeReset            += new _dispDTEEvents_OnMacrosRuntimeResetEventHandler(this.OnMacrosRuntimeReset);
            _dteEvents.OnStartupComplete               += new _dispDTEEvents_OnStartupCompleteEventHandler(this.OnStartupComplete);
            _documentEvents.DocumentClosing            += new _dispDocumentEvents_DocumentClosingEventHandler(this.DocumentClosing);
            _documentEvents.DocumentOpened             += new _dispDocumentEvents_DocumentOpenedEventHandler(this.DocumentOpened);
            _documentEvents.DocumentOpening            += new _dispDocumentEvents_DocumentOpeningEventHandler(this.DocumentOpening);
            _documentEvents.DocumentSaved              += new _dispDocumentEvents_DocumentSavedEventHandler(this.DocumentSaved);
            _debuggerEvents.OnContextChanged           += new _dispDebuggerEvents_OnContextChangedEventHandler(this.OnContextChanged);
            _debuggerEvents.OnEnterBreakMode           += new _dispDebuggerEvents_OnEnterBreakModeEventHandler(this.OnEnterBreakMode);
            _debuggerEvents.OnEnterDesignMode          += new _dispDebuggerEvents_OnEnterDesignModeEventHandler(this.OnEnterDesignMode);
            _debuggerEvents.OnEnterRunMode             += new _dispDebuggerEvents_OnEnterRunModeEventHandler(this.OnEnterRunMode);
            _debuggerEvents.OnExceptionNotHandled      += new _dispDebuggerEvents_OnExceptionNotHandledEventHandler(this.OnExceptionNotHandled);
            _debuggerEvents.OnExceptionThrown          += new _dispDebuggerEvents_OnExceptionThrownEventHandler(this.OnExceptionThrown);
            _commandEvents.AfterExecute                += new _dispCommandEvents_AfterExecuteEventHandler(this.AfterExecute);
            _commandEvents.BeforeExecute               += new _dispCommandEvents_BeforeExecuteEventHandler(this.BeforeExecute);
            _buildEvents.OnBuildBegin                  += new _dispBuildEvents_OnBuildBeginEventHandler(this.OnBuildBegin);
            _buildEvents.OnBuildDone                   += new _dispBuildEvents_OnBuildDoneEventHandler(this.OnBuildDone);
            _buildEvents.OnBuildProjConfigBegin        += new _dispBuildEvents_OnBuildProjConfigBeginEventHandler(this.OnBuildProjConfigBegin);
            _buildEvents.OnBuildProjConfigDone         += new _dispBuildEvents_OnBuildProjConfigDoneEventHandler(this.OnBuildProjConfigDone);
            _miscFilesEvents.ItemAdded                 += new _dispProjectItemsEvents_ItemAddedEventHandler(this.MiscFilesEvents_ItemAdded);
            _miscFilesEvents.ItemRemoved               += new _dispProjectItemsEvents_ItemRemovedEventHandler(this.MiscFilesEvents_ItemRemoved);
            _miscFilesEvents.ItemRenamed               += new _dispProjectItemsEvents_ItemRenamedEventHandler(this.MiscFilesEvents_ItemRenamed);
            _solutionItemsEvents.ItemAdded             += new _dispProjectItemsEvents_ItemAddedEventHandler(this.SolutionItemsEvents_ItemAdded);
            _solutionItemsEvents.ItemRemoved           += new _dispProjectItemsEvents_ItemRemovedEventHandler(this.SolutionItemsEvents_ItemRemoved);
            _solutionItemsEvents.ItemRenamed           += new _dispProjectItemsEvents_ItemRenamedEventHandler(this.SolutionItemsEvents_ItemRenamed);
            _globalProjectItemsEvents.ItemAdded        += new _dispProjectItemsEvents_ItemAddedEventHandler(GlobalProjectItemsEvents_ItemAdded);
            _globalProjectItemsEvents.ItemRemoved      += new _dispProjectItemsEvents_ItemRemovedEventHandler(GlobalProjectItemsEvents_ItemRemoved);
            _globalProjectItemsEvents.ItemRenamed      += new _dispProjectItemsEvents_ItemRenamedEventHandler(GlobalProjectItemsEvents_ItemRenamed);
            _globalProjectsEvents.ItemAdded            += new _dispProjectsEvents_ItemAddedEventHandler(GlobalProjectsEvents_ItemAdded);
            _globalProjectsEvents.ItemRemoved          += new _dispProjectsEvents_ItemRemovedEventHandler(GlobalProjectsEvents_ItemRemoved);
            _globalProjectsEvents.ItemRenamed          += new _dispProjectsEvents_ItemRenamedEventHandler(GlobalProjectsEvents_ItemRenamed);
            _textDocumentKeyPressEvents.AfterKeyPress  += new _dispTextDocumentKeyPressEvents_AfterKeyPressEventHandler(AfterKeyPress);
            _textDocumentKeyPressEvents.BeforeKeyPress += new _dispTextDocumentKeyPressEvents_BeforeKeyPressEventHandler(BeforeKeyPress);
            _codeModelEvents.ElementAdded              += new _dispCodeModelEvents_ElementAddedEventHandler(ElementAdded);
            _codeModelEvents.ElementChanged            += new _dispCodeModelEvents_ElementChangedEventHandler(ElementChanged);
            _codeModelEvents.ElementDeleted            += new _dispCodeModelEvents_ElementDeletedEventHandler(ElementDeleted);
            _windowVisibilityEvents.WindowHiding       += new _dispWindowVisibilityEvents_WindowHidingEventHandler(WindowHiding);
            _windowVisibilityEvents.WindowShowing      += new _dispWindowVisibilityEvents_WindowShowingEventHandler(WindowShowing);
            _debuggerExpressionEvaluationEvents.OnExpressionEvaluation += new _dispDebuggerExpressionEvaluationEvents_OnExpressionEvaluationEventHandler(OnExpressionEvaluation);
            _debuggerProcessEvents.OnProcessStateChanged += new _dispDebuggerProcessEvents_OnProcessStateChangedEventHandler(OnProcessStateChanged);
            _publishEvents.OnPublishBegin += new _dispPublishEvents_OnPublishBeginEventHandler(OnPublishBegin);
            _publishEvents.OnPublishDone  += new _dispPublishEvents_OnPublishDoneEventHandler(OnPublishDone);
        }