@@ -30,6 +30,19 @@ public class ConsoleService : IDisposable
30
30
31
31
#region Constructors
32
32
33
+ /// <summary>
34
+ /// Creates an instance of the ConsoleService class using the
35
+ /// given IConsoleHost implementation to invoke host operations
36
+ /// on behalf of the ConsolePSHost. An InitialSessionState may
37
+ /// be provided to create the console runspace using a particular
38
+ /// configuraiton.
39
+ /// </summary>
40
+ /// <param name="consoleHost">
41
+ /// An IConsoleHost implementation which handles host operations.
42
+ /// </param>
43
+ /// <param name="initialSessionState">
44
+ /// An optional InitialSessionState to use in creating the console runspace.
45
+ /// </param>
33
46
public ConsoleService (
34
47
IConsoleHost consoleHost ,
35
48
InitialSessionState initialSessionState = null )
@@ -56,6 +69,11 @@ public ConsoleService(
56
69
57
70
#region Public Methods
58
71
72
+ /// <summary>
73
+ /// Executes a command in the console runspace.
74
+ /// </summary>
75
+ /// <param name="commandString">The command string to execute.</param>
76
+ /// <returns>A Task that can be awaited for the command completion.</returns>
59
77
public async Task ExecuteCommand ( string commandString )
60
78
{
61
79
PowerShell powerShell = PowerShell . Create ( ) ;
@@ -101,6 +119,15 @@ await Task.Factory.StartNew(
101
119
}
102
120
}
103
121
122
+ /// <summary>
123
+ /// Sends a user's prompt choice response back to the specified prompt ID.
124
+ /// </summary>
125
+ /// <param name="promptId">
126
+ /// The ID of the prompt to which the user is responding.
127
+ /// </param>
128
+ /// <param name="choiceResult">
129
+ /// The index of the choice that the user selected.
130
+ /// </param>
104
131
public void ReceiveChoicePromptResult (
105
132
int promptId ,
106
133
int choiceResult )
@@ -109,6 +136,10 @@ public void ReceiveChoicePromptResult(
109
136
this . consoleHost . PromptForChoiceResult ( promptId , choiceResult ) ;
110
137
}
111
138
139
+ /// <summary>
140
+ /// Sends a CTRL+C signal to the console to halt execution of
141
+ /// the current command.
142
+ /// </summary>
112
143
public void SendControlC ( )
113
144
{
114
145
// TODO: Cancel the current pipeline execution
@@ -118,6 +149,9 @@ public void SendControlC()
118
149
119
150
#region IDisposable Implementation
120
151
152
+ /// <summary>
153
+ /// Disposes the runspace in use by the ConsoleService.
154
+ /// </summary>
121
155
public void Dispose ( )
122
156
{
123
157
if ( this . currentRunspace != null )
0 commit comments