/// <summary> /// Initializes the singleton instance of the command. /// </summary> /// <param name="package">Owner package, not null.</param> /// <param name="applicationObject">Top-level Visual Studio Automation object</param> public static void Initialize(Package package, EnvDTE80.DTE2 applicationObject, EnvDTE.OutputWindowPane owp) { Instance = new CreateBizTalkBuildAndDeployScript(package); Instance._applicationObject = applicationObject; Instance._owp = owp; Helpers.BizTalkBuildAndDeployHelper.Owp = owp; owp.OutputString(string.Format("Create BizTalk Build and Deploy script command initialized")); owp.OutputString(Environment.NewLine); }
// 这个弹出框需要server参数,麻烦,用winform方便 //public static void Info(IServiceProvider server, string msg, string title = "插件-信息提示") //{ // VsShellUtilities.ShowMessageBox( // server, // msg, // title, // OLEMSGICON.OLEMSGICON_INFO, // OLEMSGBUTTON.OLEMSGBUTTON_OK, // OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); //} /// <summary> /// 在vs的输出窗口的标题为"web发布插件"的窗口里输出文本内容 /// </summary> /// <param name="msg">文本</param> /// <param name="clear">是否清空原有信息</param> public static void VsOutWind(string msg, bool clear = false) { //ThreadHelper.ThrowIfNotOnUIThread(); // 输出窗口集合 EnvDTE.OutputWindowPanes panels = EnvVar._dte.ToolWindows.OutputWindow.OutputWindowPanes; // 输出窗口固定的自定义项标题 string title = EnvVar.Name; try { // If the pane exists already, write to it. panels.Item(title); } catch (ArgumentException) { // Create a new pane and write to it. panels.Add(title); } EnvDTE.OutputWindowPane panel = panels.Item(title); // 清空消息 if (clear) { panel.Clear(); } // 激活输出窗口的该面板 panel.Activate(); // 输出消息 panel.OutputString(msg); // 显示(激活) vs"输出"窗口 string winCaption = "输出"; EnvVar._dte.Windows.Item(winCaption).Activate(); }
public void Log(String message, OptionsGeneral.LoggerPriority priority = OptionsGeneral.LoggerPriority.Low) { if (priority <= m_settings.general.logType) { m_outputWindowPane.OutputString(message + Environment.NewLine); } }
/// <summary> /// Write a line of text to the test pane /// </summary> internal static void WriteToTestPane(string text, bool appendLineFeed) { if (!string.IsNullOrEmpty(text)) { EnvDTE.OutputWindowPane testPane = GetTestingOutputPane(); if (testPane != null) { testPane.OutputString(text); if (appendLineFeed) { testPane.OutputString(System.Environment.NewLine); testPane.OutputString(System.Environment.NewLine); } } } }
private async void OnOutputDataReceived(object sender, DataReceivedEventArgs e) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(_package.DisposalToken); EnvDTE.OutputWindowPane pane = getOutputPane(_outputPane); if (pane != null && !String.IsNullOrEmpty(e.Data)) { pane.OutputString(e.Data + "\r"); } }
internal static void WriteToImpromptuPane(string text, EnvDTE.OutputWindowPane destination) { if (!string.IsNullOrEmpty(text)) { destination = destination ?? GetImpromptuOutputPane(); if (destination != null) { destination.OutputString(text); } } }
public void WriteMessage(String message) { StringBuilder s = new StringBuilder(); for (int i = 0; i < Indent; ++i) { s.Append(" "); } s.AppendLine(message); OutputPane.Activate(); OutputPane.OutputString(s.ToString()); }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void MenuItemCallback(object sender, EventArgs e) { // Execute the msbuild script DateTime started = DateTime.Now; try { Helpers.BizTalkBuildAndDeployHelper.ExecuteBizTalkBuildAndDeployScript( (EnvDTE100.Solution4)_applicationObject.Solution, _owp); } catch (Exception ex) { Instance._owp.OutputString(Environment.NewLine); _owp.OutputString(string.Format("{0}: Execute Build & Deploy failed. It took {1} seconds", DateTime.Now, DateTime.Now.Subtract(started).Seconds)); _owp.OutputString(Environment.NewLine); _owp.OutputString(Environment.NewLine); _owp.OutputString(string.Format("ErrorMessage : {0}", ex.InnerException != null ? ex.InnerException.Message : ex.Message)); _owp.OutputString(Environment.NewLine); _owp.OutputString(string.Format("StackTrace : {0}", ex.InnerException != null ? ex.InnerException.Message : ex.StackTrace)); _owp.OutputString(Environment.NewLine); _owp.OutputString(Environment.NewLine); } }
public void WriteMessage(string message) { ThreadHelper.JoinableTaskFactory.Run(async() => { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); StringBuilder s = new StringBuilder(); for (int i = 0; i < Indent; ++i) { s.Append(" "); } s.AppendLine(message); OutputPane.Activate(); OutputPane.OutputString(s.ToString()); }); }
protected void WriteLine(string message) { if (message == null) { return; } Log.Info(message); EnvDTE.OutputWindowPane pane = GetOutputPane(); if (pane == null) { return; } using (StringReader sr = new StringReader(message)) { string line; while (null != (line = sr.ReadLine())) { bool writeRaw = true; try { Match match = RegexPatterns.VSErrorMessage.Match(message); if (match.Success && File.Exists(match.Groups["path"].Value)) { int lineNo; int.TryParse(match.Groups["line"].Value, out lineNo); pane.OutputTaskItemString(line + Environment.NewLine, EnvDTE.vsTaskPriority.vsTaskPriorityMedium, pane.Name, EnvDTE.vsTaskIcon.vsTaskIconCompile, match.Groups["path"].Value, lineNo, match.Groups["message"].Value, true); writeRaw = false; } } catch { writeRaw = true; } if (writeRaw) { pane.OutputString(line + Environment.NewLine); } } } }
/// <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.OutputString(output); } } }
/// <summary> /// 输出信息到VS的"输出"窗口,如果"输出"窗口未打开,则打开后再输出 /// </summary> /// <param name="msg"></param> internal static void OutPutMsg(string msg, bool clear = false) { EnvDTE.OutputWindowPanes panels = _dte.ToolWindows.OutputWindow.OutputWindowPanes; // 输出窗口中的一个自定义项的标题 string title = "发布插件 消息"; // EnvDTE.OutputWindowPane panel = null; foreach (EnvDTE.OutputWindowPane item in panels) { if (item.Name == title) { panel = item; break; } } if (panel == null) { panel = panels.Add(title); } // 清空消息 if (clear) { panel.Clear(); } // 激活输出窗口的该面板 panel.Activate(); // 输出消息 panel.OutputString(msg); // 显示(激活) vs"输出"窗口 string winCaption = "输出"; _dte.Windows.Item(winCaption).Activate(); }
public void Run() { using (TestRunnerServer server = new TestRunnerServer()) { server.Complete += new CompleteHandler(OnComplete); server.Result += new ResultHandler(OnResult); server.Error += new ErrorHandler(OnError); EnvDTE.Process attachedProcess; ProcessStartInfo psi = new ProcessStartInfo(); Assembly asm = typeof(ITestRunnerService).Assembly; psi.FileName = asm.Location; psi.WorkingDirectory = Path.GetDirectoryName(_assembly); psi.UseShellExecute = false; psi.RedirectStandardOutput = true; psi.WindowStyle = ProcessWindowStyle.Hidden; _process = Process.Start(psi); foreach (EnvDTE.Process p in _output.DTE.Debugger.LocalProcesses) { if (p.ProcessID == _process.Id) { attachedProcess = p; attachedProcess.Attach(); break; } } string error = _process.StandardOutput.ReadToEnd(); _process.WaitForExit(); _output.OutputString("\n"); _output.OutputString(error); _output.Activate(); _status.Text = GetResultText(); } }
public void OutputString(string s) { _outputWindowPane.OutputString(s); }
public void Message(string type, string module, string text) { buildPane.OutputString(string.Format("[BuildEngine] {0}: {1}\r\n", type[0], text)); }
override protected void Append(LoggingEvent loggingEvent) { outputWindowPane.OutputString(RenderLoggingEvent(loggingEvent)); }
void BuildOutputReceived(EnvDTE.OutputWindowPane buildPane, DataReceivedEventArgs args) { buildPane.OutputString(args.Data + Environment.NewLine); }