Example #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()
 {
     GeneralUtils.Initialize(this);
     ProjectUtilities.Initialize(this);
     NuGetServices.Initialize(this);
     SwitchToDebugCommand.Initialize(this);
     UpgradeNuGetCommand.Initialize(this);
     UpgradeNuGetBetaCommand.Initialize(this);
     base.Initialize();
 }
        public OperationContext(
            IServiceProvider serviceLocator,
            bool preRelease,
            Setting setting)
        {
            _startAt = DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss");

            _setting       = setting ?? new Setting();
            ServiceLocator = serviceLocator;
            PreRelease     = preRelease;
            CacheFolder    = FindPackagesCachePath(serviceLocator);
            PreparePackagesInfo();
            Projects = new ProjectUtilities(this);
        }
        /// <summary>
        /// Handles the BeforeQueryStatus event of the MenuItem control.
        /// Set the menu title
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void MenuItem_BeforeQueryStatus(object sender, EventArgs e)
        {
            var myCommand = sender as OleMenuCommand;

            if (myCommand != null)
            {
                bool?debugMode = ProjectUtilities.IsInDebugMode();
                if (debugMode == null)
                {
                    myCommand.Text    = "Not accessable";
                    _menuItem.Visible = false;
                }
                else if (debugMode.Value)
                {
                    myCommand.Text = NUGET_MODE_TEXT;
                }
                else
                {
                    myCommand.Text = PROJ_REF_MODE_TEXT;
                }
            }
        }