Beispiel #1
0
        public void textChanged(object o, TextContentChangedEventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            ParseTree.Tree.Parse(e.After.GetText(), out bool parsed);
            results.Clear();
            var root = ParseTree.Tree.Root();

            Parse(root);
            //results.Add(new Result { span = new Span(0, e.After.Length - 1), type = NodeType.MPLCONTENT });
            var errorStack = ParseTree.Tree.GetErrorStack();

            generalPane.Clear();
            if (!parsed)
            {
                try {
                    foreach (var error in errorStack)
                    {
                        var    document = getPropertyFromBuffer <ITextDocument>(e.Before.TextBuffer);
                        string message  = document.FilePath + error.getMessage() + '\n';
                        generalPane.OutputString(message);
                        generalPane.Activate();
                    }
                } catch (InvalidOperationException er) {
                    generalPane.OutputString(er.Message);
                    generalPane.Activate();
                }
            }

            ClassificationChanged?.Invoke(this, new ClassificationChangedEventArgs(new SnapshotSpan(e.After, 0, e.After.Length)));
        }
Beispiel #2
0
        public void ShowWindow()
        {
            _outputWindow.Activate();

            try
            {
                Window window = _dte.Windows.Item(vsWindowKindOutput);
                window.Activate();
            }
            catch (Exception) { }
        }
        /// <summary>
        /// Runs custom wizard logic when the wizard has completed all tasks.
        /// </summary>
        public void RunFinished()
        {
            string    frmName        = string.Empty;
            Array     activeProjects = (Array)dte.ActiveSolutionProjects;
            Project   project        = null;
            VSProject vsProj         = null;

            project = (Project)activeProjects.GetValue(0);

            if (project == null)
            {
                return;
            }

            vsProj = project.Object as VSProject;
            var tables = new List <string>();

            Settings.Default.MVCWizardConnection = _connectionString;
            Settings.Default.Save();
            if (_generalPane != null)
            {
                _generalPane.Activate();
            }

            SendToGeneralOutputWindow("Starting project generation...");
            if (_selectedTables != null && _dataAccessTechnology != DataAccessTechnology.None)
            {
                _selectedTables.ForEach(t => tables.Add(t.Name));
                SendToGeneralOutputWindow("Generating Entity Framework model...");
                if (tables.Count > 0)
                {
                    if (_dataAccessTechnology == DataAccessTechnology.EntityFramework5)
                    {
                        _currentEntityFrameworkVersion = ENTITY_FRAMEWORK_VERSION_5;
                    }
                    else if (_dataAccessTechnology == DataAccessTechnology.EntityFramework6)
                    {
                        _currentEntityFrameworkVersion = ENTITY_FRAMEWORK_VERSION_6;
                    }

                    if (string.IsNullOrEmpty(_projectPath))
                    {
                        _projectPath = System.IO.Path.GetDirectoryName(project.FullName);
                    }

                    string modelPath = Path.Combine(_projectPath, "Models");
                    ItemTemplateUtilities.GenerateEntityFrameworkModel(project, vsProj, new MySqlConnection(_connectionString), _selectedModel, tables,
                                                                       modelPath, "1", _language, ColumnMappings, ref TablesIncludedInModel);
                    GenerateMVCItems(vsProj);
                }
            }

            SendToGeneralOutputWindow("Finished MVC item generation.");
        }
Beispiel #4
0
 public void Write(string value)
 {
     if (!m_initialized)
     {
         Initialize();
     }
     if (!m_initialized)
     {
         return;
     }
     m_window.Visible = true;
     m_outputPane.OutputStringThreadSafe(value);
     m_outputPane.Activate();
 }
        private static void DisplayError(Exception ex, ProcessExecutionResult status)
        {
            IVsOutputWindowPane outputPane = Package.GetGlobalService(typeof(SVsGeneralOutputWindowPane)) as IVsOutputWindowPane;

            outputPane.Activate();

            if (status == ProcessExecutionResult.AuthDenied)
            {
                outputPane.OutputString("Visual Studio restart operation was cancelled by the user." + Environment.NewLine);
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("An exceptions has been trown while trying to start an elevated Visual Studio, see details below.");
                sb.AppendLine(ex.ToString());

                string diagnostics = sb.ToString();

                outputPane.OutputString(diagnostics);
                IVsActivityLog log = Package.GetGlobalService(typeof(SVsActivityLog)) as IVsActivityLog;
                log.LogEntry((uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, "MidnightDevelopers.VsRestarter", diagnostics);
            }

            //EnvDTE.OutputWindow.OutputWindow.Parent.Activate();
        }
        public void OutputString(string text)
        {
            const int VISIBLE = 1;
            const int DO_NOT_CLEAR_WITH_SOLUTION = 0;
            Guid      guidBidsHelperDebugPane    = new Guid("50C4E395-4E87-48BC-9BAC-7C4CD065F6E8");
            Guid      guidPane = guidBidsHelperDebugPane;

            IVsOutputWindow     outputWindow;
            IVsOutputWindowPane outputWindowPane = null;
            int hr;

            // Get the output window
            outputWindow = base.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;

            // The General pane is not created by default. We must force its creation
            //if (guidPane == Microsoft.VisualStudio.VSConstants.OutputWindowPaneGuid.GeneralPane_guid)
            //{
            hr = outputWindow.CreatePane(guidPane, "BIDS Helper", VISIBLE, DO_NOT_CLEAR_WITH_SOLUTION);
            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hr);
            //}

            // Get the pane
            hr = outputWindow.GetPane(guidPane, out outputWindowPane);
            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hr);

            // Output the text
            if (outputWindowPane != null)
            {
                outputWindowPane.Activate();
                outputWindowPane.OutputString(text);
            }
        }
Beispiel #7
0
        /// <summary>
        /// Writes message to output window
        /// </summary>
        /// <param name="message">Text message to write</param>
        public static async Task WriteAsync(string message)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            _outputWindowPane.Activate();
            _outputWindowPane.OutputStringThreadSafe(message);
        }
Beispiel #8
0
        internal static void Log(string message)
        {
            if (!string.IsNullOrWhiteSpace(message))
            {
                try
                {
                    IVsOutputWindow outWindow =
                        Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow;
                    Guid paneGuid            = VSConstants.GUID_OutWindowGeneralPane;
                    IVsOutputWindowPane pane = null;
                    if (outWindow != null)
                    {
                        outWindow.GetPane(ref paneGuid, out pane);

                        if (pane == null)
                        {
                            paneGuid = VSConstants.GUID_OutWindowDebugPane;
                            outWindow.GetPane(ref paneGuid, out pane);
                        }
                    }

                    if (pane != null)
                    {
                        pane.OutputString("From ProtobufGenerator: " + message + "\n");
                        pane.Activate();
                    }
                }
                catch (Exception)
                {
                }
            }
        }
Beispiel #9
0
        /// <summary>
        /// 输出内容到输出窗口
        /// </summary>
        /// <param name="guidPane"></param>
        /// <param name="text"></param>
        private void OutputString(Guid guidPane, string text)
        {
            const int           VISIBLE = 1;
            const int           DO_NOT_CLEAR_WITH_SOLUTION = 0;
            IVsOutputWindow     outputWindow;
            IVsOutputWindowPane outputWindowPane = null;
            int hr;

            // Get the output window
            outputWindow = ServiceProvider.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;
            //默认情况下不会创建“常规”窗格。 我们必须强迫它的创造
            if (guidPane == Microsoft.VisualStudio.VSConstants.OutputWindowPaneGuid.GeneralPane_guid)
            {
                hr = outputWindow.CreatePane(guidPane, "General", VISIBLE, DO_NOT_CLEAR_WITH_SOLUTION);
                Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hr);
            }
            // Get the pane
            hr = outputWindow.GetPane(guidPane, out outputWindowPane);
            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hr);
            // Output the text
            if (outputWindowPane != null)
            {
                outputWindowPane.Activate();
                outputWindowPane.OutputString(text);
            }
        }
            internal static async Task OutputWindowPaneAsync(string message)
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                IVsOutputWindowPane outputPane = null;
                var outputWindow = ServiceProvider.GlobalProvider.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;

                if (outputWindow != null && ErrorHandler.Failed(outputWindow.GetPane(ActionOutputWindowPane, out outputPane)))
                {
                    IVsWindowFrame windowFrame;
                    var            vsUiShell = ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;
                    if (vsUiShell != null)
                    {
                        uint flags = (uint)__VSFINDTOOLWIN.FTW_fForceCreate;
                        vsUiShell.FindToolWindow(flags, VSConstants.StandardToolWindows.Output, out windowFrame);
                        windowFrame.Show();
                    }

                    outputWindow.CreatePane(ActionOutputWindowPane, "Actions", 1, 1);
                    outputWindow.GetPane(ActionOutputWindowPane, out outputPane);
                    outputPane.Activate();
                }

                outputPane?.OutputString(message);
            }
Beispiel #11
0
 public void Activate()
 {
     if (_outputLog != null)
     {
         _outputLog.Activate();
     }
 }
Beispiel #12
0
        public async Task WriteAsync(string value)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            if (!m_initialized)
            {
                Initialize();
            }
            if (!m_initialized)
            {
                return;
            }
            m_window.Visible = true;
            m_outputPane.OutputStringThreadSafe(value);
            m_outputPane.Activate();
        }
Beispiel #13
0
        /// <summary>
        /// Output string to the specified pane
        /// </summary>
        /// <param name="guidPane">GUID of the pane to use</param>
        /// <param name="text">Text to output</param>
        private void OutputString(Guid guidPane, string text)
        {
            const int VISIBLE = 1;
            const int DO_NOT_CLEAR_WITH_SOLUTION = 0;

            IVsOutputWindow     outputWindow;
            IVsOutputWindowPane outputWindowPane = null;
            int hr;

            // Get the output window
            outputWindow = base.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;

            // The General pane is not created by default. We must force its creation
            if (guidPane == VSConstants.OutputWindowPaneGuid.GeneralPane_guid)
            {
                hr = outputWindow.CreatePane(guidPane, "General", VISIBLE, DO_NOT_CLEAR_WITH_SOLUTION);
                ErrorHandler.ThrowOnFailure(hr);
            }

            // Get the pane
            hr = outputWindow.GetPane(guidPane, out outputWindowPane);
            ErrorHandler.ThrowOnFailure(hr);

            // Output the text
            if (outputWindowPane != null)
            {
                outputWindowPane.OutputString(text);
                outputWindowPane.Activate();
            }
        }
Beispiel #14
0
        public void WriteLine(string line)
        {
            _pane.OutputString(line);
#if DEBUG
            _pane.Activate();
#endif
        }
Beispiel #15
0
        /// \short           Print $Message in `File.Structure.Debug` output window.
        /// \param  Message  Message to print.

        internal static void Print(string Message)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            Pane.OutputString(Message + "\n");
            Pane.Activate();
        }
 public static void Activate()
 {
     if (_pane != null)
     {
         _pane.Activate();
     }
 }
Beispiel #17
0
        internal static void LogEndRunning(bool failed)
        {
            IVsOutputWindowPane buildPane = BuildPane;

            buildPane.OutputString(string.Format(CultureInfo.InvariantCulture, "========== Roslyn script: execution {0}: {1} =========={2}", failed ? "failed" : "succeeded", DateTime.Now, Environment.NewLine));
            buildPane.Activate(); // Brings this pane into view
        }
Beispiel #18
0
        /// <summary>
        /// Get reference to IVsOutputWindowPane interface from pane guid. The method will create the pane if it is not already created.
        /// </summary>
        /// <param name="guidPane">A guid for the pane.</param>
        /// <param name="paneName">The name of the pane.</param>
        /// <param name="visible">Set the visibility state of the pane.</param>
        /// <param name="clearWithSolution">Should the pane be cleared with solution. It is used if the pane will be created by this method.</param>
        /// <returns>A reference to an IVsOutputWindowPane interface.</returns>
        public static IVsOutputWindowPane GetOutputWindowpane(IServiceProvider serviceProvider, Guid guidPane, string paneName, bool visible, bool clearWithSolution)
        {
            IVsOutputWindow outputWindow = serviceProvider.GetService(typeof(IVsOutputWindow)) as IVsOutputWindow;

            if (outputWindow == null)
            {
                throw new InvalidOperationException("Could not get the IVsOutputWindow");
            }

            IVsOutputWindowPane outputWindowPane = null;
            int hr = outputWindow.GetPane(ref guidPane, out outputWindowPane);

            if (ErrorHandler.Failed(hr) && outputWindowPane == null)
            {
                if (ErrorHandler.Succeeded(outputWindow.CreatePane(ref guidPane, paneName, visible ? 1 : 0, clearWithSolution ? 1 : 0)))
                {
                    outputWindow.GetPane(ref guidPane, out outputWindowPane);
                }
            }
            else
            {
                if (!visible)
                {
                    outputWindowPane.Hide();
                }
                else
                {
                    outputWindowPane.Activate();
                }
            }

            return(outputWindowPane);
        }
        /// <summary>
        /// Writes to the general output window.
        /// https://stackoverflow.com/a/1852535/1233379
        /// </summary>
        /// <param name="msg"></param>
        public static void Output(string msg, bool appendTS = true, bool debugOnly = true)
        {
            if (debugOnly && !AppHelper.Debug)
            {
                return;
            }
            ThreadHelper.ThrowIfNotOnUIThread();

            if (AppHelper.Debug)
            {
                msg = String.Format("[{0}] {1}", "DEBUG", msg);
            }
            if (appendTS)
            {
                msg = String.Format("[{0}] {1}", DateTime.Now.ToString("HH:mm:ss"), msg);
            }

            // ADD TO Error List pane
            TaskManager.AddWarning(msg);

            // ADD TO custom Output pane
            IVsOutputWindow     outWindow  = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow;
            Guid                customGuid = new Guid(GuidList.GuidPkgString);
            IVsOutputWindowPane customPane = null;

            outWindow.GetPane(ref customGuid, out customPane);
            if (customPane == null)
            {
                string customTitle = "Source Control Switcher [Debug]";
                outWindow.CreatePane(ref customGuid, customTitle, 1, 1);
                outWindow.GetPane(ref customGuid, out customPane);
            }
            customPane.Activate(); // Brings this pane into view
            customPane.OutputString(msg);
        }
Beispiel #20
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public static void WriteLine(Guid outputPaneGuid, string line)
        {
            //
            // Output specified line to the pane represented by the provided Guid.
            //   i.e. VSConstants.OutputWindowPaneGuid.DebugPane_guid
            //

            IVsOutputWindowPane debugWindowPane = null;

            if (s_outputWindow == null)
            {
                s_outputWindow = AcquireOutputWindow();
            }

            if (s_outputWindow?.GetPane(outputPaneGuid, out debugWindowPane) != VSConstants.S_OK)
            {
                ErrorHandler.ThrowOnFailure(s_outputWindow.CreatePane(outputPaneGuid, "General", 1, 0));

                ErrorHandler.ThrowOnFailure(s_outputWindow.GetPane(outputPaneGuid, out debugWindowPane));
            }

            if (debugWindowPane != null)
            {
                ErrorHandler.ThrowOnFailure(debugWindowPane.Activate());

                ErrorHandler.ThrowOnFailure(debugWindowPane.OutputString(line + Environment.NewLine));
            }
        }
Beispiel #21
0
        /// <summary>
        /// output string into output window (general pane)
        /// </summary>
        /// <param name="output">string to output</param>
        private void OutputString(string output)
        {
            if (_generalPane == null)
            {
                try
                {
                    IVsOutputWindow outWindow       = PowerShellToolsPackage.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow;
                    Guid            generalPaneGuid = VSConstants.OutputWindowPaneGuid.GeneralPane_guid;
                    // By default this is no pane created in output window, so we need to create one by our own
                    // This call won't do anything if there is one exists
                    int hr = outWindow.CreatePane(generalPaneGuid, "General", 1, 1);
                    outWindow.GetPane(ref generalPaneGuid, out _generalPane);
                }
                catch (Exception ex)
                {
                    Log.Error("Failed to create general pane of output window due to exception: ", ex);
                    throw;
                }
            }

            if (_generalPane != null)
            {
                _generalPane.Activate();                     // Brings this pane into view
                _generalPane.OutputStringThreadSafe(output); // Thread-safe so the the output order can be preserved
            }
        }
            public async Task ForceShowOutputPaneAsync()
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                Dte.Windows.Item(Constants.vsWindowKindOutput).Visible = true;
                _outputPane.Activate();
            }
Beispiel #23
0
        private async Task OutputMessageAsync(string message, bool clear = false)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            IVsOutputWindowPane outputPane  = null;
            IVsWindowFrame      windowFrame = null;
            var outputWindow = ServiceProvider.GlobalProvider.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;

            if (outputWindow != null && ErrorHandler.Failed(outputWindow.GetPane(windowGuid, out outputPane)))
            {
                outputWindow.CreatePane(windowGuid, "Meadow Device Explorer", 1, 1);
                outputWindow.GetPane(windowGuid, out outputPane);
            }

            var  vsUiShell = ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;
            uint flags     = (uint)__VSFINDTOOLWIN.FTW_fForceCreate;

            vsUiShell?.FindToolWindow(flags, VSConstants.StandardToolWindows.Output, out windowFrame);

            if (clear)
            {
                outputPane?.Clear();
            }

            windowFrame?.Show();
            outputPane?.Activate();
            outputPane?.OutputString($"[{DateTime.Now.ToLocalTime()}] {message}" + Environment.NewLine);
        }
Beispiel #24
0
        public static void Log(string text)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            const int VISIBLE = 1;
            const int DO_NOT_CLEAR_WITH_SOLUTION = 0;

            // Get the output window
            var outputWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow;
            int hr;

            var guidPane = Microsoft.VisualStudio.VSConstants.OutputWindowPaneGuid.GeneralPane_guid;

            hr = outputWindow.CreatePane(guidPane, "General", VISIBLE, DO_NOT_CLEAR_WITH_SOLUTION);
            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hr);

            // Get the pane
            IVsOutputWindowPane outputWindowPane = null;

            hr = outputWindow.GetPane(guidPane, out outputWindowPane);
            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hr);

            // Output the text
            if (outputWindowPane != null)
            {
                outputWindowPane.Activate();
                outputWindowPane.OutputString("Vue2Pack: " + text + Environment.NewLine);
            }
        }
        public static async Task ShowMessageAsync(String message)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            IVsOutputWindowPane outputWindowPane = null;

            // Initialize the output window.
            // Required if trying to output a message before the MainPanel has initialized.
            await InitOutputWindowPaneAsync();

            // Initialize the JFrog output window pane if required.
            if (outputWindow != null && ErrorHandler.Failed(outputWindow.GetPane(OutputWindowPaneUid, out outputWindowPane)))
            {
                outputWindowPane = InitJfrogWindowPane();
            }

            // If couldn't set the output window, cannot log messages.
            if (outputWindow == null)
            {
                return;
            }

            // Write the message.
            DateTime localDate = DateTime.Now;
            var      culture   = new CultureInfo("en-GB");

            message = "[" + localDate.ToString(culture) + "] " + message;
            outputWindowPane.Activate();
            outputWindowPane.OutputStringThreadSafe(message);
            outputWindowPane.OutputStringThreadSafe("\n");
        }
Beispiel #26
0
        private void OutputStringInGeneralPane(string text)
        {
            const int VISIBLE = 1;
            const int DO_NOT_CLEAR_WITH_SOLUTION = 0;

            IVsOutputWindow     outputWindow;
            IVsOutputWindowPane outputWindowPane = null;
            int hr;

            // Get the output window
            outputWindow = base.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;

            // The General pane is not created by default. We must force its creation
            hr = outputWindow.CreatePane(VSConstants.OutputWindowPaneGuid.GeneralPane_guid, "General", VISIBLE, DO_NOT_CLEAR_WITH_SOLUTION);
            ErrorHandler.ThrowOnFailure(hr);

            // Get the pane
            hr = outputWindow.GetPane(VSConstants.OutputWindowPaneGuid.GeneralPane_guid, out outputWindowPane);
            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hr);

            // Output the text
            if (outputWindowPane != null)
            {
                outputWindowPane.Activate();
                outputWindowPane.OutputString(text + Environment.NewLine);
            }
        }
Beispiel #27
0
 /// <summary>
 /// Configure <see cref="IVsOutputWindow"/> and <see cref="IVsOutputWindowPane"/>
 /// </summary>
 public static void Configure()
 {
     vsOutputWindow = Package.GetGlobalService(typeof(IVsOutputWindow)) as IVsOutputWindow;
     vsOutputWindow.CreatePane(ref guid, LogTitle, 1, 0);
     vsOutputWindow.GetPane(ref guid, out vsOutputWindowPane);
     vsOutputWindowPane.Activate();
 }
Beispiel #28
0
 // Methods
 internal static void WriteLine(string format, params object[] args)
 {
     if ((_windowPane == null) && !_failedPaneCreation)
     {
         IVsOutputWindow globalService      = (IVsOutputWindow)Package.GetGlobalService(typeof(SVsOutputWindow));
         Guid            xBuilderWindowPane = GuidList.XBuilderWindowPane;
         if (ErrorHandler.Failed(globalService.GetPane(ref xBuilderWindowPane, out _windowPane)))
         {
             try
             {
                 ErrorHandler.ThrowOnFailure(globalService.CreatePane(ref xBuilderWindowPane, "XBuilder", 1, 1));
                 ErrorHandler.ThrowOnFailure(globalService.GetPane(ref xBuilderWindowPane, out _windowPane));
             }
             catch
             {
                 _failedPaneCreation = true;
                 throw;
             }
         }
     }
     if (_windowPane != null)
     {
         ErrorHandler.ThrowOnFailure(_windowPane.Activate());
         ErrorHandler.ThrowOnFailure(_windowPane.OutputString(string.Format(CultureInfo.CurrentUICulture, format + "\n", args)));
     }
 }
Beispiel #29
0
        public void Clear()
        {
            Start();

            _outputWindowPane.Activate();
            _outputWindowPane.Clear();
        }
Beispiel #30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="outWindow"></param>
        /// <param name="m"></param>
        public void WriteToOutputWindow(string m)
        {
            IVsOutputWindowPane w = OutputWindow();

            w.OutputString(string.Format("{0}\n", m));
            w.Activate();
        }
Beispiel #31
0
 /// <summary>
 /// Make sure the output pane is loaded.
 /// </summary>
 public void Load()
 {
     if (outputPane == null)
     {
         outputPane = VSUtilities.ServiceProvider().GetOutputPane(new Guid(GuidList.Strings.guidDot42OutputPane), "dot42", true, false);
         outputPane.Activate();
     }
 }
 private void btnProgram_Click(object sender, EventArgs e)
 {
     var info = GetProcessInfo();
     AVRDudeProcessWrapper programmer = new AVRDudeProcessWrapper(info);
     outputPane = CreateOrGetOutputWindowPane();
     outputPane.Activate();
     programmer.MessageReceived += Programmer_MessageReceived;
     programmer.Program(txtProgramPath.Text);
 }
Beispiel #33
0
 /// <summary>
 /// Make sure the output pane is loaded.
 /// </summary>
 public void Load()
 {
     if (outputPane == null)
     {
         Guid guid = _guid;
         if (_guid == default(Guid))
         {
             outputPane = VSUtilities.ServiceProvider().GetOutputPane(new Guid(GuidList.Strings.guidDot42OutputPane), _title, true, false);
             outputPane.Activate();
         }
         else
         {
             outputPane = VSUtilities.ServiceProvider().GetOutputPane(_guid, _title, true, false);
         }
     }
 }
        //--//

        private void Message(IVsOutputWindowPane pane, String msg)
        {
            if(pane == null)
                return;

            if(msg==null)
                msg = "[no message string provided to MessageCentre.Message()" + new StackTrace().ToString();

            try
            {
                lock (pane)
                {
                    pane.Activate();
                    pane.OutputStringThreadSafe(msg + "\r\n");
                }
            }
            catch( InvalidComObjectException )
            {
            }

        }