![]() |
#3 |
Участник
|
Тянем из TFS
Вариант с получением из TFS последнего актуального задания.
Нужно добавить также Refrences: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Microsoft.TeamFoundation.WorkItemTracking.Client.dll C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Microsoft.TeamFoundation.Client.dll Также заменить: DevProject.visualstudio.com User111 Код: using EnvDTE; using EnvDTE80; using System; using Microsoft.TeamFoundation.WorkItemTracking.Client; using Microsoft.TeamFoundation.Client; public class C : VisualCommanderExt.ICommand { public String getCurText() { Uri collectionUri = new Uri("https://DevProject.visualstudio.com"); TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(collectionUri); WorkItemStore workItemStore = tpc.GetService<WorkItemStore>(); string query = "select [System.Title] " + " from " + " WorkItems " + " where [System.WorkItemType] <> '' " + " and [System.State] <> 'Closed' " + " and [System.State] <> 'Removed' " + " and [System.AssignedTo] = '" + workItemStore.UserIdentityName + "' " + " order by [Changed Date] desc"; WorkItemCollection queryResults = workItemStore.Query(query); foreach (WorkItem workItem in queryResults) { return workItem.Title.ToString(); } return ""; } public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package) { EnvDTE.TextSelection ts = DTE.ActiveDocument.Selection as EnvDTE.TextSelection; System.String s = "// " + this.getCurText() + ", User111 " + System.DateTime.Now.ToString("dd.MM.yyyy"); int StartLine = ts.TopLine; int EndLine = ts.BottomLine; if (ts.Text != "") { ts.GotoLine(StartLine); ts.StartOfLine((EnvDTE.vsStartOfLineOptions)(1)); ts.Insert(s + " -->"); ts.NewLine(1); ts.GotoLine(EndLine); ts.EndOfLine(); ts.NewLine(1); ts.Insert(s + " <--"); } else { ts.GotoLine(1); ts.NewLine(1); ts.EndOfLine(); ts.GotoLine(1); ts.Insert(s); ts.GotoLine(StartLine); } } } |
|
Теги |
ax7, editor script, полезное |
|
![]() |
||||
Тема | Ответов | |||
mfp: X++ in AX7: String truncation | 6 | |||
mfp: X++ in AX7: Garbage Collection | 0 | |||
mfp: X++ in AX7: Method signatures | 0 | |||
mfp: X++ in AX7: Const keyword | 0 | |||
mfp: X++ in AX7 | 0 |
|