本文整理汇总了C#中EnvDTE80类的典型用法代码示例。如果您正苦于以下问题:C# EnvDTE80类的具体用法?C# EnvDTE80怎么用?C# EnvDTE80使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EnvDTE80类属于命名空间,在下文中一共展示了EnvDTE80类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListFileDlg
public ListFileDlg(EnvDTE80.DTE2 dte,RecordHandler rec)
{
InitializeComponent();
//�����ļ���ַ
txt_FilePath.Text = RecordHandler.GetValueFromRegistry();
_manuallySettingSelection = false;
_dte = dte;
_fileNames = new System.Collections.Generic.List<ProjectItemInfo>();
foreach (EnvDTE.Project project in _dte.Solution.Projects)
{
WalkProject(project.ProjectItems);
}
LogTimer.Interval = 2000;
LogTimer.Tick += new EventHandler(LogTimer_Tick);
RecordTable = initRecordTable();
initProjectSelector();
btn_ReadRecordCurProject_Click(null, null);
de_begin.DateTime = DateTime.Today;
de_end.DateTime = DateTime.Today;
recHandler = rec;
}
示例2: GetSelectedFile
private static string GetSelectedFile(EnvDTE80.DTE2 application)
{
if (application.SelectedItems.Count == 0)
return string.Empty;
foreach (SelectedItem sel in application.SelectedItems)
{
if (sel.ProjectItem != null)
{
//The try catch block belowe fixed issue 57:
//http://github.com/spdr870/gitextensions/issues/#issue/57
try
{
return sel.ProjectItem.get_FileNames(0);
}
catch (ArgumentException)
{
if (sel.ProjectItem.FileCount > 0)
{
return sel.ProjectItem.get_FileNames(1);
}
else
{
//ignore!
}
}
}
else
if (sel.Project != null)
return sel.Project.FullName;
}
return string.Empty;
}
示例3: TFSVersionControl
public TFSVersionControl(ITFSConnection _tfsConnection, EnvDTE80.DTE2 _dte, ILogger _logger)
{
dte = _dte;
logger = _logger;
tfsConnection = _tfsConnection;
tfsConnection.ConnectionChanged += ResetConnection;
versionControlControlsAssembly = Assembly.Load(versionControlControlsAssemblyString);
folderDiffOptions = AccessPrivateWrapper.FromType(versionControlControlsAssembly, BindingFlags.NonPublic | BindingFlags.Instance, "FolderDiffOptions");
}
示例4: OnCommand
public override void OnCommand(EnvDTE80.DTE2 application, OutputWindowPane pane)
{
ThreadPool.QueueUserWorkItem(
o =>
{
string file = GitCommands.RunGitExWait("searchfile", application.Solution.FullName);
if (file == null || string.IsNullOrEmpty(file.Trim()))
return;
application.ExecuteCommand("File.OpenFile", file);
});
}
示例5: PaneDTE
/// <param name="dte2">DTE2 Context.</param>
/// <param name="name">Name of the pane.</param>
public PaneDTE(EnvDTE80.DTE2 dte2, string name)
{
if(dte2 == null) {
throw new ArgumentNullException("dte2", "cannot be null");
}
try {
pane = dte2.ToolWindows.OutputWindow.OutputWindowPanes.Item(name);
}
catch(ArgumentException) {
pane = dte2.ToolWindows.OutputWindow.OutputWindowPanes.Add(name);
}
catch(Exception ex) {
Log.Error("Log :: inner exception: '{0}'", ex.ToString());
}
}
示例6: GetProject
// http://social.msdn.microsoft.com/Forums/vstudio/en-US/36adcd56-5698-43ca-bcba-4527daabb2e3/finding-the-startup-project-in-a-complicated-solution
public static EnvDTE.Project GetProject(EnvDTE80.Solution2 solution, string uniqueName)
{
EnvDTE.Project ret = null;
if (solution != null && uniqueName != null)
{
foreach (EnvDTE.Project p in solution.Projects)
{
ret = GetSubProject(p, uniqueName);
if (ret != null)
break;
}
}
return ret;
}
示例7: AddBreakPoint
private void AddBreakPoint(EnvDTE80.DTE2 dte, string filename, int line)
{
try
{
//EnvDTE80.DTE2 dte2;
// dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.
//GetActiveObject("VisualStudio.DTE.8.0");
dte2.Debugger.Breakpoints.Add("", filename, line, 1, "", EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue,
"", "", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
}
finally
{
}
// dte2 = null;
}
示例8: GetSelectedFile
private static string GetSelectedFile(EnvDTE80.DTE2 application)
{
foreach (SelectedItem sel in application.SelectedItems)
{
if (sel.ProjectItem != null)
{
if (sel.ProjectItem.FileCount > 0)
{
//Unfortunaly FileNames[1] is not supported by .net 3.5
return sel.ProjectItem.get_FileNames(1);
}
}
else
if (sel.Project != null)
return sel.Project.FullName;
}
if (application.Solution.IsOpen)
return application.Solution.FullName;
return string.Empty;
}
示例9: IsEnabled
public override bool IsEnabled(EnvDTE80.DTE2 application)
{
bool enabled = base.IsEnabled(application);
string fileName = GetSelectedFile(application);
if (showCurrentBranch && (fileName != lastFile || DateTime.Now - lastBranchCheck > new TimeSpan(0, 0, 0, 1, 0)))
{
string newCaption = "Commit";
if (enabled)
{
string head = GitCommands.GetCurrentBranch(fileName);
if (!string.IsNullOrEmpty(head))
{
string headShort;
if (head.Length > 27)
headShort = "..." + head.Substring(head.Length - 23);
else
headShort = head;
newCaption = "Commit (" + headShort + ")";
}
}
// This guard required not only for perfromance, but also for prevent StackOverflowException.
// IDE.QueryStatus -> Commit.IsEnabled -> Plugin.UpdateCaption -> IDE.QueryStatus ...
if (_lastUpdatedCaption != newCaption)
{
_lastUpdatedCaption = newCaption;
// try apply new caption (operation can fail)
if (!Plugin.ChangeCommandCaption(application, "GitExtensions", "Commit changes", newCaption))
_lastUpdatedCaption = null;
}
lastBranchCheck = DateTime.Now;
lastFile = fileName;
}
return enabled;
}
示例10: IsEnabled
public override bool IsEnabled(EnvDTE80.DTE2 application)
{
bool enabled = base.IsEnabled(application);
string fileName = GetSelectedFile(application);
if (showCurrentBranch != null && lastBranchCheck != null && showCurrentBranch.Value && (fileName != lastFile || DateTime.Now - lastBranchCheck > new TimeSpan(0, 0, 0, 1, 0)))
{
if (enabled)
{
Plugin.ChangeCommandCaption(application, "GitExtensions", "Commit changes", "Commit" + GitCommands.GetCurrentBranch(fileName));
}
else
{
Plugin.ChangeCommandCaption(application, "GitExtensions", "Commit changes", "Commit");
}
lastBranchCheck = DateTime.Now;
lastFile = fileName;
}
return enabled;
}
示例11: Initialize
public static void Initialize(EnvDTE80.DTE2 dte)
{
TelemetryConfiguration config = TelemetryConfiguration.CreateDefault();
client = new TelemetryClient(config);
client.InstrumentationKey = "b59d19eb-668d-4ae3-b4c8-71536ebabbdc";
client.Context.User.Id = GetUserId();
client.Context.Session.Id = Guid.NewGuid().ToString();
client.Context.Properties.Add("Host", dte.Application.Edition);
client.Context.Properties.Add("HostVersion", dte.Version);
client.Context.Properties.Add("HostFullVersion", GetFullHostVersion());
client.Context.Component.Version = GetViasforaVersion();
client.Context.Properties.Add("AppVersion", GetFullHostVersion());
client.Context.Device.OperatingSystem = Environment.OSVersion.ToString();
dte.Events.DTEEvents.OnBeginShutdown += OnBeginShutdown;
var settings = SettingsContext.GetSettings();
Enabled = settings.TelemetryEnabled;
WriteEvent("Viasfora Started");
}
示例12: IsEnabled
public override bool IsEnabled(EnvDTE80.DTE2 application)
{
bool enabled = base.IsEnabled(application);
string fileName = GetSelectedFile(application);
if (showCurrentBranch && (fileName != lastFile || DateTime.Now - lastBranchCheck > new TimeSpan(0, 0, 0, 1, 0)))
{
if (enabled)
{
string head = GitCommands.GetCurrentBranch(fileName);
if (!string.IsNullOrEmpty(head))
{
string headShort;
if (head.Length > 27)
headShort = "..." + head.Substring(head.Length - 23);
else
headShort = head;
Plugin.ChangeCommandCaption(application, "GitExtensions", "Commit changes", "Commit (" + headShort + ")");
}
else
{
Plugin.ChangeCommandCaption(application, "GitExtensions", "Commit changes", "Commit");
}
}
else
{
Plugin.ChangeCommandCaption(application, "GitExtensions", "Commit changes", "Commit");
}
lastBranchCheck = DateTime.Now;
lastFile = fileName;
}
return enabled;
}
示例13: SetParameterKind
public override SyntaxNode SetParameterKind(SyntaxNode node, EnvDTE80.vsCMParameterKind kind)
{
var parameter = node as ParameterSyntax;
if (parameter == null)
{
throw Exceptions.ThrowEFail();
}
// We can't do anything with "Optional", so just strip it out and ignore it.
if ((kind & EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional) != 0)
{
kind -= EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional;
}
SyntaxTokenList newModifiers;
switch (kind)
{
case EnvDTE80.vsCMParameterKind.vsCMParameterKindOut:
newModifiers = SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.OutKeyword));
break;
case EnvDTE80.vsCMParameterKind.vsCMParameterKindRef:
newModifiers = SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.RefKeyword));
break;
case EnvDTE80.vsCMParameterKind.vsCMParameterKindIn:
case EnvDTE80.vsCMParameterKind.vsCMParameterKindNone:
newModifiers = SyntaxFactory.TokenList();
break;
case EnvDTE80.vsCMParameterKind.vsCMParameterKindParamArray:
{
var parameterList = (ParameterListSyntax)parameter.Parent;
if (parameterList.Parameters.LastOrDefault() == parameter &&
parameter.Type is ArrayTypeSyntax)
{
newModifiers = SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.ParamsKeyword));
break;
}
throw Exceptions.ThrowEInvalidArg();
}
default:
throw Exceptions.ThrowEInvalidArg();
}
return parameter.WithModifiers(newModifiers);
}
示例14: HostProjectWindow
public HostProjectWindow(EnvDTE80.DTE2 dte)
{
InitializeComponent();
this.dte = dte;
}
示例15: VisualStudio
public VisualStudio(EnvDTE80.DTE2 dte) :
base(dte, "14")
{
}