diff --git a/TwinpackVsixShared/Dialogs/CatalogWindow.xaml b/TwinpackVsixShared/Dialogs/CatalogWindow.xaml index 47ceb8d..47e11b6 100644 --- a/TwinpackVsixShared/Dialogs/CatalogWindow.xaml +++ b/TwinpackVsixShared/Dialogs/CatalogWindow.xaml @@ -175,8 +175,10 @@ + d:Text="The path of the righteous man is beset on all sides by the iniquities of the asdf sdf asdf sdf asf asdf sf sdf asfd sdf sdf selfish and the tyranny of the evil men. Blessed is he who, in the name of charity and goodwill, shepherds the weak through the valley of darkness, for he is truly his brother's keeper, III" + TextWrapping="Wrap" + TextTrimming="WordEllipsis" + /> @@ -276,17 +278,6 @@ Users are advised to use packages at their own discretion and risk. - - - - - - - - - - - - + @@ -577,7 +568,7 @@ - diff --git a/TwinpackVsixShared/Dialogs/CatalogWindow.xaml.cs b/TwinpackVsixShared/Dialogs/CatalogWindow.xaml.cs index 3f36a6c..902b3d1 100644 --- a/TwinpackVsixShared/Dialogs/CatalogWindow.xaml.cs +++ b/TwinpackVsixShared/Dialogs/CatalogWindow.xaml.cs @@ -1224,16 +1224,17 @@ private async Task LoadNextCatalogPageAsync(string text = "", bool reset = false var results = await _twinpackServer.GetCatalogAsync(text, _currentCatalogPage, _itemsPerPage, cancellationToken); cancellationToken.ThrowIfCancellationRequested(); IsAvailablePackageAvailable = results.Item2; - - if (reset) - { - _availablePackages.Clear(); - } + bool newPackage = false; foreach (var item in results.Item1) { - _availablePackages.Add(new CatalogItem(item)); + if(!_availablePackages.Any(x => x.PackageId == item.PackageId)) + { + _availablePackages.Add(new CatalogItem(item)); + newPackage = true; + } } + IsAvailablePackageAvailable &= newPackage; _currentCatalogPage++; } @@ -1262,7 +1263,6 @@ private async Task LoadInstalledPackagesAsync(CancellationToken cancellationToke if (_plcConfig != null) { - _installedPackages.Clear(); foreach (var item in _plcConfig.Packages) { CatalogItem catalogItem = new CatalogItem(item); @@ -1271,7 +1271,8 @@ private async Task LoadInstalledPackagesAsync(CancellationToken cancellationToke if (packageVersion.PackageVersionId != null) catalogItem = new CatalogItem(packageVersion, item.Version); - _installedPackages.Add(catalogItem); + if(!_installedPackages.Any(x => x.PackageId == catalogItem.PackageId)) + _installedPackages.Add(catalogItem); } } @@ -1588,7 +1589,9 @@ public async void SearchTextBox_TextChanged(object sender, TextChangedEventArgs try { var text = ((TextBox)sender).Text; + UpdateCatalog(); + // this will only add additional items if (IsBrowsingAvailablePackages) { _searchText = text; @@ -1597,10 +1600,6 @@ public async void SearchTextBox_TextChanged(object sender, TextChangedEventArgs if (_searchText == text) await LoadAvailablePackagesAsync(text, Token); } - else - { - UpdateCatalog(); - } } catch (Exception ex) {