当前位置: 首页>>代码示例>>C#>>正文


C# DTE2类代码示例

本文整理汇总了C#中DTE2的典型用法代码示例。如果您正苦于以下问题:C# DTE2类的具体用法?C# DTE2怎么用?C# DTE2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DTE2类属于命名空间,在下文中一共展示了DTE2类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RoslynCodeAnalysisHelper

        public RoslynCodeAnalysisHelper(IWpfTextView view, ITextDocument document, IVsTaskList tasks, DTE2 dte, SVsServiceProvider serviceProvider, IVsActivityLog log)
        {
            _view = view;
            _document = document;
            _text = new Adornment();
            _tasks = tasks;
            _serviceProvider = serviceProvider;
            _log = log;
            _dispatcher = Dispatcher.CurrentDispatcher;

            _adornmentLayer = view.GetAdornmentLayer(RoslynCodeAnalysisFactory.LayerName);

            _view.ViewportHeightChanged += SetAdornmentLocation;
            _view.ViewportWidthChanged += SetAdornmentLocation;

            _text.MouseUp += (s, e) => dte.ExecuteCommand("View.ErrorList");

            _timer = new Timer(750);
            _timer.Elapsed += (s, e) =>
            {
                _timer.Stop();
                System.Threading.Tasks.Task.Run(() =>
                {
                    _dispatcher.Invoke(new Action(() => Update(false)), DispatcherPriority.ApplicationIdle, null);
                });
            };
            _timer.Start();
        }
开发者ID:karthik25,项目名称:roslyn-code-analysis-extension,代码行数:28,代码来源:RoslynCodeAnalysisHelper.cs

示例2: Initialize

        /// <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 initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            DTE dte = (DTE)GetService(typeof(DTE));
            DTE2 = dte as DTE2;
            GuidList.gPackage = this;
            Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            // retrieve the installation directory
            using (RegistryKey rootKey = this.UserRegistryRoot)
            {
                using (RegistryKey packageKey = rootKey.OpenSubKey("ExtensionManager\\EnabledExtensions"))
                {
                    PackageRootPath = packageKey.GetValue(GuidList.guidNPLDebuggerPackagePkgString + ",1.0") as String;
                }
            }

            // create the NPL Debugger
            NPLDebugger = new NPLDebuggerConnect(DTE2, this);

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if ( null != mcs )
            {
                // Create the command for the menu item.
                CommandID menuCommandID = new CommandID(GuidList.guidNPLDebuggerPackageCmdSet, (int)PkgCmdIDList.cmdidNPLDebuggerCommand);
                MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID );
                mcs.AddCommand( menuItem );
                // Create the command for the tool window
                CommandID toolwndCommandID = new CommandID(GuidList.guidNPLDebuggerPackageCmdSet, (int)PkgCmdIDList.cmdidNPLDebuggerTool);
                MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID);
                mcs.AddCommand( menuToolWin );
            }
        }
开发者ID:jda808,项目名称:NPL,代码行数:38,代码来源:NPLDebuggerPackage.cs

示例3: GetAssembly

 public static Assembly GetAssembly(DTE2 dte, string assemblyName)
 {
     Assembly assembly = null;
     if (_assemblyCache.ContainsKey(assemblyName))
     {
         assembly = _assemblyCache[assemblyName];
     }
     else
     {
         lock (_syncRoot)
         {
             if (_assemblyCache.ContainsKey(assemblyName))
             {
                 assembly = _assemblyCache[assemblyName];
             }
             else
             {
                 var assemblyPath = GetAssemblyFullName(dte, assemblyName);
                 assembly = Assembly.LoadFrom(assemblyPath);
                 _assemblyCache[assemblyName] = assembly;
             }
         }
     }
     return assembly;
 }
开发者ID:cgoconseils,项目名称:XrmFramework,代码行数:25,代码来源:AssemblyLoader.cs

示例4: CommandBarBuilder

        public CommandBarBuilder(DTE2 dte, AddIn addin)
        {
            this.dte = dte;
            this.addIn = addin;

            createdControls = new List<CommandBarControl>();
        }
开发者ID:ptomasroos,项目名称:ivyvisual,代码行数:7,代码来源:CommandBarBuilder.cs

示例5: Register

 public static void Register(DTE2 dte, MenuCommandService mcs)
 {
     _dte = dte;
     CommandID nestAllId = new CommandID(GuidList.guidFileNestingCmdSet, (int)PkgCmdIDList.cmdRunNesting);
     OleMenuCommand menuNestAll = new OleMenuCommand(NestAll, nestAllId);
     mcs.AddCommand(menuNestAll);
 }
开发者ID:vandro,项目名称:FileNesting,代码行数:7,代码来源:RunAutoNestingButton.cs

示例6: Initialize

        protected override void Initialize()
        {
            base.Initialize();

            _dte = GetService(typeof(DTE)) as DTE2;

            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            CommandID cmdCustom = new CommandID(GuidList.guidOpenCommandLineCmdSet, (int)PkgCmdIDList.cmdidOpenCommandLine);
            OleMenuCommand customItem = new OleMenuCommand(OpenCustom, cmdCustom);
            customItem.BeforeQueryStatus += BeforeQueryStatus;
            mcs.AddCommand(customItem);

            CommandID cmdCmd = new CommandID(GuidList.guidOpenCommandLineCmdSet, (int)PkgCmdIDList.cmdidOpenCmd);
            MenuCommand cmdItem = new MenuCommand(OpenCmd, cmdCmd);
            mcs.AddCommand(cmdItem);

            CommandID cmdPowershell = new CommandID(GuidList.guidOpenCommandLineCmdSet, (int)PkgCmdIDList.cmdidOpenPowershell);
            MenuCommand powershellItem = new MenuCommand(OpenPowershell, cmdPowershell);
            mcs.AddCommand(powershellItem);

            CommandID cmdOptions = new CommandID(GuidList.guidOpenCommandLineCmdSet, (int)PkgCmdIDList.cmdidOpenOptions);
            MenuCommand optionsItem = new MenuCommand((s, e) => { ShowOptionPage(typeof(Options)); }, cmdOptions);
            mcs.AddCommand(optionsItem);

            CommandID cmdExe = new CommandID(GuidList.guidOpenCommandLineCmdSet, (int)PkgCmdIDList.cmdExecuteCmd);
            OleMenuCommand exeItem = new OleMenuCommand(ExecuteFile, cmdExe);
            exeItem.BeforeQueryStatus += BeforeExeQuery;
            mcs.AddCommand(exeItem);
        }
开发者ID:IDisposable,项目名称:OpenCommandLine,代码行数:30,代码来源:OpenCommandLinePackage.cs

示例7: AddNestedFile

        internal static void AddNestedFile(DTE2 dte, string parent, string child, BuildActionType type)
        {
            // ignore if child doesn't exist
            if (!File.Exists(child)) return;
            if (dte == null) return;

            // if we can't load parent or child already part of solution, don't attempt to change anything
            ProjectItem parentItem, childItem;
            if (!TryGetProjectItem(dte.Solution, parent, out parentItem) || TryGetProjectItem(dte.Solution, child, out childItem))
                return;

            // add the child item and save project
            if (parentItem.ProjectItems == null)
                Logger.Log("ProjectItems is null. Bad news is about to happen.");

            childItem = parentItem.ProjectItems.AddFromFile(child);
            if (childItem != null)
            {
                childItem.ContainingProject.Save();
            }
            else
            {
                Logger.Log("Could not add child item to project.");
            }

            // schedule call to change build action
            // this is a work around since it seems to ignore property changes until after file saved
            // and even after that it still ignores it, so async makes it better
            Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() => ChangeBuildActionType(dte, child, type)), DispatcherPriority.Background);
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:30,代码来源:InteropHelper.cs

示例8: GetSelectedProject

 public static Project GetSelectedProject(DTE2 applicationObject)
 {
     return
         (Project)
         Array.Find(GetProjectsInSolution(applicationObject),
                    delegate(object project) { return IsSelectedUIHierarchyItemAProject(applicationObject, project); });
 }
开发者ID:tmandersson,项目名称:FastGTD,代码行数:7,代码来源:AddInHelper.cs

示例9: Initialize

        protected override void Initialize()
        {
            base.Initialize();
            _dte = GetService(typeof(DTE)) as DTE2;
            _activityLogger = new ActivityLogger(GetService(typeof(SVsActivityLog)) as IVsActivityLog);

            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if (null != mcs)
            {
                CommandID cmdId = new CommandID(GuidList.guidTemplatePackCmdSet, (int)PkgCmdIDList.cmdidMyCommand);
                OleMenuCommand button = new OleMenuCommand(ButtonClicked, cmdId);
                button.BeforeQueryStatus += button_BeforeQueryStatus;
                mcs.AddCommand(button);

                CommandID menuCommandID = new CommandID(GuidList.guidMenuOptionsCmdSet, (int)PkgCmdIDList.SWMenuGroup);
                OleMenuCommand menuItem = new OleMenuCommand(OpenSettings, menuCommandID);
                mcs.AddCommand(menuItem);
            }

            System.Threading.Tasks.Task.Run(async () => {
                await System.Threading.Tasks.Task.Delay(100);
                
                try {
                    new DynamicTemplateBuilder(_dte, _activityLogger).ProcessTemplates();
                }
                catch (Exception ex) {
                    _activityLogger.Error(ex.ToString());
                    _dte.StatusBar.Text = @"An error occured while updating templates, check the activity log";

                    // Leave this for now until we are sure activity logger above works well
                    System.Windows.MessageBox.Show(ex.ToString());
                }
            });
        }
开发者ID:FullStackPro,项目名称:side-waffle,代码行数:34,代码来源:TemplatePackPackage.cs

示例10: GetReferencedTypes

        private static IEnumerable<ModelTypeInfo> GetReferencedTypes(DTE2 dte2)
        {
            Project activeProject = dte2.ActiveSolutionProjects[0];
            var project = activeProject.Object as VSLangProj.VSProject;
            if (project != null)
            {
                foreach (VSLangProj.Reference reference in project.References)
                {
                    if (reference.SourceProject != null)
                    {
                        if (!File.Exists(reference.Path))
                        {
                            continue;
                        }

                        // Get type info from assembly
                        List<ModelTypeInfo> modelTypes = ModelReflectionHelper.GetModelTypes
                            (new FileInfo(reference.Path));
                        foreach (var modelType in modelTypes)
                        {
                            yield return modelType;
                        }
                    }
                }
            }
        }
开发者ID:luboshl,项目名称:trackable-entities,代码行数:26,代码来源:WizardHelper.cs

示例11: OnConnection

        /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
        /// <param term='application'>Root object of the host application.</param>
        /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
        /// <param term='addInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            _applicationObject = (DTE2)application;
            _addInInstance = (AddIn)addInInst;

            _dbgWatchConfig = new QuickWatchConfig();

            try {
                CommandBar commandBar = ((CommandBars)_applicationObject.CommandBars)["Code Window"];

                // Create Quick watch menu
                _controlQuickWatch = commandBar.Controls.Add(MsoControlType.msoControlButton, System.Reflection.Missing.Value, System.Reflection.Missing.Value, 1, true);
                _controlQuickWatch.Caption = "QuickWatchEx...";
                _controlQuickWatch.Enabled = IsInDebugMode(_applicationObject);

                _menuItemHandlerQuickWatch = (CommandBarEvents)_applicationObject.Events.CommandBarEvents[_controlQuickWatch];
                _menuItemHandlerQuickWatch.Click += MenuItemHandlerQuickWatch_Click;

                _debuggerEvents = _applicationObject.Events.DebuggerEvents;
                _debuggerEvents.OnEnterDesignMode += DebuggerEvents_OnEnterDesignMode;
                _debuggerEvents.OnEnterBreakMode += DebuggerEvents_OnEnterBreakMode;
                _debuggerEvents.OnEnterRunMode += DebuggerEvents_OnEnterRunMode;
            } catch (Exception e) {
                MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
开发者ID:dp0h,项目名称:QuickWatchEx,代码行数:31,代码来源:Connect.cs

示例12: SampleWizardPage

        public SampleWizardPage(DTE2 application)
        {
            _application = application;
            InitializeComponent();
            //AsposeComponents components = new AsposeComponents();
            SetComponentsAPIs();

            textBoxLocation.Text = GetExamplesRootPath();

            //AsposeComponent component;
            //AsposeComponents.list.TryGetValue(Constants.ASPOSE_COMPONENT, out component);

            toolStripStatusMessage.Visible = true;
            toolStripStatusMessage.Text = "";
            progressBar1.Visible = false;
            progressBar1.Value = 0;

            //rdbCSharp.Enabled = false;
            //rdbVisualBasic.Enabled = false;

            //checkAndUpdateRepo(component);

            //rdbCSharp.Enabled = true;
            //rdbVisualBasic.Enabled = true;

            GroupDocsComponent component;
            GroupDocsComponents.list.TryGetValue(Constants.GROUPDOCS_COMPONENT, out component);
            string repoPath = GitHelper.getLocalRepositoryPath(component);
            //PopulateTreeView(repoPath + "/Examples/" );
            PopulateTreeView(repoPath + "/Examples/" + (rdbCSharp.Checked ? "CSharp" : "VisualBasic"));
        }
开发者ID:atirtahirgroupdocs,项目名称:GroupDocs_Assembly_NET,代码行数:31,代码来源:SampleWizardPage.cs

示例13: Test1a

		public static void Test1a(DTE2 DTE)
		{
			DTE.ItemOperations.NewFile("General\\Object-Role Modeling File", "ORMRolePlayerRequiredModel", "");

			ORMTestHooks testHooks = new ORMTestHooks(DTE);
			ORMTestWindow testWindow = testHooks.FindORMTestWindow(null);

			if (CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Entity Type"))
			{
				SendKeys.SendWait("{Enter}");
			}

			if (CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Entity Type"))
			{
				SendKeys.SendWait("{Enter}");
			}

			// Find the accesible object for the diagram
			AccessibleObject accDiagram = CommonTestHooks.FindAccessibleObject(
					testWindow.AccessibleObject,
					new AccessiblePathNode[] {
                            new AccessiblePathNode("ORMDiagram")
                        });

			// Find the accessible object for the newly added Entity Type
			AccessibleObject accEntityType = CommonTestHooks.FindAccessibleObject(
					accDiagram,
					new AccessiblePathNode[] {
                            new AccessiblePathNode("EntityType", 0)
                        });

			// Click on the accessible object for the newly created entity type.
			testWindow.ClickAccessibleObject(accEntityType);
		}
开发者ID:cjheath,项目名称:NORMA,代码行数:34,代码来源:RolePlayerRequiredErrorTests.cs

示例14: GoDiagramPlayWindow

 public GoDiagramPlayWindow(DTE2 dte)
 {
     _dte = dte;
     lifelines = new Dictionary<string, Lifeline>();
     InitializeComponent();
     goView1.DefaultTool = new GoToolManager(goView1);
 }
开发者ID:jeroldhaas,项目名称:ContinuousTests,代码行数:7,代码来源:GoDiagramPlayWindow.cs

示例15: SpecRunTestRunnerGateway

 public SpecRunTestRunnerGateway(IOutputWindowService outputWindowService, IIdeTracer tracer, IProjectScopeFactory projectScopeFactory, DTE2 dte)
 {
     this.outputWindowService = outputWindowService;
     this.dte = dte;
     this.projectScopeFactory = projectScopeFactory;
     this.tracer = tracer;
 }
开发者ID:hereyes,项目名称:SpecFlow,代码行数:7,代码来源:SpecRunTestRunnerGateway.cs


注:本文中的DTE2类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。