Skip to content

Commit 2019313

Browse files
committed
Added Get-SelectedVersionName to Module
1 parent 64ff09f commit 2019313

6 files changed

Lines changed: 44 additions & 7 deletions

File tree

GUI/Start-VSCodeUpdaterGUI.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function Get-SelectedVersionName {
2626
[object]$DataGrid
2727
)
2828

29-
if ($null -eq $DataGrid -or $null -eq $DataGrid.SelectedItem) {
29+
if (-not $DataGrid.SelectedItem) {
3030
return $null
3131
}
3232

GUI/VSCodeUpdaterGUI.xaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626

2727
<!-- STATUS -->
2828
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,10,0">
29+
<TextBlock x:Name="TxtStatus"
30+
FontSize="16"
31+
FontWeight="Bold"
32+
Foreground="Black"
33+
Margin="0,0,0,12"/>
2934
<TextBlock Text="Active Version:" FontWeight="Bold" FontSize="13" Foreground="Black"/>
3035
<TextBox x:Name="TxtActiveVersion" FontSize="12" IsReadOnly="True" BorderThickness="0" Background="Transparent"/>
3136
<TextBox x:Name="TxtSymlinkTarget" FontSize="12" IsReadOnly="True" BorderThickness="0" Background="Transparent"/>

Private/OutputHelpers.ps1

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ function Write-TerminalLine {
4444
$paragraph.Inlines.Add($run)
4545

4646
# ⭐ Add new lines at the top instead of the bottom
47-
$txtCommandOutput.Document.Blocks.InsertBefore(
48-
$txtCommandOutput.Document.Blocks.FirstBlock,
49-
$paragraph
50-
)
47+
$txtCommandOutput.Document.Blocks.Add($paragraph)
48+
$txtCommandOutput.CaretPosition = $txtCommandOutput.Document.ContentEnd
49+
$txtCommandOutput.ScrollToEnd()
5150

5251
# ⭐ Keep the caret at the start so the newest line is visible
5352
$txtCommandOutput.CaretPosition = $txtCommandOutput.Document.ContentStart

Public/Get-SelectedVersionName.ps1

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<#
2+
SPDX-License-Identifier: MIT
3+
Copyright (c) 2026 Leon McClatchey, Linktech Engineering LLC
4+
5+
Package: VSCode-Updater
6+
Author: Leon McClatchey
7+
Company: Linktech Engineering LLC
8+
Created: 2026-07-05
9+
Modified: 2026-07-05
10+
File: Get-SelectedVersionName.ps1
11+
Version: 1.0.0
12+
Description: Description goes here
13+
#>
14+
function Get-SelectedVersionName {
15+
[CmdletBinding()]
16+
param(
17+
[Parameter(Mandatory)]
18+
[object]$DataGrid
19+
)
20+
21+
if (-not $DataGrid.SelectedItem) {
22+
return $null
23+
}
24+
25+
$selectedItem = $DataGrid.SelectedItem
26+
if ($selectedItem.PSObject.Properties.Name -contains 'Name') {
27+
return [string]$selectedItem.Name
28+
}
29+
30+
return $null
31+
}

VSCode-Updater.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
'Start-VSCodeSafeMode',
2929
'Get-VSCodeDashboard',
3030
'Invoke-ZipFallback',
31-
'Get-VSCodeSymlinkInfo'
31+
'Get-VSCodeSymlinkInfo',
32+
'Get-SelectedVersionName'
3233
)
3334

3435
PrivateData = @{

VSCode-Updater.psm1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,4 +357,5 @@ Export-ModuleMember -Function Update-VSCode, `
357357
Start-VSCodeSafeMode, `
358358
Get-VSCodeDashboard, `
359359
Invoke-ZipFallback, `
360-
Get-VSCodeSymlinkInfo
360+
Get-VSCodeSymlinkInfo,`
361+
Get-SelectedVersionName

0 commit comments

Comments
 (0)