Esempio n. 1
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()
        {
            try
            {
                EnvDTE.DTE dte = (EnvDTE.DTE)GetGlobalService(typeof(EnvDTE.DTE));
                Log.InfoFormat("PowerShell Tools Version: {0}", Assembly.GetExecutingAssembly().GetName().Version);
                Log.InfoFormat("Visual Studio Version: {0}", dte.Version);
                Log.InfoFormat("Windows Version: {0}", Environment.OSVersion);
                Log.InfoFormat("Current Culture: {0}", CultureInfo.CurrentCulture);
                if (!DependencyValidator.Validate())
                {
                    Log.Warn("Dependency check failed.");
                    return;
                }

                base.Initialize();

                InitializeInternal();

                _powerShellService           = new Lazy <PowerShellService>(() => { return(new PowerShellService()); });
                _powerShellHostClientService = new Lazy <PowerShellHostClientService> (() => { return(new PowerShellHostClientService()); });

                RegisterServices();

                if (ShouldShowReleaseNotes())
                {
                    IVsWindowFrame ppFrame;
                    var            service = GetGlobalService(typeof(IVsWebBrowsingService)) as IVsWebBrowsingService;
                    service.Navigate("https://poshtools.com/release/current", (uint)__VSWBNAVIGATEFLAGS.VSNWB_ForceNew, out ppFrame);
                }
            }
            catch (Exception ex)
            {
                Log.Error("Failed to initialize package.", ex);
                MessageBox.Show(
                    Resources.PowerShellToolsInitializeFailed + ex,
                    Resources.MessageBoxErrorTitle,
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Default constructor of the package.
 /// Inside this method you can place any initialization code that does not require
 /// any Visual Studio service because at this point the package object is created but
 /// not sited yet inside Visual Studio environment. The place to do all the other
 /// initialization is the Initialize method.
 /// </summary>
 public PowerShellToolsPackage()
 {
     _commands           = new Dictionary <ICommand, MenuCommand>();
     DependencyValidator = new DependencyValidator();
 }