Skip to content

Commit b0c2d0d

Browse files
committed
Updated help in all templates
Updated the help for the template files so that they all follow the same format.
1 parent 5f2b959 commit b0c2d0d

File tree

24 files changed

+1038
-1178
lines changed

24 files changed

+1038
-1178
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,70 @@
1-
function Update-ListBox
2-
{
3-
<#
4-
.SYNOPSIS
5-
This functions helps you load items into a ListBox or CheckedListBox.
6-
7-
.DESCRIPTION
8-
Use this function to dynamically load items into the ListBox control.
9-
10-
.PARAMETER ListBox
11-
The ListBox control you want to add items to.
12-
13-
.PARAMETER Items
14-
The object or objects you wish to load into the ListBox's Items collection.
15-
16-
.PARAMETER DisplayMember
17-
Indicates the property to display for the items in this control.
18-
19-
.PARAMETER Append
20-
Adds the item(s) to the ListBox without clearing the Items collection.
21-
22-
.EXAMPLE
23-
Update-ListBox $ListBox1 "Red", "White", "Blue"
24-
25-
.EXAMPLE
26-
Update-ListBox $listBox1 "Red" -Append
27-
Update-ListBox $listBox1 "White" -Append
28-
Update-ListBox $listBox1 "Blue" -Append
29-
30-
.EXAMPLE
31-
Update-ListBox $listBox1 (Get-Process) "ProcessName"
32-
33-
.NOTES
34-
Additional information about the function.
1+
<#
2+
.SYNOPSIS
3+
This functions helps you load items into a ListBox or CheckedListBox.
4+
5+
.DESCRIPTION
6+
Use this function to dynamically load items into the ListBox control.
7+
8+
.PARAMETER ListBox
9+
The ListBox control you want to add items to.
10+
11+
.PARAMETER Items
12+
The object or objects you wish to load into the ListBox's Items collection.
13+
14+
.PARAMETER DisplayMember
15+
Indicates the property to display for the items in this control.
16+
17+
.PARAMETER Append
18+
Adds the item(s) to the ListBox without clearing the Items collection.
19+
20+
.EXAMPLE
21+
Update-ListBox $ListBox1 "Red", "White", "Blue"
22+
23+
.EXAMPLE
24+
Update-ListBox $listBox1 "Red" -Append
25+
Update-ListBox $listBox1 "White" -Append
26+
Update-ListBox $listBox1 "Blue" -Append
27+
28+
.EXAMPLE
29+
Update-ListBox $listBox1 (Get-Process) "ProcessName"
30+
31+
.NOTES
32+
Additional information about the function.
3533
#>
34+
function Update-ListBox {
35+
param
36+
(
37+
[Parameter(Mandatory = $true)]
38+
[ValidateNotNull()]
39+
[System.Windows.Forms.ListBox]
40+
$ListBox,
41+
[Parameter(Mandatory = $true)]
42+
[ValidateNotNull()]
43+
$Items,
44+
[Parameter(Mandatory = $false)]
45+
[string]
46+
$DisplayMember,
47+
[switch]
48+
$Append
49+
)
3650

37-
param
38-
(
39-
[Parameter(Mandatory = $true)]
40-
[ValidateNotNull()]
41-
[System.Windows.Forms.ListBox]
42-
$ListBox,
43-
[Parameter(Mandatory = $true)]
44-
[ValidateNotNull()]
45-
$Items,
46-
[Parameter(Mandatory = $false)]
47-
[string]
48-
$DisplayMember,
49-
[switch]
50-
$Append
51-
)
52-
53-
if (-not $Append)
54-
{
55-
$listBox.Items.Clear()
56-
}
51+
if (-not $Append) {
52+
$listBox.Items.Clear()
53+
}
5754

58-
if ($Items -is [System.Windows.Forms.ListBox+ObjectCollection])
59-
{
60-
$listBox.Items.AddRange($Items)
61-
}
62-
elseif ($Items -is [Array])
63-
{
64-
$listBox.BeginUpdate()
65-
foreach ($obj in $Items)
66-
{
67-
$listBox.Items.Add($obj)
68-
}
69-
$listBox.EndUpdate()
70-
}
71-
else
72-
{
73-
$listBox.Items.Add($Items)
74-
}
55+
if ($Items -is [System.Windows.Forms.ListBox+ObjectCollection]) {
56+
$listBox.Items.AddRange($Items)
57+
}
58+
elseif ($Items -is [Array]) {
59+
$listBox.BeginUpdate()
60+
foreach ($obj in $Items) {
61+
$listBox.Items.Add($obj)
62+
}
63+
$listBox.EndUpdate()
64+
}
65+
else {
66+
$listBox.Items.Add($Items)
67+
}
7568

76-
$listBox.DisplayMember = $DisplayMember
77-
}
69+
$listBox.DisplayMember = $DisplayMember
70+
}
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,69 @@
1-
function Update-ComboBox
2-
{
3-
<#
4-
.SYNOPSIS
5-
This functions helps you load items into a ComboBox.
6-
7-
.DESCRIPTION
8-
Use this function to dynamically load items into the ComboBox control.
9-
10-
.PARAMETER ComboBox
11-
The ComboBox control you want to add items to.
12-
13-
.PARAMETER Items
14-
The object or objects you wish to load into the ComboBox's Items collection.
15-
16-
.PARAMETER DisplayMember
17-
Indicates the property to display for the items in this control.
18-
19-
.PARAMETER Append
20-
Adds the item(s) to the ComboBox without clearing the Items collection.
21-
22-
.EXAMPLE
23-
Update-ComboBox $combobox1 "Red", "White", "Blue"
24-
25-
.EXAMPLE
26-
Update-ComboBox $combobox1 "Red" -Append
27-
Update-ComboBox $combobox1 "White" -Append
28-
Update-ComboBox $combobox1 "Blue" -Append
29-
30-
.EXAMPLE
31-
Update-ComboBox $combobox1 (Get-Process) "ProcessName"
32-
33-
.NOTES
34-
Additional information about the function.
1+
<#
2+
.SYNOPSIS
3+
This functions helps you load items into a ComboBox.
4+
5+
.DESCRIPTION
6+
Use this function to dynamically load items into the ComboBox control.
7+
8+
.PARAMETER ComboBox
9+
The ComboBox control you want to add items to.
10+
11+
.PARAMETER Items
12+
The object or objects you wish to load into the ComboBox's Items collection.
13+
14+
.PARAMETER DisplayMember
15+
Indicates the property to display for the items in this control.
16+
17+
.PARAMETER Append
18+
Adds the item(s) to the ComboBox without clearing the Items collection.
19+
20+
.EXAMPLE
21+
Update-ComboBox $combobox1 "Red", "White", "Blue"
22+
23+
.EXAMPLE
24+
Update-ComboBox $combobox1 "Red" -Append
25+
Update-ComboBox $combobox1 "White" -Append
26+
Update-ComboBox $combobox1 "Blue" -Append
27+
28+
.EXAMPLE
29+
Update-ComboBox $combobox1 (Get-Process) "ProcessName"
30+
31+
.NOTES
32+
Additional information about the function.
3533
#>
34+
function Update-ComboBox {
35+
param (
36+
[Parameter(Mandatory = $true)]
37+
[ValidateNotNull()]
38+
[System.Windows.Forms.ComboBox]
39+
$ComboBox,
40+
[Parameter(Mandatory = $true)]
41+
[ValidateNotNull()]
42+
$Items,
43+
[Parameter(Mandatory = $false)]
44+
[string]
45+
$DisplayMember,
46+
[switch]
47+
$Append
48+
)
3649

37-
param
38-
(
39-
[Parameter(Mandatory = $true)]
40-
[ValidateNotNull()]
41-
[System.Windows.Forms.ComboBox]
42-
$ComboBox,
43-
[Parameter(Mandatory = $true)]
44-
[ValidateNotNull()]
45-
$Items,
46-
[Parameter(Mandatory = $false)]
47-
[string]
48-
$DisplayMember,
49-
[switch]
50-
$Append
51-
)
52-
53-
if (-not $Append)
54-
{
55-
$ComboBox.Items.Clear()
56-
}
50+
if (-not $Append) {
51+
$ComboBox.Items.Clear()
52+
}
5753

58-
if ($Items -is [Object[]])
59-
{
60-
$ComboBox.Items.AddRange($Items)
61-
}
62-
elseif ($Items -is [System.Collections.IEnumerable])
63-
{
64-
$ComboBox.BeginUpdate()
65-
foreach ($obj in $Items)
66-
{
67-
$ComboBox.Items.Add($obj)
68-
}
69-
$ComboBox.EndUpdate()
70-
}
71-
else
72-
{
73-
$ComboBox.Items.Add($Items)
74-
}
54+
if ($Items -is [Object[]]) {
55+
$ComboBox.Items.AddRange($Items)
56+
}
57+
elseif ($Items -is [System.Collections.IEnumerable]) {
58+
$ComboBox.BeginUpdate()
59+
foreach ($obj in $Items) {
60+
$ComboBox.Items.Add($obj)
61+
}
62+
$ComboBox.EndUpdate()
63+
}
64+
else {
65+
$ComboBox.Items.Add($Items)
66+
}
7567

76-
$ComboBox.DisplayMember = $DisplayMember
77-
}
68+
$ComboBox.DisplayMember = $DisplayMember
69+
}

0 commit comments

Comments
 (0)