@@ -22,7 +22,8 @@ internal class TerminalPSHostUserInterface : EditorServicesPSHostUserInterface
22
22
#region Private Fields
23
23
24
24
private readonly PSHostUserInterface internalHostUI ;
25
- private ConsoleReadLine consoleReadLine ;
25
+ private readonly PSObject _internalHostPrivateData ;
26
+ private readonly ConsoleReadLine _consoleReadLine ;
26
27
27
28
#endregion
28
29
@@ -44,8 +45,9 @@ public TerminalPSHostUserInterface(
44
45
new TerminalPSHostRawUserInterface ( logger , internalHost ) ,
45
46
logger )
46
47
{
47
- this . internalHostUI = internalHost . UI ;
48
- this . consoleReadLine = new ConsoleReadLine ( powerShellContext ) ;
48
+ internalHostUI = internalHost . UI ;
49
+ _internalHostPrivateData = internalHost . PrivateData ;
50
+ _consoleReadLine = new ConsoleReadLine ( powerShellContext ) ;
49
51
50
52
// Set the output encoding to UTF-8 so that special
51
53
// characters are written to the console correctly
@@ -54,11 +56,11 @@ public TerminalPSHostUserInterface(
54
56
System . Console . CancelKeyPress +=
55
57
( obj , args ) =>
56
58
{
57
- if ( ! this . IsNativeApplicationRunning )
59
+ if ( ! IsNativeApplicationRunning )
58
60
{
59
61
// We'll handle Ctrl+C
60
62
args . Cancel = true ;
61
- this . SendControlC ( ) ;
63
+ SendControlC ( ) ;
62
64
}
63
65
} ;
64
66
}
@@ -75,6 +77,24 @@ public TerminalPSHostUserInterface(
75
77
/// </summary>
76
78
internal protected override bool SupportsWriteProgress => true ;
77
79
80
+ /// <summary>
81
+ /// Gets and sets the value of progress foreground from the internal host since Progress is handled there.
82
+ /// </summary>
83
+ internal override ConsoleColor ProgressForegroundColor
84
+ {
85
+ get => ( ConsoleColor ) _internalHostPrivateData . Properties [ "ProgressForegroundColor" ] . Value ;
86
+ set => _internalHostPrivateData . Properties [ "ProgressForegroundColor" ] . Value = value ;
87
+ }
88
+
89
+ /// <summary>
90
+ /// Gets and sets the value of progress background from the internal host since Progress is handled there.
91
+ /// </summary>
92
+ internal override ConsoleColor ProgressBackgroundColor
93
+ {
94
+ get => ( ConsoleColor ) _internalHostPrivateData . Properties [ "ProgressBackgroundColor" ] . Value ;
95
+ set => _internalHostPrivateData . Properties [ "ProgressBackgroundColor" ] . Value = value ;
96
+ }
97
+
78
98
/// <summary>
79
99
/// Requests that the HostUI implementation read a command line
80
100
/// from the user to be executed in the integrated console command
@@ -86,7 +106,7 @@ public TerminalPSHostUserInterface(
86
106
/// <returns>A Task that can be awaited for the resulting input string.</returns>
87
107
protected override Task < string > ReadCommandLineAsync ( CancellationToken cancellationToken )
88
108
{
89
- return this . consoleReadLine . ReadCommandLineAsync ( cancellationToken ) ;
109
+ return _consoleReadLine . ReadCommandLineAsync ( cancellationToken ) ;
90
110
}
91
111
92
112
/// <summary>
@@ -97,9 +117,9 @@ protected override Task<string> ReadCommandLineAsync(CancellationToken cancellat
97
117
protected override InputPromptHandler OnCreateInputPromptHandler ( )
98
118
{
99
119
return new TerminalInputPromptHandler (
100
- this . consoleReadLine ,
120
+ _consoleReadLine ,
101
121
this ,
102
- this . Logger ) ;
122
+ Logger ) ;
103
123
}
104
124
105
125
/// <summary>
@@ -110,9 +130,9 @@ protected override InputPromptHandler OnCreateInputPromptHandler()
110
130
protected override ChoicePromptHandler OnCreateChoicePromptHandler ( )
111
131
{
112
132
return new TerminalChoicePromptHandler (
113
- this . consoleReadLine ,
133
+ _consoleReadLine ,
114
134
this ,
115
- this . Logger ) ;
135
+ Logger ) ;
116
136
}
117
137
118
138
/// <summary>
@@ -167,7 +187,7 @@ public override void WriteOutput(
167
187
/// </param>
168
188
protected override void WriteProgressImpl ( long sourceId , ProgressRecord record )
169
189
{
170
- this . internalHostUI . WriteProgress ( sourceId , record ) ;
190
+ internalHostUI . WriteProgress ( sourceId , record ) ;
171
191
}
172
192
173
193
/// <summary>
0 commit comments