forked from vsrad/radeon-asm-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Package.cs
53 lines (48 loc) · 2.18 KB
/
Package.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using VSRAD.Syntax.FunctionList.Commands;
using VSRAD.Syntax.Options;
using System;
using System.Runtime.InteropServices;
using System.Threading;
using Task = System.Threading.Tasks.Task;
using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
namespace VSRAD.Syntax
{
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[ProvideMenuResource("Menus.ctmenu", 1)]
[ProvideToolWindow(typeof(FunctionList.FunctionList))]
[ProvideOptionPage(typeof(OptionPage), Constants.RadeonAsmOptionsCategoryName, Constants.RadeonAsmOptionsBasePageName, 0, 0, true)]
[ProvideAutoLoad(UIContextGuids80.NoSolution, PackageAutoLoadFlags.BackgroundLoad)]
[ProvideAutoLoad(UIContextGuids80.SolutionExists, PackageAutoLoadFlags.BackgroundLoad)]
[ProvideAutoLoad(UIContextGuids80.SolutionHasMultipleProjects, PackageAutoLoadFlags.BackgroundLoad)]
[ProvideAutoLoad(UIContextGuids80.SolutionHasSingleProject, PackageAutoLoadFlags.BackgroundLoad)]
[Guid(Constants.PackageGuid)]
public sealed class Package : AsyncPackage
{
public static Package Instance { get; private set; }
private IComponentModel _componentModel;
public Package() { }
public OptionPage OptionPage
{
get
{
return GetDialogPage(typeof(OptionPage)) as OptionPage;
}
}
public T GetMEFComponent<T>() where T : class
{
return _componentModel.GetService<T>();
}
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{
Instance = this;
_componentModel = (await GetServiceAsync(typeof(SComponentModel))) as IComponentModel;
await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
await FunctionListCommand.InitializeAsync(this);
await ClearSearchFieldCommand.InitializeAsync(this);
await SelectItemCommand.InitializeAsync(this);
}
}
}