本文整理匯總了C#中Microsoft.VisualStudioTools.VisualStudioApp.GetOutputWindowText方法的典型用法代碼示例。如果您正苦於以下問題:C# VisualStudioApp.GetOutputWindowText方法的具體用法?C# VisualStudioApp.GetOutputWindowText怎麽用?C# VisualStudioApp.GetOutputWindowText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Microsoft.VisualStudioTools.VisualStudioApp
的用法示例。
在下文中一共展示了VisualStudioApp.GetOutputWindowText方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: LaunchAndVerifyNoDebug
private static void LaunchAndVerifyNoDebug(
VisualStudioApp app,
int port,
string textInResponse
) {
bool prevNormal = true, prevAbnormal = true;
string text;
int retries;
try {
using (var processes = new ProcessScope("python")) {
EndToEndLog("Transitioning to UI thread to build");
app.ServiceProvider.GetUIThread().Invoke(() => {
EndToEndLog("Building");
app.Dte.Solution.SolutionBuild.Build(true);
EndToEndLog("Build output: {0}", app.GetOutputWindowText("Build"));
EndToEndLog("Updating settings");
prevNormal = app.GetService<PythonToolsService>().DebuggerOptions.WaitOnNormalExit;
prevAbnormal = app.GetService<PythonToolsService>().DebuggerOptions.WaitOnAbnormalExit;
app.GetService<PythonToolsService>().DebuggerOptions.WaitOnNormalExit = false;
app.GetService<PythonToolsService>().DebuggerOptions.WaitOnAbnormalExit = false;
EndToEndLog("Starting running");
app.Dte.Solution.SolutionBuild.Run();
EndToEndLog("Running");
});
var newProcesses = processes.WaitForNewProcess(TimeSpan.FromSeconds(30)).ToList();
Assert.IsTrue(newProcesses.Any(), "Did not find new Python process");
EndToEndLog("Found new processes with IDs {0}", string.Join(", ", newProcesses.Select(p => p.Id.ToString())));
for (retries = 100;
retries > 0 &&
!IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners().Any(p => p.Port == port);
--retries) {
Thread.Sleep(300);
}
EndToEndLog("Active at http://localhost:{0}/", port);
text = WebDownloadUtility.GetString(new Uri(string.Format("http://localhost:{0}/", port)));
}
} finally {
app.ServiceProvider.GetUIThread().Invoke(() => {
app.GetService<PythonToolsService>().DebuggerOptions.WaitOnNormalExit = prevNormal;
app.GetService<PythonToolsService>().DebuggerOptions.WaitOnAbnormalExit = prevAbnormal;
});
}
EndToEndLog("Response from http://localhost:{0}/", port);
EndToEndLog(text);
Assert.IsTrue(text.Contains(textInResponse), text);
for (retries = 20;
retries > 0 && !IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners().All(p => p.Port != port);
--retries) {
Thread.Sleep(500);
}
if (retries > 0) {
EndToEndLog("Process ended");
} else {
EndToEndLog("Timed out waiting for process to exit");
}
}