private static void RestorePackages(string fileName, Options options, string rootFolder)
        {
            ThreadPool.QueueUserWorkItem((o) =>
            {
                try
                {
                    Helper.DTE.StatusBar.Animate(true, EnvDTE.vsStatusAnimation.vsStatusAnimationSync);

                    if (fileName.Equals(NPM.Constants.FileName) && options.NpmInstallOnSave)
                        Helper.RunProcessSync("npm install", rootFolder, Resource.RunningNpmRestore, false);
                    else if (fileName.Equals(Bower.Constants.FileName) && options.BowerInstallOnSave)
                        Helper.RunProcessSync("bower install", rootFolder, Resource.RunningNpmRestore, false);

                    Helper.DTE.StatusBar.Text = Resource.PackageRestoreComplete;
                }
                catch (Exception ex)
                {
                    Logger.Log(ex.Message);
                    Helper.DTE.StatusBar.Text = Resource.ErrorRestoringPackages;
                }
                finally
                {
                    Helper.DTE.StatusBar.Animate(false, EnvDTE.vsStatusAnimation.vsStatusAnimationSync);
                }
            });
        }
        public void InstallPackages(Options options)
        {
            if (!options.BowerInstallOnOpen && !options.NpmInstallOnOpen)
                return;

            var projects = GetProjects();
            List<string> _dupeCache = new List<string>();

            foreach (Project project in projects)
            {
                string projectFolder = GetRootFolder(project);

                if (string.IsNullOrEmpty(projectFolder) || !Directory.Exists(projectFolder))
                    continue;

                string package = GetFileName(Path.Combine(projectFolder, NPM.Constants.FileName));
                string bower = GetFileName(Path.Combine(projectFolder, Bower.Constants.FileName));
                bool npmExist = File.Exists(package);
                bool bowerExist = File.Exists(bower);

                if (!npmExist && !bowerExist)
                    continue;

                ThreadPool.QueueUserWorkItem(o =>
                {
                    try
                    {
                        Helper.DTE.StatusBar.Animate(true, EnvDTE.vsStatusAnimation.vsStatusAnimationSync);

                        if (options.BowerInstallOnOpen && bowerExist && !_dupeCache.Contains(bower))
                        {
                            _dupeCache.Add(bower);
                            Helper.RunProcessSync("bower install", Path.GetDirectoryName(bower), Resource.RunningBowerRestore, false);
                        }

                        if (options.NpmInstallOnOpen && npmExist && !_dupeCache.Contains(package))
                        {
                            _dupeCache.Add(package);
                            Helper.RunProcessSync("npm install", Path.GetDirectoryName(package), Resource.RunningNpmRestore, false);
                        }

                        Helper.DTE.StatusBar.Text = Resource.PackageRestoreComplete;
                    }
                    catch (Exception)
                    {
                        Helper.DTE.StatusBar.Text = Resource.ErrorRestoringPackages;
                    }
                    finally
                    {
                        Helper.DTE.StatusBar.Animate(false, EnvDTE.vsStatusAnimation.vsStatusAnimationSync);
                    }
                });
            }
        }
        protected override void Initialize()
        {
            base.Initialize();

            Events2 events = (Events2)Helper.DTE.Events;
            events.SolutionEvents.Opened += SolutionEvents_Opened;

            Options = (Options)GetDialogPage(typeof(Options));

            // Add our command handlers for menu (commands must exist in the .vsct file)
            //OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            //if (null != mcs)
            //{
            //    // Create the command for the menu item.
            //    CommandID menuCommandID = new CommandID(GuidList.guidJSON_IntellisenseCmdSet, (int)PkgCmdIDList.cmdidMyCommand);
            //    MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID);
            //    mcs.AddCommand(menuItem);
            //}
        }