Skip to content

Commit

Permalink
Add loading message
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonz120 committed Nov 4, 2024
1 parent 1713e84 commit 54dca60
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private void DetailControlModel_PropertyChanged(object sender, PropertyChangedEv
{
NuGetUIThreadHelper.JoinableTaskFactory.RunAsync(async () =>
{
if (_readmeTabEnabled)
if (_readmeTabEnabled && e.PropertyName == nameof(DetailControlModel.PackageMetadata))
{
await ReadmePreviewViewModel.SetPackageMetadataAsync(DetailControlModel.PackageMetadata, CancellationToken.None);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public async Task SetPackageMetadataAsync(DetailedPackageMetadata packageMetadat
{
if (packageMetadata != null && (!string.Equals(packageMetadata.Id, _packageMetadata?.Id) || packageMetadata.Version != _packageMetadata?.Version))
{
ReadmeMarkdown = Resources.Text_Loading;
_packageMetadata = packageMetadata;
await LoadReadmeAsync(cancellationToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Windows;
using System.Windows.Controls;
using Microsoft.VisualStudio.Markdown.Platform;
using Microsoft.VisualStudio.Shell;
using NuGet.PackageManagement.UI.ViewModels;
using NuGet.VisualStudio;
using NuGet.VisualStudio.Telemetry;
Expand Down Expand Up @@ -39,7 +38,7 @@ private void ReadmeViewModel_PropertyChanged(object sender, PropertyChangedEvent
{
if (e.PropertyName == nameof(ReadmePreviewViewModel.ReadmeMarkdown))
{
NuGetUIThreadHelper.JoinableTaskFactory.Run(UpdateMarkdownAsync);
NuGetUIThreadHelper.JoinableTaskFactory.RunAsync(UpdateMarkdownAsync).PostOnFailure(nameof(PackageReadmeControl), nameof(ReadmeViewModel_PropertyChanged));
}
}

Expand Down Expand Up @@ -104,10 +103,8 @@ private void PackageReadmeControl_Unloaded(object sender, RoutedEventArgs e)

private void PackageReadmeControl_Loaded(object sender, RoutedEventArgs e)
{
ThreadHelper.JoinableTaskFactory.Run(async () =>
{
await UpdateMarkdownAsync();
});
NuGetUIThreadHelper.JoinableTaskFactory.RunAsync(UpdateMarkdownAsync)
.PostOnFailure(nameof(PackageReadmeControl), nameof(PackageReadmeControl_Loaded));
}
}
}

0 comments on commit 54dca60

Please sign in to comment.