Skip to content

Commit

Permalink
#232: Use $null = instead of | Out-Null
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobBertagnolli committed Oct 20, 2022
1 parent 6838a01 commit 6a458a4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions Files/DataStandard/CAD.Custom/addins/powerGateMain.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
$matrix = $Application.TransientGeometry.CreateMatrix()
$occur = $Document.ComponentDefinition.Occurrences
$occur.AddVirtual($number, $matrix)
ShowMessageBox -Message "Virtual Component '$number' successfully inserted." -Title "powerGate ERP - Virtual Component" -Icon "Information" | Out-Null
$null = ShowMessageBox -Message "Virtual Component '$number' successfully inserted." -Title "powerGate ERP - Virtual Component" -Icon "Information"
}
catch {
ShowMessageBox -Message "'$number' already exists. Please choose another ERP item." -Title "powerGate ERP - Virtual Component" -Icon "Warning" | Out-Null
$null = ShowMessageBox -Message "'$number' already exists. Please choose another ERP item." -Title "powerGate ERP - Virtual Component" -Icon "Warning"
}
}
if ($prop["_FileExt"].Value -eq ".IPT") {
$prop["Raw_Number"].Value = $number
$prop["Raw_Quantity"].Value = 1
ShowMessageBox -Message "Raw Material '$number' successfully inserted." -Title "powerGate ERP - Raw Material" -Icon "Information" | Out-Null
$null = ShowMessageBox -Message "Raw Material '$number' successfully inserted." -Title "powerGate ERP - Raw Material" -Icon "Information"
}
}
}
Expand Down Expand Up @@ -122,15 +122,15 @@ function CreateOrUpdateErpMaterial {
if ($? -eq $false) {
return
}
ShowMessageBox -Message "$($createErpMaterialResult.Number) successfully created" -Title "powerGate ERP - Create Material" -Icon "Information" | Out-Null
$null = ShowMessageBox -Message "$($createErpMaterialResult.Number) successfully created" -Title "powerGate ERP - Create Material" -Icon "Information"
SetEntityProperties -erpMaterial $createErpMaterialResult
}
else {
$updateErpMaterialResult = Update-ERPObject -EntitySet "Materials" -Key $materialTabContext.Entity._Keys -Properties $materialTabContext.Entity._Properties
if ($? -eq $false) {
return
}
ShowMessageBox -Message "$($updateErpMaterialResult.Number) successfully updated" -Title "powerGate ERP - Update Material" -Icon "Information" | Out-Null
$null = ShowMessageBox -Message "$($updateErpMaterialResult.Number) successfully updated" -Title "powerGate ERP - Update Material" -Icon "Information"
}

RefreshView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
Start-Process -FilePath C:\Windows\explorer.exe -ArgumentList "/select, ""$cfgPath"""
}
catch {
(ShowMessageBox -Message $_.Exception.Message -Button "OK" -Icon "Error") | Out-Null
($null = ShowMessageBox -Message $_.Exception.Message -Button "OK" -Icon "Error")
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
$cfgPath = "c:\temp\powerGateCfg\powerGateConfiguration.xml"
$testPath = Test-Path $cfgPath
if ($testPath -eq $false) {
ShowMessageBox -Message "No config file found in '$cfgPath' `n Please download/edit the config file first and then save it back to the Vault server!" -Button "OK" -Icon "Warning" | Out-Null
$null = ShowMessageBox -Message "No config file found in '$cfgPath' `n Please download/edit the config file first and then save it back to the Vault server!" -Button "OK" -Icon "Warning"
return
}
[byte[]]$cfg = [System.IO.File]::ReadAllBytes($cfgPath)
Set-PowerGateConfigFromVault -Content $cfg
ShowMessageBox -Message "Config file saved to Vault server" -Button "OK" -Icon "Information" | Out-Null
$null = ShowMessageBox -Message "Config file saved to Vault server" -Button "OK" -Icon "Information"


Remove-Item $cfgPath -Force
}
catch {
(ShowMessageBox -Message $_.Exception.Message -Button "OK" -Icon "Error") | Out-Null
($null = ShowMessageBox -Message $_.Exception.Message -Button "OK" -Icon "Error")
}
6 changes: 3 additions & 3 deletions Files/DataStandard/Vault.Custom/addinVault/powerGateMain.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function CreateOrUpdateErpMaterial {
return
}

ShowMessageBox -Message "$($createErpMaterialResult.Number) successfully created" -Title "powerGate ERP - Create Material" -Icon "Information" | Out-Null
$null = ShowMessageBox -Message "$($createErpMaterialResult.Number) successfully created" -Title "powerGate ERP - Create Material" -Icon "Information"
$vaultEntity = GetSelectedObject
SetEntityProperties -erpMaterial $createErpMaterialResult -vaultEntity $vaultEntity

Expand All @@ -136,7 +136,7 @@ function CreateOrUpdateErpMaterial {
if ($? -eq $false) {
return
}
ShowMessageBox -Message "$($updateErpMaterialResult.Number) successfully updated" -Title "powerGate ERP - Update Material" -Icon "Information" | Out-Null
$null = ShowMessageBox -Message "$($updateErpMaterialResult.Number) successfully updated" -Title "powerGate ERP - Update Material" -Icon "Information"
InitMaterialTab
}

Expand All @@ -162,7 +162,7 @@ function LinkErpMaterial {
$existingEntity = Get-VaultItem -Number $erpMaterial.Number
if ($existingEntity) {
if ($existingEntity.MasterId -ne $vaultEntity.MasterId) {
ShowMessageBox -Message "The ERP item $($erpMaterial.Number) cannot be assigned!`nAn item with an item number $($existingEntity._Number) already exists." -Button "Ok" -Icon "Warning" | Out-Null
$null = ShowMessageBox -Message "The ERP item $($erpMaterial.Number) cannot be assigned!`nAn item with an item number $($existingEntity._Number) already exists." -Button "Ok" -Icon "Warning"
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion Files/powerGate/Modules/Communication.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function ConnectToErpServerWithMessageBox {
Log -Begin
$powerGateServerErpPluginUrl = CreateUrlFromPGServerName
if (-not $powerGateServerErpPluginUrl){
ShowMessageBox -Message "The current connected VAULT $($vaultConnection.Vault) is not mapped in the configuration for any ERP.`nChange the configuration and restart vault!" -Icon Error | Out-Null
$null = ShowMessageBox -Message "The current connected VAULT $($vaultConnection.Vault) is not mapped in the configuration for any ERP.`nChange the configuration and restart vault!" -Icon Error
}
else {
Write-Host "Connecting with URL: $powerGateServerErpPluginUrl"
Expand Down

0 comments on commit 6a458a4

Please sign in to comment.