当前位置: 首页>>代码示例>>C#>>正文


C# VersionControlServer.GetAllTeamProjects方法代码示例

本文整理汇总了C#中Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer.GetAllTeamProjects方法的典型用法代码示例。如果您正苦于以下问题:C# VersionControlServer.GetAllTeamProjects方法的具体用法?C# VersionControlServer.GetAllTeamProjects怎么用?C# VersionControlServer.GetAllTeamProjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer的用法示例。


在下文中一共展示了VersionControlServer.GetAllTeamProjects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btn_dp_Click

        /// <summary>
        /// On Button Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_dp_Click(object sender, EventArgs e)
        {
            /*Code for picking from Server Picker TFS control
            DomainProjectPicker dp = new DomainProjectPicker(DomainProjectPickerMode.AllowMultiSelect);
            if (dp.ShowDialog() != DialogResult.Cancel)
            {

            }*/

            //bgw.DoWork += new DoWorkEventHandler(bgw_DoWork);
            //bgw.ProgressChanged += new ProgressChangedEventHandler(bgw_ProgressChanged);
            //bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgw_RunWorkerCompleted);
            //bgw.WorkerReportsProgress = true;
            //bgw.RunWorkerAsync();
            //pbrProgress.Visible = true;

            string serverChecked;
            if(rtnGIRMS27.Checked)
                serverChecked= "GIRMS27";
            else
                serverChecked= "GIRMSC9";

            _server = new TeamFoundationServer("http://"+serverChecked+":8080");

            _server.EnsureAuthenticated();
            _versionControl = (VersionControlServer)_server.GetService(typeof(VersionControlServer));
            _securityService = (IGroupSecurityService)_server.GetService(typeof(IGroupSecurityService));

            teamProjects = _versionControl.GetAllTeamProjects(false);

            lstProjects.Items.Clear();
            lstProjects.Items.Add("All TFS Projects");
            lstProjects.Items.Add("");
            dtView.DataSource = null;
            dtView.Rows.Clear();
            _glUsers.Clear();

            foreach (TeamProject tp in teamProjects)
            {
                lstProjects.Items.Add(tp.Name);
                Identity[] appGroups = _securityService.ListApplicationGroups(tp.ArtifactUri.AbsoluteUri);
                foreach (Identity group in appGroups)
                {
                    Identity[] groupMembers = _securityService.ReadIdentities(SearchFactor.Sid, new string[] { group.Sid }, QueryMembership.Expanded);
                    if (groupMembers.Length == 0) break;
                    foreach (Identity member in groupMembers)
                    {
                        if (member.Members.Length == 0) break;
                        if (member.Members != null)
                        {
                            foreach (string memberSid in member.Members)
                            {
                                Identity memberInfo = _securityService.ReadIdentity(SearchFactor.Sid, memberSid, QueryMembership.None);
                                if (memberInfo.Type != IdentityType.WindowsUser) continue;

                                if (_glUsers.Contains(memberInfo.Sid))
                                    _userDetail = (UserDetails)_glUsers[memberInfo.Sid];
                                else
                                    _userDetail = new UserDetails(memberInfo);

                                //update the project and permission
                                _userDetail.TeamProject = tp.Name;
                                _userDetail.Permission = group.DisplayName;
                                _userDetail.UpdateProjectAndPermission(tp.Name, group.DisplayName);
                                if (_glUsers.ContainsKey(memberInfo.Sid))
                                    _glUsers.Remove(memberInfo.Sid);

                                _glUsers.Add(memberInfo.Sid, _userDetail);

                            }
                        }
                    }
                }

            }
            int sn = 0;
            dtView.Rows.Add(_glUsers.Count + 1);
            foreach (UserDetails userIdentity in _glUsers.Values)
            {
                dtView.Rows[sn].Cells[0].Value = userIdentity.UserName;
                dtView.Rows[sn].Cells[1].Value = userIdentity.ADId;
                dtView.Rows[sn].Cells[2].Value = userIdentity.EmailAdd;
                dtView.Rows[sn].Cells[3].Value = userIdentity.Domain;
                string v = string.Empty;
                Hashtable ht = userIdentity.PaR;
                foreach (string str in userIdentity.PaR.Values)
                {
                    v = string.Format("{0}{1}", v, str);
                }
                dtView.Rows[sn].Cells[4].Value = v;
                dtView.Rows[sn].Cells[5].Value = userIdentity.Status;
                sn++;
            }

            lblConnectedServer.Visible = true;
//.........这里部分代码省略.........
开发者ID:sanjumj,项目名称:SIT_AchayanRepo,代码行数:101,代码来源:Form1.cs


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