Skip to content

Commit 15a654e

Browse files
committed
Upgraded to AsyncPackage, fixed manifest
1 parent 77c360c commit 15a654e

File tree

4 files changed

+16
-26
lines changed

4 files changed

+16
-26
lines changed

ArrayVisualizer.sln

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.30517.126
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31825.309
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WinForms", "WinForms", "{A61C476F-0130-40D7-9D34-BD914E2865E0}"
77
EndProject

ArrayVisualizerExt/ArrayVisualizerExtPackage.cs

+12-23
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,21 @@
33
using System.Diagnostics;
44
using System.Globalization;
55
using System.Runtime.InteropServices;
6+
using System.Threading;
7+
using System.Threading.Tasks;
68
using Microsoft.VisualStudio;
79
using Microsoft.VisualStudio.Shell;
810
using Microsoft.VisualStudio.Shell.Interop;
911

1012
namespace ArrayVisualizerExt
1113
{
12-
/// <summary>
13-
/// This is the class that implements the package exposed by this assembly.
14-
///
15-
/// The minimum requirement for a class to be considered a valid package for Visual Studio
16-
/// is to implement the IVsPackage interface and register itself with the shell.
17-
/// This package uses the helper classes defined inside the Managed Package Framework (MPF)
18-
/// to do it: it derives from the Package class that provides the implementation of the
19-
/// IVsPackage interface and uses the registration attributes defined in the framework to
20-
/// register itself and its components with the shell.
21-
/// </summary>
22-
// This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is
23-
// a package.
24-
[PackageRegistration(UseManagedResourcesOnly = true)]
25-
// This attribute is used to register the information needed to show the this package
26-
// in the Help/About dialog of Visual Studio.
14+
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
2715
[InstalledProductRegistration("Array Visualizer",
28-
"Visualizes 1D, 2D, 3D and 4D arrays and SharpDX Vectors and Matrices", "1.0", IconResourceID = 400)]
29-
// This attribute is needed to let the shell know that this package exposes some menus.
16+
"Visualizes 1D, 2D, 3D and 4D arrays and SharpDX Vectors and Matrices", "1.7", IconResourceID = 400)]
3017
[ProvideMenuResource("Menus.ctmenu", 1)]
31-
// This attribute registers a tool window exposed by this package.
3218
[ProvideToolWindow(typeof(ArrayVisualizerToolWindow))]
3319
[Guid(GuidList.GuidArrayVisualizerExtPkgString)]
34-
public sealed class ArrayVisualizerExtPackage : Package
20+
public sealed class ArrayVisualizerExtPackage : AsyncPackage
3521
{
3622
/// <summary>
3723
/// Default constructor of the package.
@@ -77,20 +63,23 @@ private void ShowToolWindow(object sender, EventArgs e)
7763
/// Initialization of the package; this method is called right after the package is sited, so this is the place
7864
/// where you can put all the initialization code that rely on services provided by VisualStudio.
7965
/// </summary>
80-
protected override void Initialize()
66+
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
8167
{
8268
Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}",
8369
ToString()));
84-
base.Initialize();
70+
Initialize();
71+
72+
progress.Report(new ServiceProgressData("Registering menu commands for ArrayVisualizer."));
8573

8674
// Add our command handlers for menu (commands must exist in the .vsct file)
87-
ThreadHelper.ThrowIfNotOnUIThread();
88-
if (GetService(typeof(IMenuCommandService)) is OleMenuCommandService mcs)
75+
if (await GetServiceAsync(typeof(IMenuCommandService)) is OleMenuCommandService mcs)
8976
{
9077
// Create the command for the tool window
9178
CommandID toolwndCommandId = new CommandID(GuidList.GuidArrayVisualizerExtCmdSet,
9279
(int) PkgCmdIdList.ArrayVisualizerTool);
9380
MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandId);
81+
82+
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
9483
mcs.AddCommand(menuToolWin);
9584
//GlobalVars.menuToolWin = menuToolWin;
9685
}

ArrayVisualizerExt/RELEASENOTES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Version 1.7.0.0:
22
- Upgraded for Visual Studio 2022
33
- Dropped support for any older Visual Studio versions (please use v1.6 for those) due to the x64 architecture
44
- Upgraded to .NET 4.8
5+
- Upgraded to AsyncPackage
56

67
Version 1.6.0.0:
78
- Upgraded for Visual Studio 2019

ArrayVisualizerExt/source.extension.vsixmanifest

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</InstallationTarget>
2727
</Installation>
2828
<Dependencies>
29-
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.7.2,)" />
29+
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.8,)" />
3030
</Dependencies>
3131
<Assets>
3232
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%"

0 commit comments

Comments
 (0)