コード例 #1
0
        /// <summary>
        /// Gets the fields' informations from the TFS.
        /// </summary>
        /// <param name="tpc">The TFS Team Project Collection.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">tpc</exception>
        public List <TFSField> GetFields(TfsTeamProjectCollection tpc)
        {
            if (tpc == null)
            {
                throw new ArgumentNullException("tpc");
            }

            try
            {
                WorkItemStore workItemStore = (WorkItemStore)tpc.GetService(typeof(WorkItemStore));
                var           collection    = workItemStore.FieldDefinitions;

                var fields = new List <TFSField>();
                foreach (FieldDefinition field in collection)
                {
                    TFSField tfsField = new TFSField(field.Name);
                    foreach (var value in field.AllowedValues)
                    {
                        tfsField.AllowedValues.Add(value.ToString());
                    }
                    fields.Add(tfsField);
                }

                return(fields);
            }
            catch
            {
                return(null);
            }
        }
コード例 #2
0
ファイル: TFSFieldTest.cs プロジェクト: pganguly/Bugger
        public void GeneralTFSFieldTest()
        {
            TFSField field = new TFSField("Work Item Type");

            Assert.AreEqual("Work Item Type", field.Name);
            Assert.IsNotNull(field.AllowedValues);
            Assert.AreEqual(0, field.AllowedValues.Count);

            field.AllowedValues.Add("Work Item");
            field.AllowedValues.Add("Bug");
            Assert.AreEqual(2, field.AllowedValues.Count);
        }
コード例 #3
0
ファイル: TFSProxy.cs プロジェクト: alibad/Bugger
        private void UpdateSettingDialogPriorityValues()
        {
            foreach (var checkString in this.settingViewModel.PriorityValues)
            {
                RemoveWeakEventListener(checkString, PriorityValuePropertyChanged);
            }
            this.settingViewModel.PriorityValues.Clear();

            string fieldName = this.settingViewModel.PropertyMappingCollection["Priority"];

            if (string.IsNullOrWhiteSpace(fieldName))
            {
                this.settingViewModel.PriorityRed = string.Empty;
                return;
            }

            TFSField priorityField = this.settingViewModel.TFSFields.FirstOrDefault(x => x.Name == fieldName);

            if (priorityField == null)
            {
                return;
            }

            foreach (var value in priorityField.AllowedValues)
            {
                CheckString checkValue = new CheckString(value);
                checkValue.IsChecked = !string.IsNullOrWhiteSpace(this.document.PriorityRed) &&
                                       this.document.PriorityRed.Contains(value);

                AddWeakEventListener(checkValue, PriorityValuePropertyChanged);

                this.settingViewModel.PriorityValues.Add(checkValue);
            }

            this.settingViewModel.PriorityRed = string.Join(PriorityRedSeparator,
                                                            this.settingViewModel.PriorityValues
                                                            .Where(x => x.IsChecked)
                                                            .Select(x => x.Name));
        }
コード例 #4
0
        public SampleTFSSettingViewModel()
            : base(new MockTFSSettingView(), new MockUriHelperVIew())
        {
            this.ConnectUri     = new Uri("https://tfs.codeplex.com:443/tfs/TFS12");
            this.BugFilterField = "Work Item Type";
            this.BugFilterValue = "Bugs";
            this.UserName       = "******";
            this.Password       = "******";

            this.PriorityValues.Add(new CheckString("High"));
            this.PriorityValues.Add(new CheckString("Medium"));
            this.PriorityValues.Add(new CheckString("Low"));
            var values = this.PriorityValues.Where(x => x.Name == "High" || x.Name == "Medium");

            foreach (var value in values)
            {
                value.IsChecked = true;
            }
            this.PriorityRed = "High;Medium";

            var field = new TFSField("Work Item Type");

            field.AllowedValues.Add("Work Item");
            field.AllowedValues.Add("Bugs");

            var idField = new TFSField("ID");

            this.TFSFields.Add(idField);
            this.TFSFields.Add(field);

            this.PropertyMappingCollection["ID"] = "ID";

            this.BugFilterFields.Add(field);
            this.ProgressType  = ProgressTypes.SuccessWithError;
            this.ProgressValue = 100;
        }