示例#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()
 {
     base.Initialize();
     RemoveUnusedCodeCommand.Initialize(this);
     removeUnusedCode = new RemoveUnusedCode((EnvDTE.DTE)GetService(typeof(EnvDTE.DTE)));
     SaveDebugInfoCommand.Initialize(this);
 }
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Title = "Select File for Debug Info Location";
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                RemoveUnusedCode removeUnusedCode = ((VSPackage)package).removeUnusedCode;
                removeUnusedCode.DebugInfoFileName = saveFileDialog.FileName;
            }
        }
示例#3
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            RemoveUnusedCode removeUnusedCode = ((VSPackage)package).removeUnusedCode;

            removeUnusedCode.RemoveUnusedMethods();

            if (removeUnusedCode.ErrorMessage != string.Empty)
            {
                string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName);
                string title   = "RemoveUnusedCodeCommand";
                VsShellUtilities.ShowMessageBox(
                    this.ServiceProvider,
                    message,
                    title,
                    OLEMSGICON.OLEMSGICON_INFO,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
            }
        }