Microsoft 9GD00001 Computer Accessories User Manual


 
Chapter 12: Customizing the Development Environment 367
DTE.Windows.Item("Customer.cs").Activate()
DTE.Windows.Item("{CF2DDC32-8CAD-11D2-9302-005345000000}")
.Activate() 'Find and Replace
DTE.Windows.Item("Customer.cs").Activate()
DTE.Find.FindWhat = "{"
DTE.Find.Target =
vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.Backwards = False
DTE.Find.MatchInHiddenText = False
DTE.Find.PatternSyntax = vsFindPatternSyntax
.vsFindPatternSyntaxLiteral
DTE.Find.Action = vsFindAction.vsFindActionFind
If (DTE.Find.Execute() =
vsFindResult.vsFindResultNotFound) Then
Throw New System.Exception("vsFindResultNotFound")
End If
DTE.Windows.Item(
"{CF2DDC32-8CAD-11D2-9302-005345000000}").Close()
DTE.Windows.Item("Customer.cs").Activate()
DTE.ActiveDocument.Selection.EndOfLine()
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "if"
DTE.ExecuteCommand("Edit.InsertTab")
DTE.ExecuteCommand("Edit.InsertTab")
DTE.ActiveDocument.Selection.Text =
"string.IsNullOrWhiteSpace("
DTE.ActiveDocument.Selection.Paste()
DTE.ActiveDocument.Selection.Text = ")"
DTE.ExecuteCommand("Edit.BreakLine")
DTE.ActiveDocument.Selection.Text =
"throw new ArgumentNullException("""
DTE.ActiveDocument.Selection.Paste()
DTE.ActiveDocument.Selection.Text = """, """
DTE.ActiveDocument.Selection.Paste()
DTE.ActiveDocument.Selection.Text =
" value is not valid."");"
DTE.ActiveDocument.Selection.LineDown()
DTE.ActiveDocument.Selection.NewLine()
End Sub
End Module
VB:
Option Strict Off
Option Explicit Off
Imports System
Imports EnvDTE