Beispiel #1
0
        private void Thread_Start(object obj)
        {
            ThreadParameter         parameter     = (ThreadParameter)obj;
            DTE2                    application   = parameter.Application;
            CSqlOptions             settings      = parameter.CSqlOptions;
            OutputPaneTraceListener traceListener = null;

            try {
                var outputPane = Gui.Output.GetAndActivateOutputPane(application);
                if (outputPane != null)
                {
                    outputPane.Clear();
                    traceListener = new OutputPaneTraceListener(outputPane);
                }

                if (traceListener != null)
                {
                    Trace.Listeners.Add(traceListener);
                }
                this.currentExecutor = new ScriptExecutor(settings);
                this.currentExecutor.Execute();

                if (!String.IsNullOrEmpty(settings.DistributionFile))
                {
                    application.ItemOperations.OpenFile(settings.DistributionFile, Constants.vsViewKindCode);
                }
                currentExecutor = null;
            }
            finally {
                currentExecutor = null;
                if (traceListener != null)
                {
                    Trace.Listeners.Remove(traceListener);
                    traceListener.Close();
                    traceListener.Dispose();
                }
            }
            Commands2 commands = application.Commands as Commands2;

            if (commands != null)
            {
                commands.UpdateCommandUI(false);
            }
        }