github.com/ijc/docker-app@v0.6.1-0.20181012090447-c7ca8bc483fb/integrations/visualstudio/dockerappvsix/DockerAppPackage.cs (about) 1 using System; 2 using System.ComponentModel.Design; 3 using System.Diagnostics; 4 using System.Diagnostics.CodeAnalysis; 5 using System.Globalization; 6 using System.Runtime.InteropServices; 7 using System.Threading; 8 using System.Threading.Tasks; 9 using Microsoft.VisualStudio; 10 using Microsoft.VisualStudio.OLE.Interop; 11 using Microsoft.VisualStudio.Shell; 12 using Microsoft.VisualStudio.Shell.Interop; 13 using Microsoft.Win32; 14 using Task = System.Threading.Tasks.Task; 15 16 namespace dockerappvsix 17 { 18 /// <summary> 19 /// This is the class that implements the package exposed by this assembly. 20 /// </summary> 21 /// <remarks> 22 /// <para> 23 /// The minimum requirement for a class to be considered a valid package for Visual Studio 24 /// is to implement the IVsPackage interface and register itself with the shell. 25 /// This package uses the helper classes defined inside the Managed Package Framework (MPF) 26 /// to do it: it derives from the Package class that provides the implementation of the 27 /// IVsPackage interface and uses the registration attributes defined in the framework to 28 /// register itself and its components with the shell. These attributes tell the pkgdef creation 29 /// utility what data to put into .pkgdef file. 30 /// </para> 31 /// <para> 32 /// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file. 33 /// </para> 34 /// </remarks> 35 [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 36 [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 37 [ProvideMenuResource("Menus.ctmenu", 1)] 38 [Guid(DockerAppPackage.PackageGuidString)] 39 [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 40 public sealed class DockerAppPackage : AsyncPackage 41 { 42 /// <summary> 43 /// Command1Package GUID string. 44 /// </summary> 45 public const string PackageGuidString = "02eefd95-14a5-4afd-ab88-8d61ce9c902f"; 46 47 /// <summary> 48 /// Initializes a new instance of the <see cref="DockerAppPackage"/> class. 49 /// </summary> 50 public DockerAppPackage() 51 { 52 // Inside this method you can place any initialization code that does not require 53 // any Visual Studio service because at this point the package object is created but 54 // not sited yet inside Visual Studio environment. The place to do all the other 55 // initialization is the Initialize method. 56 } 57 58 #region Package Members 59 60 /// <summary> 61 /// Initialization of the package; this method is called right after the package is sited, so this is the place 62 /// where you can put all the initialization code that rely on services provided by VisualStudio. 63 /// </summary> 64 /// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param> 65 /// <param name="progress">A provider for progress updates.</param> 66 /// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns> 67 protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress) 68 { 69 // When initialized asynchronously, the current thread may be a background thread at this point. 70 // Do any initialization that requires the UI thread after switching to the UI thread. 71 await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 72 await CommandRender.InitializeAsync(this); 73 await CommandSelectApp.InitializeAsync(this); 74 await CommandSettings.InitializeAsync(this); 75 await CommandDeploy.InitializeAsync(this); 76 await CommandNew.InitializeAsync(this); 77 } 78 79 #endregion 80 } 81 }