• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DTE类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Initialize

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

            _dte = GetGlobalService(typeof(DTE)) as DTE;
            if (_dte == null)
                return;

            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if (mcs == null)
                return;

            //Solution Node
            CommandID solutionMenuCommandId = new CommandID(GuidList.GuidVsPtcCmdSet, (int)PkgCmdIdList.CmdidMyCommandSolution);
            MenuCommand solutionmMenuItem = new MenuCommand(SolutionMenuCallback, solutionMenuCommandId);
            mcs.AddCommand(solutionmMenuItem);

            //Project Node
            CommandID projectMenuCommandId = new CommandID(GuidList.GuidVsPtcCmdSet, (int)PkgCmdIdList.CmdidMyCommandProject);
            MenuCommand projectmMenuItem = new MenuCommand(ProjectMenuCallback, projectMenuCommandId);
            mcs.AddCommand(projectmMenuItem);

            //Project Item Node - File
            CommandID itemFileMenuCommandId = new CommandID(GuidList.GuidVsPtcCmdSet, (int)PkgCmdIdList.CmdidMyCommandItemFile);
            MenuCommand itemFileMenuItem = new MenuCommand(ItemFileMenuCallback, itemFileMenuCommandId);
            mcs.AddCommand(itemFileMenuItem);

            //Project Item Node - Folder
            CommandID itemFolderMenuCommandId = new CommandID(GuidList.GuidVsPtcCmdSet, (int)PkgCmdIdList.CmdidMyCommandItemFolder);
            MenuCommand itemFolderMenuItem = new MenuCommand(ItemFolderMenuCallback, itemFolderMenuCommandId);
            mcs.AddCommand(itemFolderMenuItem);
        }
开发者ID:jlattimer,项目名称:VSPathToClipboard,代码行数:32,代码来源:PathToClipboardPackage.cs


示例2: MDASolutionWizard

 public MDASolutionWizard(DTE applicationObject, MDASolutionManager solutionManager, AddInSettings settings)
 {
     m_applicationObject = applicationObject;
     m_solutionManager = solutionManager;
     m_settings = settings;
     InitializeComponent();
 }
开发者ID:siwiwit,项目名称:andromda,代码行数:7,代码来源:MDASolutionWizard.cs


示例3: OnAfterCreated

        public void OnAfterCreated(DTE DTEObject)
        {
            m_settings = new AddInSettings(DTEObject);

            lstResyncIgnoreList.Items.Clear();
            if (m_settings.ResyncIgnoreList.Length > 0)
            {
                string[] list = m_settings.ResyncIgnoreList.Split(new char[] { ';' });
                foreach (string item in list)
                {
                    if (item.Length > 0) lstResyncIgnoreList.Items.Add(item);
                }
            }
            txtResyncIgnoreList.Text = string.Empty;
            btnAddResyncIgnoreItem.Enabled = false;
            btnDeleteResyncIgnoreItem.Enabled = false;

            cbIgnoreHiddenFiles.Checked = m_settings.ResyncIgnoreHiddenFiles;

            lstSyncFolders.Items.Clear();
            if (m_settings.SyncFolderList.Length > 0)
            {
                string[] list = m_settings.SyncFolderList.Split(new char[] { ';' });
                foreach (string item in list)
                {
                    if (item.Length > 0) lstSyncFolders.Items.Add(item);
                }
            }
            txtSyncFolder.Text = string.Empty;
            btnAddSyncFolderItem.Enabled = false;
            btnDeleteSyncFolderItem.Enabled = false;
        }
开发者ID:siwiwit,项目名称:andromda,代码行数:32,代码来源:SolutionExplorerOptionsPage.cs


示例4: InformationBarMargin

        public InformationBarMargin(IWpfTextView textView, ITextDocument document, IEditorOperations editorOperations, ITextUndoHistory undoHistory, DTE dte)
        {
            _textView = textView;
            _document = document;
            _operations = editorOperations;
            _undoHistory = undoHistory;
            _dte = dte;

            _informationBarControl = new InformationBarControl();
            _informationBarControl.Hide.Click += Hide;
            _informationBarControl.DontShowAgain.Click += DontShowAgain;
            var format = new Action(() => this.FormatDocument());
            _informationBarControl.Tabify.Click += (s, e) => this.Dispatcher.Invoke(format);

            this.Height = 0;
            this.Content = _informationBarControl;
            this.Name = MarginName;

            document.FileActionOccurred += FileActionOccurred;
            textView.Closed += TextViewClosed;

            // Delay the initial check until the view gets focus
            textView.GotAggregateFocus += GotAggregateFocus;

            this._tabDirectiveParser = new TabDirectiveParser(textView, document, dte);
            this._fileHeuristics = new FileHeuristics(textView, document, dte);

            var fix = new Action(() => this.FixFile());
            this._tabDirectiveParser.Change += (s, e) => this.Dispatcher.Invoke(fix);
        }
开发者ID:Mpdreamz,项目名称:tabdirective,代码行数:30,代码来源:InformationBar.cs


示例5: RedeploySolutions

 internal static void RedeploySolutions(DTE dte)
 {
     Helpers.ShowProgress(dte, "Redeploying solutions...", 30);
     Helpers.LogMessage(dte, dte, "*** Redeploying selected solutions ***");
     DeploymentHelpers.RedeployProject(dte, Helpers.GetSelectedDeploymentProjects(dte));
     Helpers.HideProgress(dte);
 }
开发者ID:manuel11g,项目名称:SharePoint-Software-Factory,代码行数:7,代码来源:DeploymentHelpers.cs


示例6: Initialize

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

            _logger = new Logger();

            _dte = GetGlobalService(typeof(DTE)) as DTE;
            if (_dte == null)
                return;

            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if (mcs != null)
            {
                CommandID publishCommandId = new CommandID(GuidList.GuidItemMenuCommandsCmdSet, (int)PkgCmdIdList.CmdidWebResourceDeployerPublish);
                OleMenuCommand publishMenuItem = new OleMenuCommand(PublishItemCallback, publishCommandId);
                publishMenuItem.BeforeQueryStatus += PublishItem_BeforeQueryStatus;
                publishMenuItem.Visible = false;
                mcs.AddCommand(publishMenuItem);

                CommandID editorPublishCommandId = new CommandID(GuidList.GuidEditorCommandsCmdSet, (int)PkgCmdIdList.CmdidWebResourceEditorPublish);
                OleMenuCommand editorPublishMenuItem = new OleMenuCommand(PublishItemCallback, editorPublishCommandId);
                editorPublishMenuItem.BeforeQueryStatus += PublishItem_BeforeQueryStatus;
                editorPublishMenuItem.Visible = false;
                mcs.AddCommand(editorPublishMenuItem);
            }
        }
开发者ID:Quodnon,项目名称:CRMDeveloperExtensions,代码行数:26,代码来源:WebResourceDeployerPackage.cs


示例7: RunStarted

        public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {
            dteObject = (DTE)automationObject;
            serviceProvider = (Microsoft.VisualStudio.OLE.Interop.IServiceProvider)this.dteObject;

            IntPtr zero4 = IntPtr.Zero;
            Guid guid = typeof(SComponentModel).GUID;
            serviceProvider.QueryService(ref guid, ref IUnknownGuid, out zero4);
            componentModel = (IComponentModel)GetObjectFromNativeUnknown(zero4);

            replacementsDictionary["$ext_safeprojectname$"] = RootWizard.GlobalDictionary["$ext_safeprojectname$"];
            replacementsDictionary["$ext_projectname$"] = RootWizard.GlobalDictionary["$ext_projectname$"];

            string localDBInstance = "v11.0";
            var localDBInstances = SqlLocalDbApi.GetInstanceNames();
            if (localDBInstances.IndexOf("MSSqlLocalDB") >= 0)
                localDBInstance = "MSSqlLocalDB";
            else if (localDBInstances.IndexOf("v12.0") >= 0)
                localDBInstance = "v12.0";
            else if (localDBInstances.IndexOf("v11.0") >= 0)
                localDBInstance = "v11.0";
            else if (localDBInstances.Count > 0)
                localDBInstance = localDBInstances[0];

            replacementsDictionary["connectionString=\"Data Source=(LocalDb)\\v11.0;"] =
                "connectionString=\"Data Source=(LocalDb)\\" + localDBInstance + ";";

            if (!replacementsDictionary.TryGetValue("$wizarddata$", out wizardData))
                wizardData = null;
        }
开发者ID:C-DUCK,项目名称:Sningle,代码行数:30,代码来源:ChildWizard.cs


示例8: Initialize

 public static void Initialize(IServiceProvider serviceProvider, DTE dte)
 {
     ErrorList.Initialize(serviceProvider, dte);
     ClangServices.Initialize(dte);
     DiagnosticsBlacklist.Initialize();
     initialized = true;
 }
开发者ID:saaadhu,项目名称:naggy,代码行数:7,代码来源:DiagnosticsFinder.cs


示例9: DriverUI

        public DriverUI(DTE dte, Window outputWindow, OutputWindowPane pane)
        {
            _dte = dte;
            _outputWindow = outputWindow;
            _pane = pane;
            _buttonTag = Guid.NewGuid().ToString();

            // http://stackoverflow.com/questions/12049362/programmatically-add-add-in-button-to-the-standard-toolbar
            // add a toolbar button to the standard toolbar
            var bar = ((CommandBars)_dte.CommandBars)["Standard"];
            if (bar != null)
            {
                var control = (CommandBarButton)bar.Controls.Add(MsoControlType.msoControlButton, Type.Missing, Type.Missing, Type.Missing, true);
                control.Style = MsoButtonStyle.msoButtonIcon;
                control.TooltipText = BarButtonControlCaption;
                control.Caption = BarButtonControlCaption;
                control.Tag = _buttonTag;
                control.BeginGroup = true;
                control.Click += (CommandBarButton ctrl, ref bool d) =>
                {
                    _outputWindow.Visible = true;
                    pane.Activate();
                };
            }
            else
            {
                Log.W("failed to add command button, no Standard command bar");
            }

            updateUI();
        }
开发者ID:pragmatrix,项目名称:BuildOnSave,代码行数:31,代码来源:DriverUI.cs


示例10: PackageRestorer

 public PackageRestorer(IPackageRestorer restorer)
 {
     dte = (DTE)Package.GetGlobalService(typeof(DTE));
     buildEvents = dte.Events.BuildEvents;
     buildEvents.OnBuildBegin += BuildEvents_OnBuildBegin;
     this.restorer = restorer;
 }
开发者ID:freeman,项目名称:Paket.VisualStudio,代码行数:7,代码来源:PackageRestorer.cs


示例11: SolutionManager

        internal SolutionManager(DTE dte, IVsSolution vsSolution, IVsMonitorSelection vsMonitorSelection)
        {
            if (dte == null)
            {
                throw new ArgumentNullException("dte");
            }

            _initNeeded = true;
            _dte = dte;
            _vsSolution = vsSolution;
            _vsMonitorSelection = vsMonitorSelection;

            // Keep a reference to SolutionEvents so that it doesn't get GC'ed. Otherwise, we won't receive events.
            _solutionEvents = _dte.Events.SolutionEvents;

            // can be null in unit tests
            if (vsMonitorSelection != null)
            {
                Guid solutionLoadedGuid = VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid;
                _vsMonitorSelection.GetCmdUIContextCookie(ref solutionLoadedGuid, out _solutionLoadedUICookie);

                uint cookie;
                int hr = _vsMonitorSelection.AdviseSelectionEvents(this, out cookie);
                ErrorHandler.ThrowOnFailure(hr);
            }
            
            _solutionEvents.BeforeClosing += OnBeforeClosing;
            _solutionEvents.AfterClosing += OnAfterClosing;
            _solutionEvents.ProjectAdded += OnProjectAdded;
            _solutionEvents.ProjectRemoved += OnProjectRemoved;
            _solutionEvents.ProjectRenamed += OnProjectRenamed;

            // Run the init on another thread to avoid an endless loop of SolutionManager -> Project System -> VSPackageManager -> SolutionManager
            ThreadPool.QueueUserWorkItem(new WaitCallback(Init));
        }
开发者ID:sistoimenov,项目名称:NuGet2,代码行数:35,代码来源:SolutionManager.cs


示例12: SolutionList

        public SolutionList()
        {
            InitializeComponent();

            _logger = new Logger();

            _dte = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(DTE)) as DTE;
            if (_dte == null)
                return;

            _dte2 = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(DTE)) as DTE2;
            if (_dte2 == null)
                return;

            var solution = _dte.Solution;
            if (solution == null)
                return;

            var events = _dte.Events;
            var solutionEvents = events.SolutionEvents;
            solutionEvents.BeforeClosing += SolutionBeforeClosing;
            solutionEvents.ProjectRemoved += SolutionProjectRemoved;

            SetDownloadManagedEnabled(false);
            DownloadManaged.IsChecked = false;
        }
开发者ID:ikurtev,项目名称:CRMDeveloperExtensions,代码行数:26,代码来源:SolutionList.xaml.cs


示例13: DomainDispatcher

        public DomainDispatcher(PSCmdlet cmdlet)
        {
            Contract.Requires(cmdlet != null);

            _cmdlet = cmdlet;
            _dte = (DTE)cmdlet.GetVariableValue("DTE");
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:7,代码来源:DomainDispatcher.cs


示例14: Execute

 public override void Execute()
 {
   dte = GetService<DTE>(true);
   RestartTimerService(dte);
   Helpers.LogMessage(dte, dte, "*** Restart OWSTimer finished ***");
   Helpers.LogMessage(dte, dte, "");
 }
开发者ID:manuel11g,项目名称:SharePoint-Software-Factory,代码行数:7,代码来源:RestartOWSTimer.cs


示例15: BackgroundBuild2

		public BackgroundBuild2(DTE dte, OutputWindowPane pane)
		{
			_dte = dte;
			_pane = pane;
			_mainThread = SynchronizationContext.Current;
			BuildManager = new BuildManager();
		}
开发者ID:pragmatrix,项目名称:BuildOnSave,代码行数:7,代码来源:BackgroundBuild2.cs


示例16: Initialize

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

            var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if (null != mcs) {
                var id = new CommandID(GuidList.GuidCmdSet, (int)PkgCmdIDList.FormatDocumentCommand);
                _formatDocMenuCommand = new OleMenuCommand(FormatDocumentCallback, id);
                mcs.AddCommand(_formatDocMenuCommand);
                _formatDocMenuCommand.BeforeQueryStatus += OnBeforeQueryStatus;

                id = new CommandID(GuidList.GuidCmdSet, (int)PkgCmdIDList.FormatSelectionCommand);
                _formatSelMenuCommand = new OleMenuCommand(FormatSelectionCallback, id);
                mcs.AddCommand(_formatSelMenuCommand);
                _formatSelMenuCommand.BeforeQueryStatus += OnBeforeQueryStatus;
            }

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

            _documentEventListener = new DocumentEventListener(this);
            _documentEventListener.BeforeSave += OnBeforeDocumentSave;

            if (_dte.RegistryRoot.Contains("VisualStudio")) {
                _isCSharpEnabled = true;
            }

            _props = _dte.Properties["AStyle Formatter", "General"];
            _props.Item("IsCSarpEnabled").Value = _isCSharpEnabled;
        }
开发者ID:nelabidi,项目名称:astyle-extension,代码行数:29,代码来源:AStyleExtensionPackage.cs


示例17: Initialize

        protected override void Initialize()
        {
            Debug.WriteLine ("Entering Initialize() of: {0}", this);
            base.Initialize();

            _dte = (DTE)GetService(typeof(DTE));
            _events = _dte.Events;
            _documentEvents = _events.DocumentEvents;
            _documentEvents.DocumentSaved += DocumentEvents_DocumentSaved;

            var window = _dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);

            var outputWindow = (OutputWindow)window.Object;

            _outputPane = outputWindow.OutputWindowPanes
                                      .Cast<OutputWindowPane>()
                                      .FirstOrDefault(p => p.Name == "AutoRunCustomTool")
                          ?? outputWindow.OutputWindowPanes.Add("AutoRunCustomTool");
            _errorListProvider = new ErrorListProvider(this)
                                 {
                                      ProviderName = "AutoRunCustomTool",
                                      ProviderGuid = Guid.NewGuid()
                                 };
            RegisterExtenderProvider();
        }
开发者ID:VasiliyNovikov,项目名称:AutoRunCustomTool,代码行数:25,代码来源:AutoRunCustomToolPackage.cs


示例18: TryInitialize

        bool TryInitialize()
        {
            try
            {
                _dte = SiteManager.GetGlobalService<DTE>();
                _running = _dte != null;
            }
            catch
            {
                _running = false;
            }
            if (!_running) return false;
            // TODO:  seen in the wild, _dte.Solution is null (?), need to schedule and restart initialization for those scenarios.
            _solution = new DteSolution(_dte.Solution);
            _solution.ProjectChanged += HandleProjectChange;
            var environment = ServiceLocator.GetService<IEnvironment>();
            _packageManager = ServiceLocator.GetService<IPackageManager>();

            _assembliesChanged = new EventWaitHandle(false, EventResetMode.AutoReset, System.Diagnostics.Process.GetCurrentProcess().Id + ASSEMBLY_NOTIFY);
            _rootDirectory = environment.DescriptorFile.Parent;
            _projectRepository = environment.ProjectRepository;
            RegisterFileListener();
            RefreshProjects();
            _timer = new Timer(_ => RefreshProjects(), null, Timeout.Infinite, Timeout.Infinite);
            return true;
        }
开发者ID:modulexcite,项目名称:openwrap,代码行数:26,代码来源:AssemblyReferenceNotificationsPlugin.cs


示例19: GetCodeElementAtCursor

       public  CodeElement GetCodeElementAtCursor(DTE dte)
        {
           try
           {
               var cursor = getCursorTextPoint(dte);
               if (cursor != null)
               {

                   var c = cursor.CodeElement[vsCMElement.vsCMElementClass];
                   if (c != null)
                   {
                       Debug.WriteLine("Found cursor in " + c.FullName);
                     
                       return c;
                   }

                   return getCodeElementAtTextPoint(vsCMElement.vsCMElementClass,
                       dte.ActiveDocument.ProjectItem.FileCodeModel.CodeElements, cursor);

               }
           }
           catch (Exception e)
           {
               _log.Error("GetCodeElementAtCursor failed", e );
           }
           return null;

        }
开发者ID:stickleprojects,项目名称:ClassOutline,代码行数:28,代码来源:CodeElementHelper.cs


示例20: ShowContextMenu

        public static void ShowContextMenu(ContextMenuStrip contextMenu, DTE dte)
        {
            try
            {
                var serviceProvider = new ServiceProvider(dte as IServiceProvider);

                IVsUIShellOpenDocument sod = (IVsUIShellOpenDocument)serviceProvider.GetService(typeof(SVsUIShellOpenDocument));
                IVsUIHierarchy targetHier;
                uint[] targetId = new uint[1];
                IVsWindowFrame targetFrame;
                int isOpen;
                Guid viewId = new Guid(LogicalViewID.Primary);
                sod.IsDocumentOpen(null, 0, dte.ActiveWindow.Document.FullName,
                                   ref viewId, 0, out targetHier, targetId,
                                   out targetFrame, out isOpen);

                IVsTextView textView = VsShellUtilities.GetTextView(targetFrame);
                TextSelection selection = (TextSelection)dte.ActiveWindow.Document.Selection;
                Microsoft.VisualStudio.OLE.Interop.POINT[] interopPoint = new Microsoft.VisualStudio.OLE.Interop.POINT[1];
                textView.GetPointOfLineColumn(selection.ActivePoint.Line, selection.ActivePoint.LineCharOffset, interopPoint);

                POINT p = new POINT(interopPoint[0].x, interopPoint[0].y);

                ClientToScreen(textView.GetWindowHandle(), p);

                contextMenu.Show(new Point(p.x, p.y));
            }
            catch (Exception)
            {
                contextMenu.Show();
            }
        }
开发者ID:Galad,项目名称:SpecFlow,代码行数:32,代码来源:VsContextMenuManager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DTE2类代码示例发布时间:2022-05-24
下一篇:
C# DSP_TYPE类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap