Skip to content

Commit

Permalink
fix: when a deactivated package is installed in a specific version (n…
Browse files Browse the repository at this point in the history
…ot as placeholder), selecting a branch where the package is available would by default install as placeholder

(cherry picked from commit c517951)
  • Loading branch information
iadonkey committed Jul 24, 2024
1 parent 6a9ee31 commit 3a737fd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions TwinpackVsixShared/Dialogs/CatalogWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Microsoft.VisualStudio.PlatformUI;
using Microsoft.VisualStudio.Threading;
using NLog;
using TCatSysManagerLib;
Expand Down Expand Up @@ -1237,7 +1238,7 @@ private async Task LoadNextPackageVersionsPageAsync(bool reset = false, Cancella
new PlcVersion
{
Version = null,
VersionDisplayText = "Latest " + (results?.Item1?.Any() == true ? "(" + results.Item1.First().Version + ")" : "" )
VersionDisplayText = "Latest"
}
};

Expand Down Expand Up @@ -1533,21 +1534,20 @@ private async void PackageFilter_SelectionChanged(object sender, SelectionChange

if(Versions?.Any(x => x.Version != null) == true)
{

var index = Versions?.FindIndex(x => x.Version == _catalogItem?.Installed?.Version) ?? -1;
if (_catalogItem?.IsPlaceholder == true || (index < 0 && _catalogItem?.Installed != null))
if (_catalogItem?.IsPlaceholder == true)
index = 0;
else if (index < 0 && _catalogItem?.Installed != null)
index = Versions.Count > 1 ? 1 : 0;

VersionsView.IsEnabled = true;
VersionsView.SelectedIndex = string.IsNullOrEmpty(_catalogItem?.Installed?.Version) ? 1 : index;
VersionsView.SelectedIndex = index;
}
else
{
VersionsView.IsEnabled = false;
VersionsView.SelectedIndex = -1;
}


}
catch (OperationCanceledException ex)
{
Expand Down

0 comments on commit 3a737fd

Please sign in to comment.