本文整理汇总了C#中DTE类的典型用法代码示例。如果您正苦于以下问题:C# DTE类的具体用法?C# DTE怎么用?C# DTE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DTE类属于命名空间,在下文中一共展示了DTE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: MDASolutionWizard
public MDASolutionWizard(DTE applicationObject, MDASolutionManager solutionManager, AddInSettings settings)
{
m_applicationObject = applicationObject;
m_solutionManager = solutionManager;
m_settings = settings;
InitializeComponent();
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例8: Initialize
public static void Initialize(IServiceProvider serviceProvider, DTE dte)
{
ErrorList.Initialize(serviceProvider, dte);
ClangServices.Initialize(dte);
DiagnosticsBlacklist.Initialize();
initialized = true;
}
示例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();
}
示例10: PackageRestorer
public PackageRestorer(IPackageRestorer restorer)
{
dte = (DTE)Package.GetGlobalService(typeof(DTE));
buildEvents = dte.Events.BuildEvents;
buildEvents.OnBuildBegin += BuildEvents_OnBuildBegin;
this.restorer = restorer;
}
示例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));
}
示例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;
}
示例13: DomainDispatcher
public DomainDispatcher(PSCmdlet cmdlet)
{
Contract.Requires(cmdlet != null);
_cmdlet = cmdlet;
_dte = (DTE)cmdlet.GetVariableValue("DTE");
}
示例14: Execute
public override void Execute()
{
dte = GetService<DTE>(true);
RestartTimerService(dte);
Helpers.LogMessage(dte, dte, "*** Restart OWSTimer finished ***");
Helpers.LogMessage(dte, dte, "");
}
示例15: BackgroundBuild2
public BackgroundBuild2(DTE dte, OutputWindowPane pane)
{
_dte = dte;
_pane = pane;
_mainThread = SynchronizationContext.Current;
BuildManager = new BuildManager();
}