Skip to content

Commit 8aa2b49

Browse files
authored
Merge pull request #4 from Romanitho/enter-key
Added Enter Key on search and check buttons
2 parents a2bf75b + a6f6500 commit 8aa2b49

File tree

2 files changed

+85
-56
lines changed

2 files changed

+85
-56
lines changed

Compiler/ps2exe.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
$Path = Split-Path $PSScriptRoot -Parent
66
$Icon = "$Path\sources\WingetIntunePackager.ico"
77
$Title = "WingetIntunePackager"
8-
$AppVersion = "1.1.2"
8+
$AppVersion = "1.1.3"
99
$InputFile = "$Path\sources\$Title.ps1"
1010
$OutputFile = "$Path\Compiler\$Title.exe"
1111
Invoke-ps2exe -inputFile $InputFile -outputFile $OutputFile -noConsole -title $Title -version $AppVersion -copyright "Romanitho" -product $Title -icon $Icon -noerror #-requireAdmin

sources/WingetIntunePackager.ps1

Lines changed: 84 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ https://github.com/Romanitho/Winget-Intune-Packager
99
### APP INFO ###
1010

1111
#Winget Intune Packager version
12-
$Script:WingetIntunePackager = "1.1.2"
12+
$Script:WingetIntunePackager = "1.1.3"
1313
#Winget-Install Github Link
1414
$Script:WIGithubLink = "https://github.com/Romanitho/Winget-Install/archive/refs/tags/v1.10.1.zip"
1515
#Winget Intune Packager Icon Base64
@@ -42,7 +42,7 @@ function Start-InstallGUI {
4242
</Grid.Background>
4343
<Label x:Name="SearchLabel" Content="Search for an app on Winget Repo:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,10,0,0"/>
4444
<TextBox x:Name="SearchTextBox" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,36,0,0" Width="570" Height="24" VerticalContentAlignment="Center"/>
45-
<Button x:Name="SearchButton" Content="Search" HorizontalAlignment="Right" VerticalAlignment="Top" Width="90" Height="24" Margin="0,36,10,0" IsDefault="True"/>
45+
<Button x:Name="SearchButton" Content="Search" HorizontalAlignment="Right" VerticalAlignment="Top" Width="90" Height="24" Margin="0,36,10,0"/>
4646
<Label x:Name="SubmitLabel" Content="Select the matching Winget AppID (--id):" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,70,0,0"/>
4747
<Button x:Name="CheckButton" Content="Check" HorizontalAlignment="Right" VerticalAlignment="Top" Width="90" Height="24" Margin="0,96,10,0"/>
4848
<Button x:Name="IconButton" Content="Select Icon" HorizontalAlignment="Right" Width="90" Height="24" Margin="0,250,10,0" VerticalAlignment="Top"/>
@@ -103,50 +103,71 @@ function Start-InstallGUI {
103103

104104
### FORM ACTIONS ###
105105

106+
$SearchButtonAction = {
107+
if ($SearchTextBox.Text) {
108+
$IDComboBox.Items.Clear()
109+
Start-PopUp "Searching..."
110+
$IDComboBox.Foreground = "Black"
111+
$IDComboBox.Tag = $null
112+
$AppIcon.Source = $null
113+
$IntuneDescriptionTextBox.Text = $null
114+
$List = Get-WingetAppList $SearchTextBox.Text
115+
foreach ($L in $List) {
116+
$IDComboBox.Items.Add($L.ID)
117+
}
118+
$IDComboBox.SelectedIndex = 0
119+
Close-PopUp
120+
}
121+
}
106122
$SearchButton.add_click({
107-
if ($SearchTextBox.Text) {
108-
$IDComboBox.Items.Clear()
109-
Start-PopUp "Searching..."
110-
$IDComboBox.Foreground = "Black"
111-
$IDComboBox.Tag = $null
112-
$AppIcon.Source = $null
113-
$IntuneDescriptionTextBox.Text = $null
114-
$List = Get-WingetAppList $SearchTextBox.Text
115-
foreach ($L in $List) {
116-
$IDComboBox.Items.Add($L.ID)
117-
}
118-
$IDComboBox.SelectedIndex = 0
119-
Close-PopUp
123+
& $SearchButtonAction
124+
})
125+
$SearchTextBox.add_keydown({
126+
if ($_.Key -eq "Enter") {
127+
& $SearchButtonAction
120128
}
121129
})
122130

123-
$CheckButton.add_click({
124-
if ($IDComboBox.text) {
125-
$IntuneDescriptionTextBox.Text = ""
126-
Start-PopUp "Checking..."
127-
Get-WingetAppInfo $IDComboBox.Text $VersionTextBox.Text
128-
if ($AppInfo.id) {
129-
if ($AppInfo.Description) {
130-
$IntuneDescriptionTextBox.Text = $AppInfo.Description
131-
}
132-
else {
133-
$IntuneDescriptionTextBox.Text = $AppInfo.ShortDescription
134-
}
135-
$IDComboBox.Foreground = "Green"
136-
$IDComboBox.Tag = "Ok"
137-
$VersionTextBox.Foreground = "Green"
138-
$AppIcon.Source = $AppInfo.Icon
139-
if ($ConnectionStatusTextBlock.Tag -eq "Ok") {
140-
$CreateButton.IsEnabled = $true
141-
}
131+
$CheckButtonAction = {
132+
if ($IDComboBox.text) {
133+
$IntuneDescriptionTextBox.Text = ""
134+
Start-PopUp "Checking..."
135+
Get-WingetAppInfo $IDComboBox.Text $VersionTextBox.Text
136+
if ($AppInfo.id) {
137+
if ($AppInfo.Description) {
138+
$IntuneDescriptionTextBox.Text = $AppInfo.Description
142139
}
143140
else {
144-
$IDComboBox.Foreground = "Red"
145-
$IDComboBox.Tag = $null
146-
$VersionTextBox.Foreground = "Red"
147-
$CreateButton.IsEnabled = $false
141+
$IntuneDescriptionTextBox.Text = $AppInfo.ShortDescription
142+
}
143+
$IDComboBox.Foreground = "Green"
144+
$IDComboBox.Tag = "Ok"
145+
$VersionTextBox.Foreground = "Green"
146+
$AppIcon.Source = $AppInfo.Icon
147+
if ($ConnectionStatusTextBlock.Tag -eq "Ok") {
148+
$CreateButton.IsEnabled = $true
148149
}
149-
Close-PopUp
150+
}
151+
else {
152+
$IDComboBox.Foreground = "Red"
153+
$IDComboBox.Tag = $null
154+
$VersionTextBox.Foreground = "Red"
155+
$CreateButton.IsEnabled = $false
156+
}
157+
Close-PopUp
158+
}
159+
}
160+
$CheckButton.add_click({
161+
& $CheckButtonAction
162+
})
163+
$VersionTextBox.add_keydown({
164+
if ($_.Key -eq "Enter") {
165+
& $CheckButtonAction
166+
}
167+
})
168+
$IDComboBox.add_keydown({
169+
if ($_.Key -eq "Enter") {
170+
& $CheckButtonAction
150171
}
151172
})
152173

@@ -161,24 +182,32 @@ function Start-InstallGUI {
161182
$AppIcon.Source = $AppInfo.Icon = $null
162183
})
163184

164-
$ConnectButton.add_click({
165-
Start-PopUp "Connecting..."
166-
$ConnectionStatus = Connect-MSIntuneGraph -TenantID $IntuneTenantIDTextbox.Text
167-
if ($ConnectionStatus.ExpiresOn) {
168-
$ConnectionStatusTextBlock.Foreground = "Green"
169-
$ConnectionStatusTextBlock.Text = "Connection expires on: $($ConnectionStatus.ExpiresOn.ToLocalTime())"
170-
$ConnectionStatusTextBlock.Tag = "Ok"
171-
if ($IDComboBox.Tag -eq "Ok") {
172-
$CreateButton.IsEnabled = $true
173-
}
185+
$ConnectButtonAction = {
186+
Start-PopUp "Connecting..."
187+
$ConnectionStatus = Connect-MSIntuneGraph -TenantID $IntuneTenantIDTextbox.Text
188+
if ($ConnectionStatus.ExpiresOn) {
189+
$ConnectionStatusTextBlock.Foreground = "Green"
190+
$ConnectionStatusTextBlock.Text = "Connection expires on: $($ConnectionStatus.ExpiresOn.ToLocalTime())"
191+
$ConnectionStatusTextBlock.Tag = "Ok"
192+
if ($IDComboBox.Tag -eq "Ok") {
193+
$CreateButton.IsEnabled = $true
174194
}
175-
else {
176-
$ConnectionStatusTextBlock.Foreground = "Red"
177-
$ConnectionStatusTextBlock.Text = "Not connected."
178-
$ConnectionStatusTextBlock.Tag = $null
179-
$CreateButton.IsEnabled = $false
195+
}
196+
else {
197+
$ConnectionStatusTextBlock.Foreground = "Red"
198+
$ConnectionStatusTextBlock.Text = "Not connected."
199+
$ConnectionStatusTextBlock.Tag = $null
200+
$CreateButton.IsEnabled = $false
201+
}
202+
Close-PopUp
203+
}
204+
$ConnectButton.add_click({
205+
& $ConnectButtonAction
206+
})
207+
$IntuneTenantIDTextbox.add_keydown({
208+
if ($_.Key -eq "Enter") {
209+
& $ConnectButtonAction
180210
}
181-
Close-PopUp
182211
})
183212

184213
$HelpWhitelistLabel.Add_PreviewMouseDown({

0 commit comments

Comments
 (0)