SelectWorkItemById() public method

public SelectWorkItemById ( int workItemId ) : void
workItemId int
return void
Exemplo n.º 1
0
        private void Unshelve(ObservableCollection <object> shelvesetModels)
        {
            var success = false;

            Shelveset shelveset;
            var       shelvesetModel = (ShelvesetModel)shelvesetModels.First();

            if (teamPilgrimServiceModelProvider.TryWorkspaceUnshelve(WorkspaceServiceModel.Workspace, out shelveset,
                                                                     shelvesetModel.Shelveset.Name, shelvesetModel.Shelveset.OwnerName))
            {
                success = true;

                foreach (var workItemCheckinInfo in shelveset.WorkItemInfo)
                {
                    WorkspaceServiceModel.SelectWorkItemById(workItemCheckinInfo.WorkItem.Id);
                }

                foreach (var checkinNoteFieldValue in shelveset.CheckinNote.Values)
                {
                    WorkspaceServiceModel.RestoreCheckinNoteFieldValue(checkinNoteFieldValue);
                }
            }

            Dismiss(success);
        }
        public void Unshelve()
        {
            Shelveset shelveset;
            bool      result;

            if (PendingChanges.All(model => model.IncludeChange))
            {
                result = teamPilgrimServiceModelProvider.TryWorkspaceUnshelve(WorkspaceServiceModel.Workspace, out shelveset, Shelveset.Name, Shelveset.OwnerName);
            }
            else
            {
                var itemSpecs = PendingChanges
                                .Where(model => model.IncludeChange)
                                .Select(model => new ItemSpec(model.Change))
                                .ToArray();

                result = teamPilgrimServiceModelProvider.TryWorkspaceUnshelve(WorkspaceServiceModel.Workspace, out shelveset,
                                                                              Shelveset.Name, Shelveset.OwnerName, itemSpecs);
            }

            if (result)
            {
                if (RestoreWorkItemsAndCheckinNotes)
                {
                    foreach (var workItemCheckinInfo in Shelveset.WorkItemInfo)
                    {
                        WorkspaceServiceModel.SelectWorkItemById(workItemCheckinInfo.WorkItem.Id);
                    }

                    foreach (var checkinNoteFieldValue in this.Shelveset.CheckinNote.Values)
                    {
                        WorkspaceServiceModel.RestoreCheckinNoteFieldValue(checkinNoteFieldValue);
                    }
                }

                if (!PreserveShelveset)
                {
                    teamPilgrimServiceModelProvider.TryDeleteShelveset(ProjectCollectionServiceModel.TfsTeamProjectCollection, shelveset.Name, shelveset.OwnerName);
                }
            }

            OnDismiss(result, true);
        }