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

C# Client.WorkItemStore类代码示例

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

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



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

示例1: GetTestProject

        private ITestManagementTeamProject2 GetTestProject()
        {
            var collectionUri = SpecFlow2TFSConfig.TFS_URL + "/" + SpecFlow2TFSConfig.COLLECTION.Substring(SpecFlow2TFSConfig.COLLECTION.LastIndexOf('\\') + 1);

            TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(collectionUri));

            WorkItemStore workItemStore = new WorkItemStore(tpc);

            Project project = null;

            foreach (Project p in workItemStore.Projects)
            {
                if (p.Name == SpecFlow2TFSConfig.PROJECT)
                {
                    project = p;
                    break;
                }
            }

            if (project == null)
            {
                throw new NullReferenceException("no project found for the name " + SpecFlow2TFSConfig.PROJECT);
            }

            // get test management service
            ITestManagementService2 test_service = (ITestManagementService2)tpc.GetService(typeof(ITestManagementService2));
            ITestManagementTeamProject2 test_project = test_service.GetTeamProject(project);
            return test_project;
        }
开发者ID:bvd,项目名称:SpecFlow2TFS,代码行数:29,代码来源:TfsConnector.cs


示例2: TFS

        public TFS(string servername, string domain, string username, string password)
        {
            if (string.IsNullOrEmpty(servername))
            {
                throw new ArgumentException("Parameter named:servername cannot be null or empty.");
            }

            if (string.IsNullOrEmpty(username))
            {
                throw new ArgumentException("Parameter named:username cannot be null or empty.");
            }
            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentException("Parameter named:password cannot be null or empty.");
            }
            //ICredentialsProvider provider = new UICredentialsProvider();
            //tfsServer = TeamFoundationServerFactory.GetServer(serverName, provider);
            //if (!tfsServer.HasAuthenticated)
            //    tfsServer.Authenticate();
            try
            {
                var tfsConfigurationServer = new TfsConfigurationServer(new Uri(servername),
                                                                        new NetworkCredential(username, password, domain));
                store = (WorkItemStore) tfsConfigurationServer.GetService(typeof (WorkItemStore));
            }
            catch (Exception)
            {
                var tfsServer = new TeamFoundationServer(servername, new NetworkCredential(username, password, domain));
                store = (WorkItemStore) tfsServer.GetService(typeof (WorkItemStore));
            }
        }
开发者ID:ricred,项目名称:PivotalTFS,代码行数:31,代码来源:TFS.cs


示例3: ConfigureAsync

        /// <inheritdoc/>
        public async Task ConfigureAsync(TfsServiceProviderConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if(string.IsNullOrEmpty(configuration.WorkItemType))
            {
                throw new ArgumentNullException(nameof(configuration.WorkItemType));
            }

            this.logger.Debug("Configure of TfsSoapServiceProvider started...");
            var networkCredential = new NetworkCredential(configuration.Username, configuration.Password);
            var tfsClientCredentials = new TfsClientCredentials(new BasicAuthCredential(networkCredential)) { AllowInteractive = false };
            var tfsProjectCollection = new TfsTeamProjectCollection(this.serviceUri, tfsClientCredentials);
            this.workItemType = configuration.WorkItemType;
            tfsProjectCollection.Authenticate();
            tfsProjectCollection.EnsureAuthenticated();
            this.logger.Debug("Authentication successful for {serviceUri}.", this.serviceUri.AbsoluteUri);

            await Task.Run(
                () =>
                    {
                        this.logger.Debug("Fetching workitem for id {parentWorkItemId}.", configuration.ParentWorkItemId);
                        this.workItemStore = new WorkItemStore(tfsProjectCollection);
                        this.parentWorkItem = this.workItemStore.GetWorkItem(configuration.ParentWorkItemId);
                        this.logger.Debug("Found parent work item '{title}'.", this.parentWorkItem.Title);
                    });
            this.logger.Verbose("Tfs service provider configuration complete.");
        }
开发者ID:acesiddhu,项目名称:supa,代码行数:32,代码来源:TfsSoapServiceProvider.cs


示例4: GetAtivatedChildUsCount

        private int GetAtivatedChildUsCount(WorkItemStore workItemStore, WorkItem wi)
        {
            var ids = new List<int>();

            foreach (WorkItemLink item in wi.WorkItemLinks)
            {
                if (item.LinkTypeEnd.Name == "Child")
                {
                    ids.Add(item.TargetId);
                }
            }

            var query = string.Format("SELECT [System.Id],[System.WorkItemType],[System.Title] FROM WorkItems WHERE [System.TeamProject] = 'PSG Dashboard' AND [System.WorkItemType] = 'User Story' AND [System.State] = 'Active' AND [System.Id] In ({0})", GetFormatedIds(ids));
            var workItems = workItemStore.Query(query);

            var count = 0;

            foreach (WorkItem tWi in workItems)
            {
                if (tWi.Type.Name == "User Story")
                {
                    count++;
                }
            }

            return count;
        }
开发者ID:soft-nt,项目名称:TFSRoadmap,代码行数:27,代码来源:TfsRoadmapProvider.cs


示例5: TFSWorkItemManager

        public TFSWorkItemManager(Config.InstanceConfig config)
        {
            ValidateConfig(config);

            _config = config;

            // Init TFS service objects
            _tfsServer = ConnectToTfsCollection();
            Logger.InfoFormat("Connected to TFS. Getting TFS WorkItemStore");

            _tfsStore = _tfsServer.GetService<WorkItemStore>();

            if (_tfsStore == null)
            {
                Logger.ErrorFormat("Cannot initialize TFS Store");
                throw new Exception("Cannot initialize TFS Store");
            }

            Logger.InfoFormat("Geting TFS Project");
            _tfsProject = _tfsStore.Projects[config.TfsServerConfig.Project];

            Logger.InfoFormat("Initializing WorkItems Cache");
            InitWorkItemsCache();

            _nameResolver = InitNameResolver();
        }
开发者ID:jsh121988,项目名称:mail2bug,代码行数:26,代码来源:TFSWorkItemManager.cs


示例6: WorkItemTimeCollection

        /// <summary>
        /// Search all work items
        /// </summary>
        /// <param name="store"></param>
        /// <param name="iterationPath"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        public WorkItemTimeCollection(WorkItemStore store, string iterationPath, DateTime startDate, DateTime endDate)
        {
            this.IterationPath = iterationPath;
            this.Data = new ObservableCollection<WorkItemTime>();

            // Sets a list of dates to compute
            _trackDates.Add(startDate.Date);
            for (DateTime date = startDate.Date; date <= endDate.Date; date = date.AddDays(1))
            {
                _trackDates.Add(date.AddHours(23).AddMinutes(59));
            }

            // Gets all work items for each dates
            foreach (DateTime asOfDate in _trackDates)
            {
                // Execute the query
                var wiCollection = store.Query(this.GetQueryString(asOfDate));

                // Iterate through all work items
                foreach (WorkItem wi in wiCollection)
                {
                    WorkItemTime time = new WorkItemTime(asOfDate, wi);
                    this.Data.Add(time);
                }
            }
        }
开发者ID:dvoituron,项目名称:TfsHistorical,代码行数:33,代码来源:WorkItemTimeCollection.cs


示例7: GetProjects

        public List<Project> GetProjects()
        {
            if (tfs == null)
                throw new Exception("Not logged into server!");

            if ( store==null )
                store = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));

            System.Collections.IEnumerator proColEnum = store.Projects.GetEnumerator();

            projList = new List<Project>();

            while (proColEnum.MoveNext())
            {
                Project proj = null;

                try
                {
                    proj = (Project)proColEnum.Current;
                    projList.Add(proj);
                }
                catch (Exception e)
                {
                    throw e;
                }
            }

            return projList;
        }
开发者ID:pmartins,项目名称:VSTSTimeTrackerAddin,代码行数:29,代码来源:TeamFoundationWrapper.cs


示例8: ReviewItemCollectorStrategy

 public ReviewItemCollectorStrategy(WorkItemStore store, VersionControlServer versionControlServer, IVisualStudioAdapter visualStudioAdapter, IReviewItemFilter filter)
 {
     this.store = store;
     this.versionControlServer = versionControlServer;
     this.visualStudioAdapter = visualStudioAdapter;
     this.filter = filter;
 }
开发者ID:cqse,项目名称:ScrumPowerTools,代码行数:7,代码来源:ReviewItemCollectorStrategy.cs


示例9: AddLinkToWorkItem

        public override void AddLinkToWorkItem(int parentId, int childWorkItemId, string comment)
        {
            using (var tfsProjectCollection = GetProjectCollection())
            {
                var workItemStore = new WorkItemStore(tfsProjectCollection);
                var parentWorkItem = workItemStore.GetWorkItem(parentId);
                var linked = false;

                // Update if there's an existing link already
                foreach (var link in parentWorkItem.Links)
                {
                    var relatedLink = link as RelatedLink;
                    if (relatedLink != null && relatedLink.RelatedWorkItemId == childWorkItemId)
                    {
                        relatedLink.Comment = comment;
                        linked = true;
                    }
                }

                if (!linked)
                {
                    parentWorkItem.Links.Add(new RelatedLink(childWorkItemId) { Comment = comment });
                }

                parentWorkItem.Validate();
                parentWorkItem.Save();
            }
        }
开发者ID:codito,项目名称:supa,代码行数:28,代码来源:TfsSoapServiceProviderTests.cs


示例10: Validation

        public Validation()
        {
            _tfsServer = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(ConfigurationManager.AppSettings["TfsServer"]));
            _vsoServer = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(ConfigurationManager.AppSettings["VsoServer"]));
            _vsoStore = _vsoServer.GetService<WorkItemStore>();
            _tfsStore = _tfsServer.GetService<WorkItemStore>();

            var actionValue = ConfigurationManager.AppSettings["Action"];
            if (actionValue.Equals("validate", StringComparison.OrdinalIgnoreCase))
            {
                _action = Action.Validate;
            }
            else
            {
                _action = Action.Compare;
            }

            var runDateTime = DateTime.Now.ToString("yyyy-MM-dd-HHmmss");

            var dataFilePath = ConfigurationManager.AppSettings["DataFilePath"];
            var dataDir = string.IsNullOrWhiteSpace(dataFilePath) ? Directory.GetCurrentDirectory() : dataFilePath;
            var dirName = string.Format("{0}\\Log-{1}",dataDir,runDateTime);

            if (!Directory.Exists(dirName))
            {
                Directory.CreateDirectory(dirName);
            }

            _errorLog = new Logging(string.Format("{0}\\Error.txt", dirName));
            _statusLog = new Logging(string.Format("{0}\\Status.txt", dirName));
            _fullLog = new Logging(string.Format("{0}\\FullLog.txt", dirName));

            _taskList = new List<Task>();

            if (!_action.Equals(Action.Compare))
            {
                return;
            }

            _valFieldErrorLog = new Logging(string.Format("{0}\\FieldError.txt", dirName));
            _valTagErrorLog = new Logging(string.Format("{0}\\TagError.txt", dirName));
            _valPostMigrationUpdateLog = new Logging(string.Format("{0}\\PostMigrationUpdate.txt", dirName));

            _imageLog = new Logging(string.Format("{0}\\ItemsWithImage.txt", dirName));

            _commonFields = new List<string>();
            _itemTypesToValidate = new List<string>();

            var fields = ConfigurationManager.AppSettings["CommonFields"].Split(',');
            foreach (var field in fields)
            {
                _commonFields.Add(field);
            }

            var types = ConfigurationManager.AppSettings["WorkItemTypes"].Split(',');
            foreach (var type in types)
            {
                _itemTypesToValidate.Add(type);
            }
        }
开发者ID:hshishir,项目名称:ValidationTool,代码行数:60,代码来源:Validation.cs


示例11: Main

        /// <summary>
        /// Main Execution. UI handled in separate method, as this is a procedural utility.
        /// </summary>
        /// <param name="args">Not used</param>
        private static void Main(string[] args)
        {
            string serverUrl, destProjectName, plansJSONPath, logPath, csvPath;
            UIMethod(out serverUrl, out destProjectName, out plansJSONPath, out logPath, out csvPath);

            teamCollection = new TfsTeamProjectCollection(new Uri(serverUrl));
            workItemStore = new WorkItemStore(teamCollection);

            Trace.Listeners.Clear();
            TextWriterTraceListener twtl = new TextWriterTraceListener(logPath);
            twtl.Name = "TextLogger";
            twtl.TraceOutputOptions = TraceOptions.ThreadId | TraceOptions.DateTime;
            ConsoleTraceListener ctl = new ConsoleTraceListener(false);
            ctl.TraceOutputOptions = TraceOptions.DateTime;
            Trace.Listeners.Add(twtl);
            Trace.Listeners.Add(ctl);
            Trace.AutoFlush = true;

            // Get Project
            ITestManagementTeamProject newTeamProject = GetProject(serverUrl, destProjectName);

            // Get Test Plans in Project
            ITestPlanCollection newTestPlans = newTeamProject.TestPlans.Query("Select * From TestPlan");

            // Inform user which Collection/Project we'll be working in
            Trace.WriteLine("Executing alignment tasks in collection \"" + teamCollection.Name 
                + "\",\n\tand Destination Team Project \"" + newTeamProject.TeamProjectName + "\"...");

            // Get and print all test case information
            GetAllTestPlanInfo(newTestPlans, plansJSONPath, logPath, csvPath);
            Console.WriteLine("Alignment completed. Check log file in:\n " + logPath 
                + "\nfor missing areas or other errors. Press enter to close.");
            Console.ReadLine();
        }
开发者ID:Ryanman,项目名称:CustomTools.AlignMigration,代码行数:38,代码来源:AlignMigration.cs


示例12: Close

        public void Close(string itemId, string comment)
        {
            using (var collection = new TfsTeamProjectCollection(locator.Location))
            {
                var workItemId = int.Parse(itemId);
                var workItemStore = new WorkItemStore(collection, WorkItemStoreFlags.BypassRules);
                var workItem = workItemStore.GetWorkItem(workItemId);
                var workItemDefinition = workItem.Store.Projects[workItem.Project.Name].WorkItemTypes[workItem.Type.Name];

                if (workItemDefinition == null)
                {
                    throw new ArgumentException("Could not obtain work item definition to close work item");
                }

                var definitionDocument = workItemDefinition.Export(false).InnerXml;
                var xDocument = XDocument.Parse(definitionDocument);
                var graphBuilder = new StateGraphBuilder();
                var stateGraph = graphBuilder.BuildStateGraph(xDocument);
                var currentStateNode = stateGraph.FindRelative(workItem.State);

                var graphWalker = new GraphWalker<string>(currentStateNode);
                var shortestWalk = graphWalker.WalkToNode("Closed");

                foreach (var step in shortestWalk.Path)
                {
                    workItem.State = step.Value;
                    workItem.Save();
                }

                workItem.Fields[CoreField.Description].Value = comment + "<br /><br/>" + workItem.Fields[CoreField.Description].Value;
                workItem.Save();
            }
        }
开发者ID:stephengodbold,项目名称:workitem-migrator,代码行数:33,代码来源:ExampleRepositoryProvider.cs


示例13: Connect

		public ConnectionResult Connect(string host, string user, string password)
		{
			string.Format("Connecting to TFS '{0}'", host).Debug();

			try
			{
				_projectCollectionUri = new Uri(host);
			}
			catch (UriFormatException ex)
			{
				string.Format("Invalid project URL '{0}': {1}", host, ex.Message).Error();
				return ConnectionResult.InvalidUrl;
			}

			//This is used to query TFS for new WorkItems
			try
			{
				if (_projectCollectionNetworkCredentials == null)
				{
					_projectCollectionNetworkCredentials = new NetworkCredential(user, password);

					// if this is hosted TFS then we need to authenticate a little different
					// see this for setup to do on visualstudio.com site:
					// http://blogs.msdn.com/b/buckh/archive/2013/01/07/how-to-connect-to-tf-service-without-a-prompt-for-liveid-credentials.aspx
					if (_projectCollectionUri.Host.ToLowerInvariant().Contains(".visualstudio.com"))
					{

						if (_basicAuthCredential == null)
							_basicAuthCredential = new BasicAuthCredential(_projectCollectionNetworkCredentials);

						if (_tfsClientCredentials == null)
						{
							_tfsClientCredentials = new TfsClientCredentials(_basicAuthCredential);
							_tfsClientCredentials.AllowInteractive = false;
						}

					}
					if (_projectCollection == null)
					{
						_projectCollection = _tfsClientCredentials != null
							? new TfsTeamProjectCollection(_projectCollectionUri, _tfsClientCredentials)
							: new TfsTeamProjectCollection(_projectCollectionUri, _projectCollectionNetworkCredentials);
					}
					_projectCollectionWorkItemStore = new WorkItemStore(_projectCollection);

				}

				if (_projectCollectionWorkItemStore == null)
					_projectCollectionWorkItemStore = new WorkItemStore(_projectCollection);

			}
			catch (Exception e)
			{
				string.Format("Failed to connect: {0}", e.Message).Error(e);
				return ConnectionResult.FailedToConnect;
			}

			return ConnectionResult.Success;
		}
开发者ID:clickless,项目名称:LeanKit.IntegrationService,代码行数:59,代码来源:TfsConnection.cs


示例14: ReviewModel

        public ReviewModel()
        {
            teamProjectCollectionProvider = IoC.GetInstance<IVisualStudioAdapter>();
            var tpc = teamProjectCollectionProvider.GetCurrent();

            workItemStore = tpc.GetService<WorkItemStore>();
            versionControlServer = tpc.GetService<VersionControlServer>();
        }
开发者ID:cqse,项目名称:ScrumPowerTools,代码行数:8,代码来源:ReviewModel.cs


示例15: PooledWorkItemStore

        /// <summary>
        /// Initializes a new instance of the <see cref="PooledWorkItemStore"/> class.
        /// </summary>
        /// <param name="workItemStoreConnectionPool">The work item store connection pool.</param>
        /// <param name="workItemStore">The work item store.</param>
        internal PooledWorkItemStore(WorkItemStoreConnectionPool workItemStoreConnectionPool, WorkItemStore workItemStore)
        {
            if (workItemStoreConnectionPool == null) throw new ArgumentNullException("workItemStoreConnectionPool");
            if (workItemStore == null) throw new ArgumentNullException("workItemStore");

            _workItemStoreConnectionPoolReference = new WeakReference(workItemStoreConnectionPool);
            _workItemStoreReference = new WeakReference(workItemStore);
        }
开发者ID:jbattermann,项目名称:JB.Tfs.Common,代码行数:13,代码来源:PooledWorkItemStore.cs


示例16: QueryManager

 public QueryManager(Project project, TreeView tree, WorkItemStore itemStore)
 {
     ItemStore = itemStore;
     this.project = project;
     Tree = tree;
     project.QueryHierarchy.Refresh();
     BuildQueryHierarchy(project.QueryHierarchy);
 }
开发者ID:nkravch,项目名称:SALMA-2.0,代码行数:8,代码来源:QueryManager.cs


示例17: Initialize

 public void Initialize(TfsTeamProjectCollection tfs, string projectName)
 {
     _isInitialized = true;
     _workItemStore = tfs.GetService<WorkItemStore>();
     _project = _workItemStore.Projects
             .Cast<Project>()
             .SingleOrDefault(p => p.Name.Equals(projectName));
 }
开发者ID:DmitriySokhach,项目名称:KanbanizeTFSToolkit,代码行数:8,代码来源:ArborTfsProjectProvider.cs


示例18: WorkItemRead

 public WorkItemRead(TfsTeamProjectCollection tfs, Project sourceProject)
 {
     this.tfs = tfs;
     projectName = sourceProject.Name;
     store = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
     queryCol = store.Projects[sourceProject.Name].QueryHierarchy;
     workItemTypes = store.Projects[sourceProject.Name].WorkItemTypes;
 }
开发者ID:pmiossec,项目名称:TotalTfsMigrationTool,代码行数:8,代码来源:WorkItemRead.cs


示例19: GetWorkItems

        public WorkItemCollection GetWorkItems(WorkItemStore wit, string wiql)
        {
            Query qry = new Query(wit, wiql, null, false);

            ICancelableAsyncResult car = qry.BeginQuery();

            WorkItemCollection items = qry.EndQuery(car);
            return items;
        }
开发者ID:mongeon,项目名称:TFSNotifier,代码行数:9,代码来源:TFSRepository.cs


示例20: TaskListForm

        public TaskListForm(WorkItemStore wis, string project, TaskTypes type)
            : this()
        {
            this.wis = wis;
            this.project = project;
            this.type = type;

            this.Text = string.Format("Select {0}", type);
        }
开发者ID:mi-tettamanti,项目名称:tfs-outlook-addin,代码行数:9,代码来源:TaskListForm.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# EntityModel.EntityModelSchema类代码示例发布时间:2022-05-26
下一篇:
C# Client.WorkItem类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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