Beispiel #1
0
        /// <summary>
        /// Called when the analyze thread has completed.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void AnalyzeCompleteMain(object sender, EventArgs e)
        {
            Param.AssertNotNull(sender, "sender");
            Param.Ignore(e);

            EnvDTE.OutputWindowPane pane = VSWindows.GetInstance(this.serviceProvider).OutputPane;
            if (pane != null)
            {
                if (this.core.Cancel)
                {
                    pane.OutputString(string.Format(
                                          CultureInfo.InvariantCulture, Strings.LogBreak, Strings.Cancelled));
                }
                else
                {
                    pane.OutputString(string.Format(
                                          CultureInfo.InvariantCulture, Strings.LogBreak, Strings.Done));

                    pane.OutputString(string.Format(CultureInfo.InvariantCulture, Strings.ViolationCount, this.violationCount) + "\n\n\n");
                }
            }

            if (this.violationCount > 0)
            {
                this.ProvideEndAnalysisResult(this.violations);
                this.violations = null;
            }
        }
Beispiel #2
0
 /// <summary>
 /// Signals the helper to output that no files were avaliable for analysis.
 /// </summary>
 protected override void NoFilesToAnalyze()
 {
     EnvDTE.OutputWindowPane pane = VSWindows.GetInstance(this.ServiceProvider).OutputPane;
     if (pane != null)
     {
         pane.OutputString(string.Format(
                               CultureInfo.InvariantCulture, Strings.MiniLogBreak, Strings.NoFilesToAnalyze));
     }
 }
Beispiel #3
0
        /// <summary>
        /// Gets the singleton instance of the VSWindows.
        /// </summary>
        /// <param name="serviceProvider">System service provider.</param>
        /// <returns>Returns the singleton instance of the VSWindows.</returns>
        internal static VSWindows GetInstance(IServiceProvider serviceProvider)
        {
            Param.AssertNotNull(serviceProvider, "serviceProvider");

            if (instance == null)
            {
                instance = new VSWindows(serviceProvider);
            }

            return(instance);
        }
Beispiel #4
0
        /// <summary>
        /// Signals the helper to output that analysis has begun.
        /// </summary>
        protected override void SignalAnalysisStarted()
        {
            // Write out our header to the output window.
            EnvDTE.OutputWindowPane pane = VSWindows.GetInstance(this.ServiceProvider).OutputPane;
            if (pane != null)
            {
                pane.Clear();
                pane.Activate();

                VSWindows.GetInstance(this.ServiceProvider).OutputWindow.Activate();

                pane.OutputString(string.Format(
                                      CultureInfo.InvariantCulture, Strings.MiniLogBreak, Strings.StyleCopStarted));
            }
        }
        /// <summary>
        /// Writes a line of output to the output window.
        /// </summary>
        /// <param name="output">The text to output.</param>
        public void AddOutput(string output)
        {
            Param.RequireNotNull(output, "output");

            if (InvisibleForm.Instance.InvokeRequired)
            {
                AddOutputEventHandler outputDelegate = new AddOutputEventHandler(this.AddOutput);
                InvisibleForm.Instance.Invoke(outputDelegate, output);
            }
            else
            {
                EnvDTE.OutputWindowPane pane = VSWindows.GetInstance(this).OutputPane;
                if (pane != null)
                {
                    pane.OutputLine(output);
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// Called when output should be added to the Output pane.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">Contains the output string.</param>
        private void CoreOutputGenerated(object sender, OutputEventArgs e)
        {
            Param.Ignore(sender, e);

            // Make sure this is running on the main thread.
            if (InvisibleForm.Instance.InvokeRequired)
            {
                EventHandler <OutputEventArgs> outputDelegate = this.CoreOutputGenerated;

                InvisibleForm.Instance.Invoke(outputDelegate, sender, e);
            }
            else
            {
                var pane = VSWindows.GetInstance(this.serviceProvider).OutputPane;
                if (pane != null)
                {
                    pane.OutputLine(e.Output);
                }
            }
        }
        /// <summary>
        /// Gets the singleton instance of the VSWindows.
        /// </summary>
        /// <param name="serviceProvider">System service provider.</param>
        /// <returns>Returns the singleton instance of the VSWindows.</returns>
        internal static VSWindows GetInstance(IServiceProvider serviceProvider)
        {
            Param.AssertNotNull(serviceProvider, "serviceProvider");

            if (instance == null)
            {
                instance = new VSWindows(serviceProvider);
            }

            return instance;
        }