使用 C# 窗口服务监听 TFS 工作项状态变化 [英] Listening to TFS Work item state change using C# window service

查看:22
本文介绍了使用 C# 窗口服务监听 TFS 工作项状态变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事一个项目,我需要将数据(票证)从服务台部门同步到 TFS,反之亦然.我可以使用 Windows 服务在 TFS 中添加项目并且它运行良好.但是,每当 TFS 中工作项的状态发生变化时,我都想在帮助台系统中更新相同的状态.因此,为此我需要一个事件侦听器,它可以侦听 TFS 工作项状态更改.我正在使用 TFS2010 API,我还研究了 ISubscriber.但看起来我需要开发插件并将其放在TFS安装插件文件夹中的某个位置.我不想那样做,也不想直接使用网络服务.

I am working on a project where i need to sync data (tickets) from help desk department to TFS and vice-a-versa. i am able to add item in TFS using windows service and its running fine. but, Whenever a work item's status is change in TFS, i want to update the same in Help desk system. so for that i need an event listener kind of things which can listen to TFS work item status change. I am using TFS2010 API and i also looked into ISubscriber. but it look like i need to develop plug-in and put it in somewhere in plug-in folder of TFS installation. I don't want to do it that way, neither using web service directly.

我使用以下方法订阅事件.

I used following method to subscribe to event.

public static int RegisterWithTFS(TfsTeamProjectCollection server, string eventType, string filter, int port, string receiveMethod)
{
string serviceEndPointURL = String.Format("http://{0}:{1}/{2}", Environment.MachineName, port, receiveMethod);
var preferences = new DeliveryPreference { Schedule = DeliverySchedule.Immediate, Type = DeliveryType.Soap, Address = serviceEndPointURL };

IEventService eventService = (IEventService)server.GetService(typeof(IEventService));
string username = @"mytfsuser";
return eventService.SubscribeEvent(username, eventType, filter, preferences);

}

我想知道一种机制,一旦 TFS 中的工作项状态发生变化,就会触发我的窗口服务 (C#).这样我就可以将其更新回我的帮助台系统.谁能帮我解决这个问题?提前致谢.

I want to know a mechanism to trigger my window service (C#) as soon as the work item status change in TFS. so i can able to update it back to my helpdesk system. so can anyone help me for this problem ? Thanks in advance.

推荐答案

最后,我找到了解决方案:

Finally, i found the solution:

我开发了一个 TFS 服务器插件(而不是 Window 服务)并订阅了 TFS WorkItemChanged 事件.它继承了 ISubscriber 接口并覆盖了 ProcessEvent 方法.我需要在 TFS 服务器上的 Tfs 安装插件文件夹中部署这个插件.这种方法非常有效!!

I developed a Tfs server Plugin (instead of Window service) and subscribe to TFS WorkItemChanged event. it Inherits ISubscriber interface and override the ProcessEvent method. I need to deploy this plugin on the TFS Server in plugin folders of Tfs installation. This approach works extremely well!!

这篇关于使用 C# 窗口服务监听 TFS 工作项状态变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆