コード例 #1
0
        /// <summary>
        /// Open a dialog form to create new work item.
        /// </summary>
        /// <param name="workItemTypeName">work item type name</param>
        /// <param name="title">work item title</param>
        /// <param name="fields">A dictionary represents the workitem fields. The key should be the ReferenceName of a field.</param>
        public static void OpenWorkItemForm(string workItemTypeName, string title = null, Dictionary <string, object> fields = null)
        {
            var settings     = MySettingsManager.GetSettings <TfsSettings>();
            var uri          = new Uri(settings.ProjectCollectionUri);
            var project      = TfsHelper.GetProject(settings.ProjectCollectionUri, settings.ProjectName);
            var workItemType = project.WorkItemTypes[workItemTypeName];

            var workItem = new WorkItem(workItemType);

            workItem.IterationPath = settings.Iteration;
            workItem.AreaPath      = settings.Area;
            workItem.Title         = title;
            if (fields != null)
            {
                foreach (var field in fields)
                {
                    foreach (Field wField in workItem.Fields)
                    {
                        if (wField.ReferenceName == field.Key)
                        {
                            wField.Value = field.Value;
                            break;
                        }
                    }
                }
            }

            var form = new WorkItemWindow(workItem);

            form.ShowDialog();
        }
コード例 #2
0
        public static void OpenWorkItemForm(int id)
        {
            var settings = MySettingsManager.GetSettings <TfsSettings>();
            var workItem = TfsHelper.GetWorkItem(settings.ProjectCollectionUri, id);
            var form     = new WorkItemWindow(workItem);

            form.ShowDialog();
        }