Skip to content

Commit ac3941b

Browse files
committed
Run C# extension formatter on ConsoleGuiTools sources
1 parent a24ffe8 commit ac3941b

File tree

5 files changed

+103
-88
lines changed

5 files changed

+103
-88
lines changed

src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,20 @@ private void ApplyFilter()
138138
// The ListView is always filled with a (filtered) copy of _inputSource.
139139
// We listen for `MarkChanged` events on this filtered list and apply those changes up to _inputSource.
140140

141-
if (_listViewSource != null) {
141+
if (_listViewSource != null)
142+
{
142143
_listViewSource.MarkChanged -= ListViewSource_MarkChanged;
143144
_listViewSource = null;
144145
}
145146

146147
_listViewSource = new GridViewDataSource(GridViewHelpers.FilterData(_inputSource.GridViewRowList, _applicationData.Filter ?? string.Empty));
147-
_listViewSource.MarkChanged += ListViewSource_MarkChanged;
148+
_listViewSource.MarkChanged += ListViewSource_MarkChanged;
148149
_listView.Source = _listViewSource;
149150
}
150151

151-
private void ListViewSource_MarkChanged (object s, GridViewDataSource.RowMarkedEventArgs a)
152+
private void ListViewSource_MarkChanged(object s, GridViewDataSource.RowMarkedEventArgs a)
152153
{
153-
_inputSource.GridViewRowList[a.Row.OriginalIndex].IsMarked = a.Row.IsMarked;
154+
_inputSource.GridViewRowList[a.Row.OriginalIndex].IsMarked = a.Row.IsMarked;
154155
}
155156

156157
private void Accept()
@@ -243,7 +244,7 @@ private void AddStatusBar(bool visible)
243244
if (_applicationData.Verbose || _applicationData.Debug)
244245
{
245246
statusItems.Add(new StatusItem(Key.Null, $" v{_applicationData.ModuleVersion}", null));
246-
statusItems.Add(new StatusItem(Key.Null,
247+
statusItems.Add(new StatusItem(Key.Null,
247248
$"{Application.Driver} v{FileVersionInfo.GetVersionInfo(Assembly.GetAssembly(typeof(Application)).Location).ProductVersion}", null));
248249
}
249250

@@ -355,7 +356,7 @@ private void AddFilter(Window win)
355356
win.Add(_filterLabel, _filterField, filterErrorLabel);
356357

357358
_filterField.Text = _applicationData.Filter ?? string.Empty;
358-
_filterField.CursorPosition = _filterField.Text.Length;
359+
_filterField.CursorPosition = _filterField.Text.Length;
359360
}
360361

361362
private void AddHeaders(Window win, List<string> gridHeaders)
@@ -417,7 +418,7 @@ private void AddListView(Window win)
417418
_listView.Height = Dim.Fill();
418419
_listView.AllowsMarking = _applicationData.OutputMode != OutputModeOption.None;
419420
_listView.AllowsMultipleSelection = _applicationData.OutputMode == OutputModeOption.Multiple;
420-
_listView.AddKeyBinding (Key.Space, Command.ToggleChecked, Command.LineDown);
421+
_listView.AddKeyBinding(Key.Space, Command.ToggleChecked, Command.LineDown);
421422

422423
win.Add(_listView);
423424
}

src/Microsoft.PowerShell.ConsoleGuiTools/GridViewDataSource.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,18 @@ public void SetMark(int item, bool value)
3434
{
3535
var oldValue = GridViewRowList[item].IsMarked;
3636
GridViewRowList[item].IsMarked = value;
37-
var args = new RowMarkedEventArgs() {
37+
var args = new RowMarkedEventArgs()
38+
{
3839
Row = GridViewRowList[item],
3940
OldValue = oldValue
4041
};
4142
MarkChanged?.Invoke(this, args);
4243
}
4344

44-
public class RowMarkedEventArgs : EventArgs {
45-
public GridViewRow Row { get; set;}
46-
public bool OldValue { get ; set;}
45+
public class RowMarkedEventArgs : EventArgs
46+
{
47+
public GridViewRow Row { get; set; }
48+
public bool OldValue { get; set; }
4749

4850
}
4951

@@ -53,7 +55,7 @@ public IList ToList()
5355
{
5456
return GridViewRowList;
5557
}
56-
58+
5759
// A slightly adapted method from gui.cs: https://github.com/migueldeicaza/gui.cs/blob/fc1faba7452ccbdf49028ac49f0c9f0f42bbae91/Terminal.Gui/Views/ListView.cs#L433-L461
5860
private void RenderUstr(ConsoleDriver driver, ustring ustr, int col, int line, int width)
5961
{

src/Microsoft.PowerShell.ConsoleGuiTools/OutConsoleGridviewCmdletCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class OutConsoleGridViewCmdletCommand : PSCmdlet, IDisposable
4949
/// <summary>
5050
/// gets or sets the initial value for the filter in the GUI
5151
/// </summary>
52-
[Parameter(HelpMessage = "Pre-populates the Filter edit box, allowing filtering to be specified on the command line. The filter uses regular expressions." )]
52+
[Parameter(HelpMessage = "Pre-populates the Filter edit box, allowing filtering to be specified on the command line. The filter uses regular expressions.")]
5353
public string Filter { set; get; }
5454

5555
/// <summary>

src/Microsoft.PowerShell.ConsoleGuiTools/ShowObjectTreeCmdletCommand.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace OutGridView.Cmdlet
1515
public class ShowObjectTreeCmdletCommand : PSCmdlet, IDisposable
1616
{
1717
#region Properties
18-
18+
1919
private const string DataNotQualifiedForShowObjectTree = nameof(DataNotQualifiedForShowObjectTree);
2020
private const string EnvironmentNotSupportedForShowObjectTree = nameof(EnvironmentNotSupportedForShowObjectTree);
2121

@@ -41,7 +41,7 @@ public class ShowObjectTreeCmdletCommand : PSCmdlet, IDisposable
4141
/// <summary>
4242
/// gets or sets the initial value for the filter in the GUI
4343
/// </summary>
44-
[Parameter(HelpMessage = "Pre-populates the Filter edit box, allowing filtering to be specified on the command line. The filter uses regular expressions." )]
44+
[Parameter(HelpMessage = "Pre-populates the Filter edit box, allowing filtering to be specified on the command line. The filter uses regular expressions.")]
4545
public string Filter { set; get; }
4646

4747
/// <summary>
@@ -143,13 +143,13 @@ protected override void EndProcessing()
143143
Debug = Debug,
144144
ModuleVersion = MyInvocation.MyCommand.Version.ToString()
145145
};
146-
146+
147147
ShowObjectView.Run(_psObjects, applicationData);
148148
}
149149

150150
public void Dispose()
151151
{
152-
152+
153153
}
154154
}
155155
}

0 commit comments

Comments
 (0)