FormItems: add conversion from any list
This commit is contained in:
parent
56a27f6b9f
commit
816ef0abe0
1 changed files with 16 additions and 0 deletions
16
revanced.ps1
16
revanced.ps1
|
@ -65,6 +65,22 @@ class FormItems : System.Collections.ArrayList<#FormItem#> {
|
||||||
}
|
}
|
||||||
return $rvalue
|
return $rvalue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FormItems() {}
|
||||||
|
|
||||||
|
FormItems([System.Collections.IEnumerable] $list) {
|
||||||
|
<#
|
||||||
|
.Description
|
||||||
|
Creates FormItems list with all items in list
|
||||||
|
where values are those items
|
||||||
|
and displaytext as string representation of them
|
||||||
|
|
||||||
|
TLDR it converts any list to FormItems
|
||||||
|
#>
|
||||||
|
foreach ($i in $list) {
|
||||||
|
[void] $this.Add([FormItem]::new($i, $i.ToString()))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderForm([FormItems]$items, [String]$label, [String]$title, [System.Windows.Forms.SelectionMode]$mode) {
|
function renderForm([FormItems]$items, [String]$label, [String]$title, [System.Windows.Forms.SelectionMode]$mode) {
|
||||||
|
|
Reference in a new issue