forked from dotnet/project-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuildEventCommandLineDialogService.vb
65 lines (48 loc) · 2.34 KB
/
BuildEventCommandLineDialogService.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
' Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE.md file in the project root for more information.
Option Strict On
Option Explicit On
Namespace Microsoft.VisualStudio.Editors.PropertyPages
'--------------------------------------------------------------------------
' BuildEventCommandLineDialogService:
' Build Event Service Class. Implements SVsBuildEventCommandLineDialogService
' exposed via the IVsBuildEventCommandLineDialogService interface.
'--------------------------------------------------------------------------
<CLSCompliant(False)>
Friend NotInheritable Class BuildEventCommandLineDialogService
Implements Interop.IVsBuildEventCommandLineDialogService
Private ReadOnly _serviceProvider As IServiceProvider
Friend Sub New(sp As IServiceProvider)
_serviceProvider = sp
End Sub
Public Function EditCommandLine(WindowText As String, HelpID As String, OriginalCommandLine As String, MacroProvider As Interop.IVsBuildEventMacroProvider, ByRef Result As String) As Integer _
Implements Interop.IVsBuildEventCommandLineDialogService.EditCommandLine
Dim frm As New BuildEventCommandLineDialog
Dim i As Integer
Dim Count As Integer
' Initialize the title text
frm.SetFormTitleText(WindowText)
' Initialize the command line
frm.EventCommandLine = OriginalCommandLine
' Initialize helpTopicID
If HelpID IsNot Nothing Then
frm.HelpTopic = HelpID
End If
' Initialize the token values
Count = MacroProvider.GetCount()
Dim Names(Count - 1) As String
Dim Values(Count - 1) As String
For i = 0 To Count - 1
MacroProvider.GetExpandedMacro(i, Names(i), Values(i))
Next
frm.SetTokensAndValues(Names, Values)
' Show the form
If frm.ShowDialog(_serviceProvider) = System.Windows.Forms.DialogResult.OK Then
Result = frm.EventCommandLine
Return 0
Else
Result = OriginalCommandLine
Return 1
End If
End Function
End Class
End Namespace