Exemplo n.º 1
0
        public ProcessInfo Get()
        {
            System.Guid processTypeId;
            ProcessInfo processInfo = null;

            VssConnection connection = Context.Connection;
            WorkItemTrackingProcessHttpClient client = connection.GetClient <WorkItemTrackingProcessHttpClient>();

            Console.Write("Get process....");

            //get a list of the procesess so i can pull the right process and get the id
            //shouldn't need to do this in production code. Just save the typeId to load process directly
            List <ProcessInfo> list = client.GetListOfProcessesAsync().Result;

            //get the process for a specific refname
            var item = list.Find(x => x.ReferenceName == _refname);

            if (item == null)
            {
                Console.WriteLine("Failed");
                Console.WriteLine("No process found for '{0}'", _refname);
            }
            else
            {
                processTypeId = item.TypeId;

                //load the process by id
                processInfo = client.GetProcessByItsIdAsync(processTypeId).Result;

                Console.WriteLine("success");
                Console.WriteLine("{0}    {1}", _refname, processInfo.TypeId);
            }

            return(processInfo);
        }
Exemplo n.º 2
0
        public ProcessInfo Process_Get()
        {
            ProcessInfo processInfo = null;

            VssConnection connection = Context.Connection;
            WorkItemTrackingProcessHttpClient client = connection.GetClient <WorkItemTrackingProcessHttpClient>();

            //extra step to get the process by name
            //you should not have to do this
            List <ProcessInfo> list = client.GetListOfProcessesAsync().Result;
            ProcessInfo        item = list.Find(x => x.ReferenceName == _refName);

            //we did not find the process by name
            if (item == null)
            {
                Console.WriteLine("Process '{0}' not found", _refName);
                return(null);
            }

            //we found something, so lets store the id in cache
            Context.SetValue <Guid>("$processId", item.TypeId);

            //load the process by id
            processInfo = client.GetProcessByItsIdAsync(item.TypeId).Result;

            Console.WriteLine("Get process...success");
            Console.WriteLine("{0}    {1}", _refName, processInfo.TypeId);

            return(processInfo);
        }
Exemplo n.º 3
0
        public ProcessInfo Process_GetById()
        {
            VssConnection connection = Context.Connection;
            WorkItemTrackingProcessHttpClient client = connection.GetClient <WorkItemTrackingProcessHttpClient>();
            List <ProcessInfo> processes             = this.Process_List();

            var processInfo = client.GetProcessByItsIdAsync(Context.GetValue <Guid>("$processId")).Result;

            return(processInfo);
        }