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 UnshelveDetailsServiceModel(ITeamPilgrimServiceModelProvider teamPilgrimServiceModelProvider, ITeamPilgrimVsService teamPilgrimVsService, ProjectCollectionServiceModel projectCollectionServiceModel, WorkspaceServiceModel workspaceServiceModel, UnshelveServiceModel unshelveServiceModel, Shelveset shelveset) : base(teamPilgrimServiceModelProvider, teamPilgrimVsService) { ProjectCollectionServiceModel = projectCollectionServiceModel; WorkspaceServiceModel = workspaceServiceModel; UnshelveServiceModel = unshelveServiceModel; Shelveset = shelveset; PendingChanges = new ObservableCollection<PendingChangeModel>(); CancelCommand = new RelayCommand(Cancel, CanCancel); UnshelveCommand = new RelayCommand(Unshelve, CanUnshelve); SelectPendingChangesCommand = new RelayCommand<SelectPendingChangesCommandArgument>(SelectPendingChanges, CanSelectPendingChanges); SelectWorkItemsCommand = new RelayCommand<SelectWorkItemsCommandArgument>(SelectWorkItems, CanSelectWorkItems); PendingSet[] pendingSets; if (teamPilgrimServiceModelProvider.TryWorkspaceQueryShelvedChanges(WorkspaceServiceModel.Workspace, out pendingSets, shelveset.Name, shelveset.OwnerName, null)) { PendingSet = pendingSets.First(); foreach (var pendingChange in PendingSet.PendingChanges) { PendingChanges.Add(new PendingChangeModel(pendingChange) { IncludeChange = true }); } } PopulateSelectedPendingChangesSummary(); }
public UnshelveDetailsServiceModel(ITeamPilgrimServiceModelProvider teamPilgrimServiceModelProvider, ITeamPilgrimVsService teamPilgrimVsService, ProjectCollectionServiceModel projectCollectionServiceModel, WorkspaceServiceModel workspaceServiceModel, UnshelveServiceModel unshelveServiceModel, Shelveset shelveset) : base(teamPilgrimServiceModelProvider, teamPilgrimVsService) { ProjectCollectionServiceModel = projectCollectionServiceModel; WorkspaceServiceModel = workspaceServiceModel; UnshelveServiceModel = unshelveServiceModel; Shelveset = shelveset; PendingChanges = new ObservableCollection <PendingChangeModel>(); CancelCommand = new RelayCommand(Cancel, CanCancel); UnshelveCommand = new RelayCommand(Unshelve, CanUnshelve); SelectPendingChangesCommand = new RelayCommand <SelectPendingChangesCommandArgument>(SelectPendingChanges, CanSelectPendingChanges); SelectWorkItemsCommand = new RelayCommand <SelectWorkItemsCommandArgument>(SelectWorkItems, CanSelectWorkItems); PendingSet[] pendingSets; if (teamPilgrimServiceModelProvider.TryWorkspaceQueryShelvedChanges(WorkspaceServiceModel.Workspace, out pendingSets, shelveset.Name, shelveset.OwnerName, null)) { PendingSet = pendingSets.First(); foreach (var pendingChange in PendingSet.PendingChanges) { PendingChanges.Add(new PendingChangeModel(pendingChange) { IncludeChange = true }); } } PopulateSelectedPendingChangesSummary(); }
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); }
public UnshelveServiceModel(ITeamPilgrimServiceModelProvider teamPilgrimServiceModelProvider, ITeamPilgrimVsService teamPilgrimVsService, ProjectCollectionServiceModel projectCollectionServiceModel, WorkspaceServiceModel workspaceServiceModel) : base(teamPilgrimServiceModelProvider, teamPilgrimVsService) { ProjectCollectionServiceModel = projectCollectionServiceModel; WorkspaceServiceModel = workspaceServiceModel; ShelvesetOwner = projectCollectionServiceModel.TfsTeamProjectCollection.AuthorizedIdentity.UniqueName; FindShelvesetsCommand = new RelayCommand<string>(FindShelvesets, CanFindShelvesets); CancelCommand = new RelayCommand(Cancel, CanCancel); ViewPendingSetCommand = new RelayCommand<ShelvesetModel>(ViewPendingSet, CanViewPendingSet); UnshelveCommand = new RelayCommand<ObservableCollection<object>>(Unshelve, CanUnshelve); DeleteCommand = new RelayCommand<ObservableCollection<object>>(Delete, CanDelete); DetailsCommand = new RelayCommand<ObservableCollection<object>>(Details, CanDetails); FindShelvesetsCommand.Execute(null); }
public UnshelveServiceModel(ITeamPilgrimServiceModelProvider teamPilgrimServiceModelProvider, ITeamPilgrimVsService teamPilgrimVsService, ProjectCollectionServiceModel projectCollectionServiceModel, WorkspaceServiceModel workspaceServiceModel) : base(teamPilgrimServiceModelProvider, teamPilgrimVsService) { ProjectCollectionServiceModel = projectCollectionServiceModel; WorkspaceServiceModel = workspaceServiceModel; ShelvesetOwner = projectCollectionServiceModel.TfsTeamProjectCollection.AuthorizedIdentity.UniqueName; FindShelvesetsCommand = new RelayCommand <string>(FindShelvesets, CanFindShelvesets); CancelCommand = new RelayCommand(Cancel, CanCancel); ViewPendingSetCommand = new RelayCommand <ShelvesetModel>(ViewPendingSet, CanViewPendingSet); UnshelveCommand = new RelayCommand <ObservableCollection <object> >(Unshelve, CanUnshelve); DeleteCommand = new RelayCommand <ObservableCollection <object> >(Delete, CanDelete); DetailsCommand = new RelayCommand <ObservableCollection <object> >(Details, CanDetails); FindShelvesetsCommand.Execute(null); }
public ShelveServiceModel(ITeamPilgrimServiceModelProvider teamPilgrimServiceModelProvider, ITeamPilgrimVsService teamPilgrimVsService, ProjectCollectionServiceModel projectCollectionServiceModel, WorkspaceServiceModel workspaceServiceModel) : base(teamPilgrimServiceModelProvider, teamPilgrimVsService) { _projectCollectionServiceModel = projectCollectionServiceModel; _workspaceServiceModel = workspaceServiceModel; var versionControlServer = _projectCollectionServiceModel.TfsTeamProjectCollection.GetService<VersionControlServer>(); versionControlServer.PendingChangesChanged += VersionControlServerOnPendingChangesChanged; _filterSolution = workspaceServiceModel.FilterSolution; _selectedWorkWorkItemQueryDefinition = workspaceServiceModel.SelectedWorkItemQueryDefinition; _comment = workspaceServiceModel.Comment; EvaluateCheckInCommand = new RelayCommand(EvaluateCheckIn, CanEvaluateCheckIn); ShowSelectWorkItemQueryCommand = new RelayCommand(ShowSelectWorkItemQuery, CanShowSelectWorkItemQuery); RefreshPendingChangesCommand = new RelayCommand(RefreshPendingChanges, CanRefreshPendingChanges); RefreshSelectedDefinitionWorkItemsCommand = new RelayCommand(RefreshSelectedDefinitionWorkItems, CanRefreshSelectedDefinitionWorkItems); ShelveCommand = new RelayCommand(Shelve, CanShelve); CancelCommand = new RelayCommand(Cancel, CanCancel); SelectPendingChangesCommand = new RelayCommand<SelectPendingChangesCommandArgument>(SelectPendingChanges, CanSelectPendingChanges); SelectWorkItemsCommand = new RelayCommand<SelectWorkItemsCommandArgument>(SelectWorkItems, CanSelectWorkItems); CompareWithLatestCommand = new RelayCommand<ObservableCollection<object>>(CompareWithLatest, CanCompareWithLatest); CompareWithWorkspaceCommand = new RelayCommand<ObservableCollection<object>>(CompareWithWorkspace, CanCompareWithWorkspace); UndoPendingChangeCommand = new RelayCommand<ObservableCollection<object>>(UndoPendingChange, CanUndoPendingChange); PendingChangePropertiesCommand = new RelayCommand<ObservableCollection<object>>(PendingChangeProperties, CanPendingChangeProperties); CheckinNotes = new ObservableCollection<CheckinNoteModel>(); PendingChanges = new ObservableCollection<PendingChangeModel>(); foreach (var pendingChangeModel in workspaceServiceModel.PendingChanges) { PendingChanges.Add(new PendingChangeModel(pendingChangeModel.Change) { IncludeChange = pendingChangeModel.IncludeChange }); } PendingChanges.CollectionChanged += PendingChangesOnCollectionChanged; WorkItems = new ObservableCollection<WorkItemModel>(); foreach (var workItemModel in workspaceServiceModel.WorkItems) { WorkItems.Add(new WorkItemModel(workItemModel.WorkItem) { IsSelected = workItemModel.IsSelected, WorkItemCheckinAction = workItemModel.WorkItemCheckinAction }); } WorkItems.CollectionChanged += WorkItemsOnCollectionChanged; SolutionIsOpen = teamPilgrimVsService.Solution.IsOpen && !string.IsNullOrEmpty(teamPilgrimVsService.Solution.FileName); teamPilgrimVsService.SolutionStateChanged += () => { FilterSolution = false; SolutionIsOpen = teamPilgrimVsService.Solution.IsOpen && !string.IsNullOrEmpty(teamPilgrimVsService.Solution.FileName); }; PopulatePreviouslySelectedWorkItemQueryModels(); PopulateSelectedPendingChangesSummary(); EvaluateCheckInCommand.Execute(null); }
public ShelveServiceModel(ITeamPilgrimServiceModelProvider teamPilgrimServiceModelProvider, ITeamPilgrimVsService teamPilgrimVsService, ProjectCollectionServiceModel projectCollectionServiceModel, WorkspaceServiceModel workspaceServiceModel) : base(teamPilgrimServiceModelProvider, teamPilgrimVsService) { _projectCollectionServiceModel = projectCollectionServiceModel; _workspaceServiceModel = workspaceServiceModel; var versionControlServer = _projectCollectionServiceModel.TfsTeamProjectCollection.GetService <VersionControlServer>(); versionControlServer.PendingChangesChanged += VersionControlServerOnPendingChangesChanged; _filterSolution = workspaceServiceModel.FilterSolution; _selectedWorkWorkItemQueryDefinition = workspaceServiceModel.SelectedWorkItemQueryDefinition; _comment = workspaceServiceModel.Comment; EvaluateCheckInCommand = new RelayCommand(EvaluateCheckIn, CanEvaluateCheckIn); ShowSelectWorkItemQueryCommand = new RelayCommand(ShowSelectWorkItemQuery, CanShowSelectWorkItemQuery); RefreshPendingChangesCommand = new RelayCommand(RefreshPendingChanges, CanRefreshPendingChanges); RefreshSelectedDefinitionWorkItemsCommand = new RelayCommand(RefreshSelectedDefinitionWorkItems, CanRefreshSelectedDefinitionWorkItems); ShelveCommand = new RelayCommand(Shelve, CanShelve); CancelCommand = new RelayCommand(Cancel, CanCancel); SelectPendingChangesCommand = new RelayCommand <SelectPendingChangesCommandArgument>(SelectPendingChanges, CanSelectPendingChanges); SelectWorkItemsCommand = new RelayCommand <SelectWorkItemsCommandArgument>(SelectWorkItems, CanSelectWorkItems); CompareWithLatestCommand = new RelayCommand <ObservableCollection <object> >(CompareWithLatest, CanCompareWithLatest); CompareWithWorkspaceCommand = new RelayCommand <ObservableCollection <object> >(CompareWithWorkspace, CanCompareWithWorkspace); UndoPendingChangeCommand = new RelayCommand <ObservableCollection <object> >(UndoPendingChange, CanUndoPendingChange); PendingChangePropertiesCommand = new RelayCommand <ObservableCollection <object> >(PendingChangeProperties, CanPendingChangeProperties); CheckinNotes = new ObservableCollection <CheckinNoteModel>(); PendingChanges = new ObservableCollection <PendingChangeModel>(); foreach (var pendingChangeModel in workspaceServiceModel.PendingChanges) { PendingChanges.Add(new PendingChangeModel(pendingChangeModel.Change) { IncludeChange = pendingChangeModel.IncludeChange }); } PendingChanges.CollectionChanged += PendingChangesOnCollectionChanged; WorkItems = new ObservableCollection <WorkItemModel>(); foreach (var workItemModel in workspaceServiceModel.WorkItems) { WorkItems.Add(new WorkItemModel(workItemModel.WorkItem) { IsSelected = workItemModel.IsSelected, WorkItemCheckinAction = workItemModel.WorkItemCheckinAction }); } WorkItems.CollectionChanged += WorkItemsOnCollectionChanged; SolutionIsOpen = teamPilgrimVsService.Solution.IsOpen && !string.IsNullOrEmpty(teamPilgrimVsService.Solution.FileName); teamPilgrimVsService.SolutionStateChanged += () => { FilterSolution = false; SolutionIsOpen = teamPilgrimVsService.Solution.IsOpen && !string.IsNullOrEmpty(teamPilgrimVsService.Solution.FileName); }; PopulatePreviouslySelectedWorkItemQueryModels(); PopulateSelectedPendingChangesSummary(); EvaluateCheckInCommand.Execute(null); }
private void LoadWorkspaceModel(WorkspaceInfoModel selectedWorkspaceInfoModel) { Workspace workspace; var projectCollectionModel = ProjectCollectionModels[0]; Debug.Assert(projectCollectionModel != null, "projectCollectionModel != null"); if (teamPilgrimServiceModelProvider.TryGetWorkspace(out workspace, selectedWorkspaceInfoModel.WorkspaceInfo, projectCollectionModel.TfsTeamProjectCollection)) { SelectedWorkspaceModel = new WorkspaceServiceModel(teamPilgrimServiceModelProvider, teamPilgrimVsService, this.ActiveProjectCollectionModel, workspace); } }