public static async System.Threading.Tasks.Task InitializeAsync(AsyncPackage package)
        {
            { // Adding callback method to "Parallel Builds Monitor" menu item into "VS -> Menu -> View -> Other Windows" menu
                IMenuCommandService commandService = (IMenuCommandService)await package.GetServiceAsync(typeof(IMenuCommandService));

                Microsoft.Assumes.Present(commandService);
                CommandID   menuCommandID = new CommandID(typeof(MainMenuCommandSet).GUID, (int)MainMenuCommandSet.ShowToolWindow);
                MenuCommand menuItem      = new MenuCommand((s, e) => Execute(package), menuCommandID);
                commandService.AddCommand(menuItem);
            }

            { // Start listening VS Events...
                // Should we always collect data even when "Parallel Builds Monitor" pane is closed?
                // What if user open PBM pane in the the middle of build? Should we show Gantt chart or draw notice like "Restart build to see results"?
                // If we decide not to collect data when PBM pane is closed, then user must manually activate PBM before build in order to have Gantt.
                // This is because "Output" pane is left as active after each build, so "Output" pane will be active pane after VS restart.
                PBMCommand.Initialize(package);
            }

            { // Show and Activate "Parallel Builds Monitor" pane
              // Do we really want to activate "Parallel Builds Monitor" pane after each solution load?
              // Or maybe we want to do that only once after installation?
              // Will it work when PBM plugin is installed whn solution is already opened?

                const string          collectionName            = "PBMSettings";
                const string          propertyName              = "FirstRun";
                SettingsManager       settingsManager           = new ShellSettingsManager(PBMCommand.ServiceProvider);
                WritableSettingsStore writableUserSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
                if (!writableUserSettingsStore.CollectionExists(collectionName))
                {
                    writableUserSettingsStore.CreateCollection(collectionName);
                }

                bool firstRun = writableUserSettingsStore.GetBoolean(collectionName, propertyName, true);
                if (firstRun)
                {
                    writableUserSettingsStore.SetBoolean(collectionName, propertyName, false);
                    Execute(package);
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 public static void Initialize(Microsoft.VisualStudio.Shell.Package package)
 {
     Instance = new PBMCommand(package);
 }
예제 #3
0
 /// <summary>
 /// Initialization of the package; this method is called right after the package is sited, so this is the place
 /// where you can put all the initialization code that rely on services provided by VisualStudio.
 /// </summary>
 protected override void Initialize()
 {
     PBMCommand.Initialize(this);
     base.Initialize();
 }