コード例 #1
0
        protected override void Initialize()
        {
            base.Initialize();
            new OrchestratorCommandSet(this);
            this.optionsAutomation = new OrchestratorOptionsAutomation(this);
            ServiceCreatorCallback callback = new ServiceCreatorCallback(this.OnCreateService);

            ((IServiceContainer)this).AddService(typeof(STextTemplating), callback, true);
            DTE dTE = this.GetDTE();

            if (dTE != null)
            {
                this.solutionEvents = dTE.Events.SolutionEvents;
                if (this.solutionEvents != null)
                {
                    this.solutionEvents.add_AfterClosing(new _dispSolutionEvents_AfterClosingEventHandler(this.OnSolutionClose));
                }
            }
        }
コード例 #2
0
 private bool ShowWarningDialog()
 {
     return(OrchestratorPackage.ShowSecurityDialogDuringBatchRun && OrchestratorOptionsAutomation.ShowSecurityWarningDialog(base.GlobalServiceProvider));
 }
コード例 #3
0
 public OrchestratorOptionsAutomation(IServiceProvider serviceProvider)
 {
     this.serviceProvider = serviceProvider;
     this.LoadSettingsFromStorage();
     instance = this;
 }
コード例 #4
0
 private void OnMenuGenerateAllCode(object sender, EventArgs e)
 {
     if (OrchestratorOptionsAutomation.ShowSecurityWarningDialog(this.ServiceProvider))
     {
         this.WriteLine();
         this.WriteLine(Microsoft.VisualStudio.TextTemplating.VSHost.Resources.TransformationCancelled);
     }
     else
     {
         Microsoft.VisualStudio.TextTemplating.VSHost.OrchestratorPackage.ShowSecurityDialogDuringBatchRun = false;
         try
         {
             if (((this.Dte.Solution != null) && (this.Dte.Solution.Projects != null)) && !this.SaveAllOpenFiles())
             {
                 Application.DoEvents();
                 this.Dte.ExecuteCommand("View.Output", "");
                 this.outputPane.Clear();
                 this.WriteLine();
                 this.WriteLine(Microsoft.VisualStudio.TextTemplating.VSHost.Resources.OrchestratorStartCodeGen);
                 this.WriteLine(Microsoft.VisualStudio.TextTemplating.VSHost.Resources.OrchestrationSeparator);
                 this.outputPane.Activate();
                 this.BeginErrorSession();
                 Application.DoEvents();
                 List <ProjectItem> toProcess = new List <ProjectItem>();
                 foreach (Project project in this.Dte.Solution.Projects)
                 {
                     this.FindProjectItems(project, toProcess);
                 }
                 bool         flag2     = false;
                 IVsStatusbar service   = this.ServiceProvider.GetService(typeof(IVsStatusbar)) as IVsStatusbar;
                 uint         pdwCookie = 0;
                 uint         count     = (uint)toProcess.Count;
                 if (service != null)
                 {
                     service.Progress(ref pdwCookie, 1, Microsoft.VisualStudio.TextTemplating.VSHost.Resources.TextTemplatingStatusBarLabel, 0, count);
                 }
                 this.codeMarkers.CodeMarker(Microsoft.Internal.Performance.CodeMarkerEvent.perfVSWhitehorseT4CodeGenerationBegin);
                 uint nComplete = 1;
                 foreach (ProjectItem item in toProcess)
                 {
                     Application.DoEvents();
                     if (item != null)
                     {
                         flag2 |= this.RunCustomTool(item);
                     }
                     if (service != null)
                     {
                         service.Progress(ref pdwCookie, 1, Microsoft.VisualStudio.TextTemplating.VSHost.Resources.TextTemplatingStatusBarLabel, nComplete, count);
                     }
                     nComplete += 1;
                     Application.DoEvents();
                 }
                 this.codeMarkers.CodeMarker(Microsoft.Internal.Performance.CodeMarkerEvent.perfVSWhitehorseT4CodeGenerationEnd);
                 this.WriteLine(Microsoft.VisualStudio.TextTemplating.VSHost.Resources.OrchestrationSeparator);
                 this.WriteLine(Microsoft.VisualStudio.TextTemplating.VSHost.Resources.OrchestratorEndCodeGen);
                 this.EndErrorSession();
                 if (service != null)
                 {
                     service.Progress(ref pdwCookie, 0, string.Empty, count, count);
                 }
                 this.ExecuteCommandIfEnabled("View.SolutionExplorer");
                 this.ExecuteCommandIfEnabled("View.Refresh");
                 if (flag2)
                 {
                     this.ExecuteCommandIfEnabled("View.ErrorList");
                 }
                 else
                 {
                     this.ExecuteCommandIfEnabled("View.Output");
                 }
             }
         }
         finally
         {
             Microsoft.VisualStudio.TextTemplating.VSHost.OrchestratorPackage.ShowSecurityDialogDuringBatchRun = true;
         }
     }
 }