/// <summary> /// Pops (applies and removes) stash by id (if operatiopn wasn't successful - shows Team Explorer notification). /// </summary> /// <param name="stashId">Stash Id.</param> public void PopStash(int stashId) { Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(); if (_gitCommandExecuter.TryPopStash(stashId, out var errorMessage)) { _teamExplorer.NavigateToPage(new Guid(TeamExplorerPageIds.GitChanges), null); RemovedStashesContainer.AddDeletedStash(stashId); } else { _teamExplorer?.ShowNotification(errorMessage, NotificationType.Error, NotificationFlags.None, null, Guid.NewGuid()); } }
/// <summary> /// Removes stash by id (if operatiopn wasn't successful - shows Team Explorer notification). /// </summary> /// <param name="stashId">Stash Id.</param> public void DeleteStash(int stashId) { Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(); if (_gitCommandExecuter.TryDeleteStash(stashId, out var errorMessage)) { _teamExplorer.CurrentPage.RefreshPageAndSections(); RemovedStashesContainer.AddDeletedStash(stashId); } else { _teamExplorer?.ShowNotification(errorMessage, NotificationType.Error, NotificationFlags.None, null, Guid.NewGuid()); } }
public StashListSectionViewModel(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; _teamExplorer = _serviceProvider.GetService(typeof(ITeamExplorer)) as ITeamExplorer; _gitCommandExecuter = new GitCommandExecuter(serviceProvider); _gitService = new VisualStudioGitService(_serviceProvider); UpdateStashList(string.Empty); RemovedStashesContainer.ResetContainer(); PropertyChanged += (e, s) => { if (s.PropertyName == nameof(SearchText)) { UpdateStashList(SearchText); } }; }