Ejemplo n.º 1
0
        void RootMenuItemClick(object sender, EventArgs e)
        {
            VsDevExpressMenuItem menuItem = (VsDevExpressMenuItem)sender;
            NavigateItem         item     = (NavigateItem)menuItem.Tag;

            package.ToolWindowViewModel.NavigateToSolution(item.Path);
        }
Ejemplo n.º 2
0
        void GenerateMenuItemContent(VsDevExpressMenuItem menu, NavigateItem item, string relativePath, Action <VsDevExpressMenuItem, NavigateItem> addClickHandler)
        {
            int startIndex = 0;

            relativePath = ReduceRelativePath(relativePath);
            while (startIndex > -1)
            {
                int index = GetDirectorySeparatorIndex(relativePath, startIndex + 1);
                if (index < 0)
                {
                    break;
                }
                string name = relativePath.Substring(startIndex, Math.Max(0, index - startIndex));
                name = name.Replace(Path.DirectorySeparatorChar.ToString(), string.Empty);
                name = name.Replace(Path.AltDirectorySeparatorChar.ToString(), string.Empty);
                if (string.IsNullOrEmpty(name))
                {
                    continue;
                }
                startIndex = index;

                if (string.IsNullOrEmpty(name))
                {
                    continue;
                }
                menu = menu.CreateOrGetItem(name, true);
            }
            var menuItem = menu.CreateOrGetItem(item.Name);

            addClickHandler(menuItem, item);
        }
Ejemplo n.º 3
0
        void AddProjectReferenceMenuItemClick(object sender, EventArgs e)
        {
            VsDevExpressMenuItem menuItem = (VsDevExpressMenuItem)sender;
            NavigateItem         item     = (NavigateItem)menuItem.Tag;
            AddReferenceHelper   helper   = new AddReferenceHelper();

            helper.AddProjectReferences(new DteWrapper(dte), item);
        }
Ejemplo n.º 4
0
        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));
            }
        }