本文整理汇总了C#中Microsoft.VisualStudioTools.VisualStudioApp.WaitForMode方法的典型用法代码示例。如果您正苦于以下问题:C# VisualStudioApp.WaitForMode方法的具体用法?C# VisualStudioApp.WaitForMode怎么用?C# VisualStudioApp.WaitForMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.VisualStudioTools.VisualStudioApp
的用法示例。
在下文中一共展示了VisualStudioApp.WaitForMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Breakpoint
public void Breakpoint()
{
using (var app = new VisualStudioApp())
{
var project = app.OpenProject(@"TestData\HelloWorld.sln");
TargetInfo ti = GetTargetInfo();
// Wait for solution to load...
for (int i = 0; i < 40 && app.Dte.Solution.Projects.Count == 0; i++)
{
System.Threading.Thread.Sleep(250);
}
Assert.IsFalse(0 == app.Dte.Solution.Projects.Count);
// Set platform
foreach (SolutionConfiguration2 solConfiguration2 in app.Dte.Solution.SolutionBuild.SolutionConfigurations)
{
if(String.Equals(solConfiguration2.PlatformName, ti.Plat, StringComparison.Ordinal))
{
solConfiguration2.Activate();
break;
}
}
// Open project properties
var item = app.SolutionExplorerTreeView.WaitForItem(
"Solution '" + app.Dte.Solution.Projects.Item(1).Name + "' (1 project)",
app.Dte.Solution.Projects.Item(1).Name
);
AutomationWrapper.Select(item);
app.Dte.ExecuteCommand("ClassViewContextMenus.ClassViewMultiselectProjectReferencesItems.Properties");
AutomationElement doc = null;
for (int i = 0; i < 10; i++)
{
doc = app.GetDocumentTab("HelloWorld.njsproj");
if (doc != null)
{
break;
}
System.Threading.Thread.Sleep(1000);
}
Assert.IsNotNull(doc, "Failed to find project properties tab");
// Enter IP address of target machine
var debuggerMachineName = new TextBox(
new AutomationWrapper(doc).FindByAutomationId("_debuggerMachineName")
);
debuggerMachineName.SetFocus();
Keyboard.ControlA();
Keyboard.Backspace();
Keyboard.Type(ti.IP);
app.Dte.ExecuteCommand("File.SaveAll");
// Build project
app.Dte.Solution.SolutionBuild.Build(true);
// Add breakpoint
app.Dte.Debugger.Breakpoints.Add(String.Empty, "server.js", 3, 1, String.Empty,
dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, String.Empty,
String.Empty, 1, String.Empty, 1, dbgHitCountType.dbgHitCountTypeNone);
// F5
app.Dte.ExecuteCommand("Debug.Start");
// Check that breakpoint is hit
app.WaitForMode(dbgDebugMode.dbgBreakMode);
Assert.IsTrue(app.Dte.ActiveDocument.Name.Contains("server.js"));
Assert.IsTrue((app.Dte.ActiveDocument.Object("TextDocument") as TextDocument).Selection.ActivePoint.Line == 3);
}
}