display installed version in details
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Godot;
|
||||
using SharpIDE.Application.Features.Evaluation;
|
||||
using SharpIDE.Application.Features.Nuget;
|
||||
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
||||
|
||||
@@ -43,6 +44,7 @@ public partial class NugetPackageDetails : VBoxContainer
|
||||
});
|
||||
var (iconBytes, iconFormat) = await iconTask;
|
||||
var imageTexture = ImageTextureHelper.GetImageTextureFromBytes(iconBytes, iconFormat) ?? _defaultIconTextureRect;
|
||||
await SetProjects(package.InstalledNugetPackageInfo!.ProjectPackageReferences);
|
||||
await this.InvokeAsync(() =>
|
||||
{
|
||||
_packageIconTextureRect.Texture = imageTexture;
|
||||
@@ -58,12 +60,14 @@ public partial class NugetPackageDetails : VBoxContainer
|
||||
});
|
||||
}
|
||||
|
||||
public async Task SetProjects(HashSet<SharpIdeProjectModel> projects)
|
||||
public async Task SetProjects(List<ProjectPackageReference> projectPackageReferences)
|
||||
{
|
||||
var scenes = projects.Select(s =>
|
||||
var scenes = projectPackageReferences.Select(s =>
|
||||
{
|
||||
var scene = _packageDetailsProjectEntryScene.Instantiate<PackageDetailsProjectEntry>();
|
||||
scene.ProjectModel = s;
|
||||
scene.ProjectModel = s.Project;
|
||||
scene.InstalledVersion = s.InstalledVersion;
|
||||
scene.IsTransitive = s.IsTransitive;
|
||||
return scene;
|
||||
}).ToList();
|
||||
await this.InvokeAsync(() =>
|
||||
|
||||
@@ -72,7 +72,7 @@ public partial class NugetPanel : Control
|
||||
{
|
||||
if (_solution is null) throw new InvalidOperationException("Solution is null but should not be");
|
||||
_ = Task.GodotRun(() => SetSolutionOrProjectNameLabels(slnOrProject));
|
||||
_ = Task.GodotRun(() => SetDetailsProjects(slnOrProject));
|
||||
//_ = Task.GodotRun(() => SetDetailsProjects(slnOrProject));
|
||||
_ = Task.GodotRun(() => PopulateInstalledPackages(slnOrProject));
|
||||
_ = Task.GodotRun(PopulateSearchResults);
|
||||
});
|
||||
@@ -91,7 +91,7 @@ public partial class NugetPanel : Control
|
||||
SharpIdeProjectModel projectModel => [projectModel],
|
||||
_ => throw new InvalidOperationException("Unknown solution or project type")
|
||||
};
|
||||
await _nugetPackageDetails.SetProjects(projects);
|
||||
//await _nugetPackageDetails.SetProjects(projects);
|
||||
}
|
||||
|
||||
private async Task SetSolutionOrProjectNameLabels(ISolutionOrProject slnOrProject)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Godot;
|
||||
using NuGet.Versioning;
|
||||
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
||||
|
||||
namespace SharpIDE.Godot.Features.Nuget;
|
||||
@@ -9,7 +10,8 @@ public partial class PackageDetailsProjectEntry : MarginContainer
|
||||
private Label _installedVersionLabel = null!;
|
||||
|
||||
public SharpIdeProjectModel ProjectModel { get; set; } = null!;
|
||||
public string InstalledVersion { get; set; } = string.Empty;
|
||||
public NuGetVersion? InstalledVersion { get; set; }
|
||||
public bool IsTransitive { get; set; }
|
||||
public override void _Ready()
|
||||
{
|
||||
_projectNameLabel = GetNode<Label>("%ProjectNameLabel");;
|
||||
@@ -21,6 +23,6 @@ public partial class PackageDetailsProjectEntry : MarginContainer
|
||||
{
|
||||
if (ProjectModel == null) return;
|
||||
_projectNameLabel.Text = ProjectModel.Name;
|
||||
_installedVersionLabel.Text = InstalledVersion;
|
||||
_installedVersionLabel.Text = IsTransitive ? $"({InstalledVersion?.ToNormalizedString()})" : InstalledVersion?.ToNormalizedString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user