Initialize() public static method

Initializes the singleton instance of the command.
public static Initialize ( CmdArgsPackage package ) : void
package CmdArgsPackage Owner package, not null.
return void
        /// <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()
        {
            Commands.Initialize(this);
            base.Initialize();

            vsHelper = new VisualStudioHelper(this);
            vsHelper.SolutionAfterOpen     += VsHelper_SolutionOpend;
            vsHelper.SolutionBeforeClose   += VsHelper_SolutionWillClose;
            vsHelper.SolutionAfterClose    += VsHelper_SolutionClosed;
            vsHelper.StartupProjectChanged += VsHelper_StartupProjectChanged;
            vsHelper.StartupProjectConfigurationChanged += VsHelper_StartupProjectConfigurationChanged;
            vsHelper.ProjectBeforeRun += VsHelper_ProjectWillRun;

            vsHelper.ProjectAfterOpen   += VsHelper_ProjectAdded;
            vsHelper.ProjectBeforeClose += VsHelper_ProjectRemoved;
            vsHelper.ProjectAfterRename += VsHelper_ProjectRenamed;

            vsHelper.Initialize();

            GetDialogPage <CmdArgsOptionPage>().VcsSupportChanged       += OptionPage_VcsSupportChanged;
            GetDialogPage <CmdArgsOptionPage>().UseMonospaceFontChanged += OptionPage_UseMonospaceFontChanged;

            // Extension window was opend while a solution is already open
            if (vsHelper.IsSolutionOpen)
            {
                Logger.Info("Package.Initialize called while solution was already open.");

                InitializeForSolution();
            }

            ToolWindowViewModel.TreeViewModel.ItemSelectionChanged += OnItemSelectionChanged;

            ToolWindowViewModel.UseMonospaceFont = IsUseMonospaceFontEnabled;
        }
Esempio n. 2
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()
        {
            Commands.Initialize(this);
            base.Initialize();

            vsHelper = new VisualStudioHelper(this);
            vsHelper.SolutionOpend         += VsHelper_SolutionOpend;
            vsHelper.SolutionWillClose     += VsHelper_SolutionWillClose;
            vsHelper.SolutionClosed        += VsHelper_SolutionClosed;
            vsHelper.StartupProjectChanged += VsHelper_StartupProjectChanged;
            vsHelper.StartupProjectConfigurationChanged += VsHelper_StartupProjectConfigurationChanged;

            vsHelper.ProjectAdded   += VsHelper_ProjectAdded;
            vsHelper.ProjectRemoved += VsHelper_ProjectRemoved;
            vsHelper.ProjectRenamed += VsHelper_ProjectRenamed;

            vsHelper.Initialize();

            GetDialogPage <CmdArgsOptionPage>().MacroEvaluationChanged += OptionPage_MacroEvaluationChanged;

            // Extension window was opend while a solution is already open
            if (vsHelper.IsSolutionOpen)
            {
                Logger.Info("Package.Initialize called while solution was already open.");

                UpdateCommandsForAllProjects();
                AttachFsWatcherToAllProjects();
                UpdateCurrentStartupProject();
            }

            ToolWindowViewModel.CommandLineChanged   += OnCommandLineChanged;
            ToolWindowViewModel.SelectedItemsChanged += OnSelectedItemsChanged;
        }