Skip to content

Commit 9f4bc39

Browse files
committed
Refactor ConsoleGui to OutConsoleGridView
Refactored the `ConsoleGui` class into a new class named `OutConsoleGridView` to improve modularity and maintainability. The `ConsoleGui` class was removed, and its functionality was moved to `OutConsoleGridView`, which is now implemented in a separate file (`OutConsoleGridView.cs`). Updated all references to `ConsoleGui` in `OutConsoleGridViewCmdletCommand`: - Replaced `_consoleGui` with `_outConsoleGridView`. - Updated method calls to use `OutConsoleGridView` methods. - Updated the `Dispose` method to dispose of `_outConsoleGridView`. This change reorganizes the codebase for better readability and separation of concerns without introducing any functional changes.
1 parent 1052c39 commit 9f4bc39

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs renamed to src/Microsoft.PowerShell.ConsoleGuiTools/OutConsoleGridView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
namespace Microsoft.PowerShell.ConsoleGuiTools;
1818

19-
internal sealed class ConsoleGui : IDisposable
19+
internal sealed class OutConsoleGridView : IDisposable
2020
{
2121
private const string FILTER_LABEL = "_Filter";
2222

src/Microsoft.PowerShell.ConsoleGuiTools/OutConsoleGridviewCmdletCommand.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Microsoft.PowerShell.ConsoleGuiTools;
1414
/// Sends output to an interactive table in a separate console window. This class is invoked by PowerShell when the
1515
/// Out-ConsoleGridView cmdlet is called.
1616
/// </summary>
17-
[Cmdlet(VerbsData.Out, "ConsoleGridView")]
17+
[Cmdlet(VerbsData.Out, "OutConsoleGridView")]
1818
[Alias("ocgv")]
1919
public class OutConsoleGridViewCmdletCommand : PSCmdlet, IDisposable
2020
{
@@ -24,7 +24,7 @@ public class OutConsoleGridViewCmdletCommand : PSCmdlet, IDisposable
2424
private const string ENVIRONMENT_NOT_SUPPORTED_FOR_GRID_VIEW = nameof(ENVIRONMENT_NOT_SUPPORTED_FOR_GRID_VIEW);
2525

2626
private readonly List<PSObject> _psObjects = new();
27-
private readonly ConsoleGui _consoleGui = new();
27+
private readonly OutConsoleGridView _outConsoleGridView = new();
2828

2929
#endregion Properties
3030

@@ -171,7 +171,7 @@ protected override void EndProcessing()
171171
ModuleVersion = MyInvocation.MyCommand.Version.ToString()
172172
};
173173

174-
var selectedIndexes = _consoleGui.Start(applicationData);
174+
var selectedIndexes = _outConsoleGridView.Start(applicationData);
175175
foreach (var idx in selectedIndexes)
176176
{
177177
var selectedObject = _psObjects[idx];
@@ -185,7 +185,7 @@ protected override void EndProcessing()
185185
/// </summary>
186186
public void Dispose()
187187
{
188-
_consoleGui.Dispose();
188+
_outConsoleGridView.Dispose();
189189
GC.SuppressFinalize(this);
190190
}
191191
}

0 commit comments

Comments
 (0)