Pregunta

Desarrollamos algunos productos utilizando una herramienta de diseño interno que almacena información en archivos XML. Para proporcionar una integración adecuada con TFS, también hemos codificado un proveedor que rastrea, en TFS, las operaciones de ingreso y salida de los usuarios mientras usan el diseñador, sin necesidad de interactuar con Team Explorer.

Ahora, el requisito es agregar también el elemento de trabajo relacionado al registrar archivos, busqué en Google y busqué algunas muestras de SDK, pero no pude entender si hay una manera de mostrar el mismo formulario de Windows que permita al usuario asociar el código al elemento de trabajo desde el código o tenemos que implementar el formulario completo de Windows desde el código (recuperar y buscar elementos de trabajo, asociarlos, realizar la verificación, etc.). Cualquier información sería apreciada porque entre las dos soluciones hay una gran diferencia en cuanto a la cantidad de código que necesitamos escribir.

¿Fue útil?

Solución 2

Lo he consultado con MS Consultancy y no hay forma de mostrar la ventana de registro utilizada por TFS o la extensión de shell sin recurrir a un código de bajo nivel que no es realmente seguro.

Entonces, la única solución posible es usar la API de TFS para crear un nuevo control / proyecto de C # para imitar la ventana de registro de TFS.

Saludos Massimo

Otros consejos

Aquí hay un código para ayudar con la actualización de workItems. Además, intente [este enlace] [1] para obtener más información.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Client;


namespace WorkItemTrackingSample2
{
    class Program
    {
        static void Main(string[] args)
        {
            // Connect to the server and the store.
            TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer("YourTfsServerNameHere");
            WorkItemStore workItemStore = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
            // Get a specific WorkItem from the store.
            //   Replace "12345" with a WorkItem ID appropriate for testing.
            WorkItem workItem = workItemStore.GetWorkItem(12345);

            // Save the existing Priority so we can restore it later.
            int oldPriority = (int)workItem.Fields["Priority"].Value;

            // Set the Priority to an arbitrarily high number.
            workItem.Fields["Priority"].Value = 9999;

            // Display the results of this change.
            if (workItem.IsDirty)
                Console.WriteLine("The workItem has changed, but has not been saved.");

            if (workItem.IsValid() == false)
                Console.WriteLine("The workItem is not valid.");

            if (workItem.Fields["Priority"].IsValid == false)
                Console.WriteLine("The workItem's Priority field is not valid.");

            // Tries to save the invalid WorkItem.
            try
            {
                workItem.Save();
            }
            catch (ValidationException)
            {
                Console.WriteLine("The workItem threw a ValidationException.");
            }

            // Set the priority to a more reasonable number.
            if (oldPriority == 1)
                workItem.Fields["Priority"].Value = 2;
            else
                workItem.Fields["Priority"].Value = 1;

            // If the WorkItem is valid, saves the changed WorkItem.
            if (workItem.IsValid())
            {
                workItem.Save();
                Console.WriteLine("The workItem saved this time.");
            }

            // Restore the WorkItem's Priority to its original value.
            workItem.Fields["Priority"].Value = oldPriority;
            workItem.Save();
        }
    }
}


  [1]: http://msdn.microsoft.com/en-us/library/bb130323(VS.80).aspx
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top