VSDevExpressMenu GetRootAddReferenceMenu(string menuName)
        {
            VSDevExpressMenu menu;

            if (!addReferenceMenuHierarchy.TryGetValue(menuName, out menu))
            {
                menu = new VSDevExpressMenu(dte, menuName, VSDevExpressMenuLocation.AddReferenceRoot);
                addReferenceMenuHierarchy.Add(menuName, menu);
            }
            return(menu);
        }
        VSDevExpressMenu GetRootMenu(string menuName)
        {
            VSDevExpressMenu menu;

            if (!rootMenuHierarchy.TryGetValue(menuName, out menu))
            {
                menu = new VSDevExpressMenu(dte, menuName);
                rootMenuHierarchy.Add(menuName, menu);
            }
            return(menu);
        }
        public void GenerateDefault()
        {
            devExpressMenu = new VSDevExpressMenu(dte);
            rootMenuHierarchy[string.Empty] = devExpressMenu;
            string wizardMenuText           = "Show tool window";
            VsDevExpressMenuItem wizardMenu = devExpressMenu.CreateOrGetItem(wizardMenuText);

            wizardMenu.Click += WizardMenuClick;
            var portWindowCommand = dte.Commands.Cast <Command>().FirstOrDefault(x => x.Name == "View.DXVcsToolsportwindow");

            wizardMenu.Shortcut = GetShortcutText(portWindowCommand);

            string blameMenuText           = "Show blame window";
            VsDevExpressMenuItem blameMenu = devExpressMenu.CreateOrGetItem(blameMenuText);

            blameMenu.Click += BlameMenuClick;
            var blameWindowCommand = dte.Commands.Cast <Command>().FirstOrDefault(x => x.Name == "View.DXVcsToolsblamewindow");

            blameMenu.Shortcut = GetShortcutText(blameWindowCommand);

            if (Options.UseNavigateMenu)
            {
                VsDevExpressMenuItem navigateMenu = devExpressMenu.CreateOrGetItem("Configure navigate menu...");
                navigateMenu.Click += NavigateMenuClick;
            }
            VsDevExpressMenuItem settingsMenu = devExpressMenu.CreateOrGetItem("Settings...");

            settingsMenu.Click += SettingsMenuOnClick;

            if (Options.ConfigVersion < VersionInfo.ToIntVersion())
            {
                VsDevExpressMenuItem resetConfigMenu = devExpressMenu.CreateOrGetItem(resetConfigHeader);
                resetConfigMenu.Click += ResetConfigMenuOnClick;
            }

            if (Options.EnableAutoUpdate)
            {
                VsDevExpressMenuItem updateMenu = devExpressMenu.CreateOrGetItem(updateHeader);
                updateMenu.Click      += UpdateMenuOnClick;
                updateMenu.Enabled     = false;
                updateMenu.IsSeparator = true;
                updateMenu.Icon        = Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("DXVcsTools.Resources.Update.png"));
                UpdateOptions          = null;
                BackgroundHelper.DoInBackground(
                    () => UpdateOptions      = AutoUpdateHelper.GetUpdateOptions(Options.AutoUpdaterPath),
                    () => updateMenu.Enabled = UpdateOptions.Return(x => x.Version > VersionInfo.ToIntVersion(), () => false));
            }
        }
Beispiel #4
0
        public void GenerateDefault()
        {
            devExpressMenu = new VSDevExpressMenu(dte);
            rootMenuHierarchy[string.Empty] = devExpressMenu;
            VSDevExpressMenuItem wizardMenu = devExpressMenu.CreateOrGetItem("Show tool window");

            wizardMenu.Click += WizardMenuClick;
            VSDevExpressMenuItem blameMenu = devExpressMenu.CreateOrGetItem("Show blame window");

            blameMenu.Click += BlameMenuClick;
            if (Options.UseNavigateMenu)
            {
                VSDevExpressMenuItem navigateMenu = devExpressMenu.CreateOrGetItem("Configure navigate menu...");
                navigateMenu.Click += NavigateMenuClick;
            }
        }
 public void Release()
 {
     ReleaseRootMenu();
     ReleaseAddReferenceMenu();
     devExpressMenu = null;
 }