From a6f6500c736bdd604d88add87ca4e9c0f8dd18ec Mon Sep 17 00:00:00 2001
From: romanitho <96626929+Romanitho@users.noreply.github.com>
Date: Thu, 6 Apr 2023 16:38:18 +0200
Subject: [PATCH] Added Enter Key on search and check button
---
Compiler/ps2exe.ps1 | 2 +-
sources/WingetIntunePackager.ps1 | 139 +++++++++++++++++++------------
2 files changed, 85 insertions(+), 56 deletions(-)
diff --git a/Compiler/ps2exe.ps1 b/Compiler/ps2exe.ps1
index da8dbd9..6878885 100644
--- a/Compiler/ps2exe.ps1
+++ b/Compiler/ps2exe.ps1
@@ -5,7 +5,7 @@
$Path = Split-Path $PSScriptRoot -Parent
$Icon = "$Path\sources\WingetIntunePackager.ico"
$Title = "WingetIntunePackager"
-$AppVersion = "1.1.2"
+$AppVersion = "1.1.3"
$InputFile = "$Path\sources\$Title.ps1"
$OutputFile = "$Path\Compiler\$Title.exe"
Invoke-ps2exe -inputFile $InputFile -outputFile $OutputFile -noConsole -title $Title -version $AppVersion -copyright "Romanitho" -product $Title -icon $Icon -noerror #-requireAdmin
diff --git a/sources/WingetIntunePackager.ps1 b/sources/WingetIntunePackager.ps1
index d8bc863..3a8f166 100644
--- a/sources/WingetIntunePackager.ps1
+++ b/sources/WingetIntunePackager.ps1
@@ -9,7 +9,7 @@ https://github.com/Romanitho/Winget-Intune-Packager
### APP INFO ###
#Winget Intune Packager version
-$Script:WingetIntunePackager = "1.1.2"
+$Script:WingetIntunePackager = "1.1.3"
#Winget-Install Github Link
$Script:WIGithubLink = "https://github.com/Romanitho/Winget-Install/archive/refs/tags/v1.10.1.zip"
#Winget Intune Packager Icon Base64
@@ -42,7 +42,7 @@ function Start-InstallGUI {
-
+
@@ -103,50 +103,71 @@ function Start-InstallGUI {
### FORM ACTIONS ###
+ $SearchButtonAction = {
+ if ($SearchTextBox.Text) {
+ $IDComboBox.Items.Clear()
+ Start-PopUp "Searching..."
+ $IDComboBox.Foreground = "Black"
+ $IDComboBox.Tag = $null
+ $AppIcon.Source = $null
+ $IntuneDescriptionTextBox.Text = $null
+ $List = Get-WingetAppList $SearchTextBox.Text
+ foreach ($L in $List) {
+ $IDComboBox.Items.Add($L.ID)
+ }
+ $IDComboBox.SelectedIndex = 0
+ Close-PopUp
+ }
+ }
$SearchButton.add_click({
- if ($SearchTextBox.Text) {
- $IDComboBox.Items.Clear()
- Start-PopUp "Searching..."
- $IDComboBox.Foreground = "Black"
- $IDComboBox.Tag = $null
- $AppIcon.Source = $null
- $IntuneDescriptionTextBox.Text = $null
- $List = Get-WingetAppList $SearchTextBox.Text
- foreach ($L in $List) {
- $IDComboBox.Items.Add($L.ID)
- }
- $IDComboBox.SelectedIndex = 0
- Close-PopUp
+ & $SearchButtonAction
+ })
+ $SearchTextBox.add_keydown({
+ if ($_.Key -eq "Enter") {
+ & $SearchButtonAction
}
})
- $CheckButton.add_click({
- if ($IDComboBox.text) {
- $IntuneDescriptionTextBox.Text = ""
- Start-PopUp "Checking..."
- Get-WingetAppInfo $IDComboBox.Text $VersionTextBox.Text
- if ($AppInfo.id) {
- if ($AppInfo.Description) {
- $IntuneDescriptionTextBox.Text = $AppInfo.Description
- }
- else {
- $IntuneDescriptionTextBox.Text = $AppInfo.ShortDescription
- }
- $IDComboBox.Foreground = "Green"
- $IDComboBox.Tag = "Ok"
- $VersionTextBox.Foreground = "Green"
- $AppIcon.Source = $AppInfo.Icon
- if ($ConnectionStatusTextBlock.Tag -eq "Ok") {
- $CreateButton.IsEnabled = $true
- }
+ $CheckButtonAction = {
+ if ($IDComboBox.text) {
+ $IntuneDescriptionTextBox.Text = ""
+ Start-PopUp "Checking..."
+ Get-WingetAppInfo $IDComboBox.Text $VersionTextBox.Text
+ if ($AppInfo.id) {
+ if ($AppInfo.Description) {
+ $IntuneDescriptionTextBox.Text = $AppInfo.Description
}
else {
- $IDComboBox.Foreground = "Red"
- $IDComboBox.Tag = $null
- $VersionTextBox.Foreground = "Red"
- $CreateButton.IsEnabled = $false
+ $IntuneDescriptionTextBox.Text = $AppInfo.ShortDescription
+ }
+ $IDComboBox.Foreground = "Green"
+ $IDComboBox.Tag = "Ok"
+ $VersionTextBox.Foreground = "Green"
+ $AppIcon.Source = $AppInfo.Icon
+ if ($ConnectionStatusTextBlock.Tag -eq "Ok") {
+ $CreateButton.IsEnabled = $true
}
- Close-PopUp
+ }
+ else {
+ $IDComboBox.Foreground = "Red"
+ $IDComboBox.Tag = $null
+ $VersionTextBox.Foreground = "Red"
+ $CreateButton.IsEnabled = $false
+ }
+ Close-PopUp
+ }
+ }
+ $CheckButton.add_click({
+ & $CheckButtonAction
+ })
+ $VersionTextBox.add_keydown({
+ if ($_.Key -eq "Enter") {
+ & $CheckButtonAction
+ }
+ })
+ $IDComboBox.add_keydown({
+ if ($_.Key -eq "Enter") {
+ & $CheckButtonAction
}
})
@@ -161,24 +182,32 @@ function Start-InstallGUI {
$AppIcon.Source = $AppInfo.Icon = $null
})
- $ConnectButton.add_click({
- Start-PopUp "Connecting..."
- $ConnectionStatus = Connect-MSIntuneGraph -TenantID $IntuneTenantIDTextbox.Text
- if ($ConnectionStatus.ExpiresOn) {
- $ConnectionStatusTextBlock.Foreground = "Green"
- $ConnectionStatusTextBlock.Text = "Connection expires on: $($ConnectionStatus.ExpiresOn.ToLocalTime())"
- $ConnectionStatusTextBlock.Tag = "Ok"
- if ($IDComboBox.Tag -eq "Ok") {
- $CreateButton.IsEnabled = $true
- }
+ $ConnectButtonAction = {
+ Start-PopUp "Connecting..."
+ $ConnectionStatus = Connect-MSIntuneGraph -TenantID $IntuneTenantIDTextbox.Text
+ if ($ConnectionStatus.ExpiresOn) {
+ $ConnectionStatusTextBlock.Foreground = "Green"
+ $ConnectionStatusTextBlock.Text = "Connection expires on: $($ConnectionStatus.ExpiresOn.ToLocalTime())"
+ $ConnectionStatusTextBlock.Tag = "Ok"
+ if ($IDComboBox.Tag -eq "Ok") {
+ $CreateButton.IsEnabled = $true
}
- else {
- $ConnectionStatusTextBlock.Foreground = "Red"
- $ConnectionStatusTextBlock.Text = "Not connected."
- $ConnectionStatusTextBlock.Tag = $null
- $CreateButton.IsEnabled = $false
+ }
+ else {
+ $ConnectionStatusTextBlock.Foreground = "Red"
+ $ConnectionStatusTextBlock.Text = "Not connected."
+ $ConnectionStatusTextBlock.Tag = $null
+ $CreateButton.IsEnabled = $false
+ }
+ Close-PopUp
+ }
+ $ConnectButton.add_click({
+ & $ConnectButtonAction
+ })
+ $IntuneTenantIDTextbox.add_keydown({
+ if ($_.Key -eq "Enter") {
+ & $ConnectButtonAction
}
- Close-PopUp
})
$HelpWhitelistLabel.Add_PreviewMouseDown({