8000 Make pull request functionality more discoverable outside of Team Explorer by jcansdale · Pull Request #2473 · github/VisualStudio · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Make pull request functionality more discoverable outside of Team Explorer #2473

Merged
merged 7 commits into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Show GitHub repository on status bar
  • Loading branch information
jcansdale committed Mar 12, 2020
commit e12d36d6d39adea917ac48a2a2fd1310809268d6
8000
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async Task RefreshCurrentSession(LocalRepositoryModel repository, IPullRequestSe
return;
}

var viewModel = CreatePullRequestStatusViewModel(session);
var viewModel = CreatePullRequestStatusViewModel(repository, session);
ShowStatus(viewModel);
}

Expand Down Expand Up @@ -155,12 +155,14 @@ async Task<bool> IsDotComOrEnterpriseRepository(LocalRepositoryModel repository)
return false;
}

PullRequestStatusViewModel CreatePullRequestStatusViewModel(IPullRequestSession session)
PullRequestStatusViewModel CreatePullRequestStatusViewModel(LocalRepositoryModel repository, IPullRequestSession session)
{
var pullRequestStatusViewModel = new PullRequestStatusViewModel(openPullRequestsCommand, showCurrentPullRequestCommand);
var pullRequest = session?.PullRequest;
pullRequestStatusViewModel.Number = pullRequest?.Number;
pullRequestStatusViewModel.Title = pullRequest?.Title;
pullRequestStatusViewModel.RepositoryName = repository?.Name;
pullRequestStatusViewModel.RepositoryOwner = repository?.Owner;
return pullRequestStatusViewModel;
}

Expand Down
28 changes: 28 additions & 0 deletions src/GitHub.InlineReviews/ViewModels/PullRequestStatusViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class PullRequestStatusViewModel : INotifyPropertyChanged
{
int? number;
string title;
string repositoryName;
string repositoryOwner;

public PullRequestStatusViewModel(ICommand openPullRequestsCommand, ICommand showCurrentPullRequestCommand)
{
Expand Down Expand Up @@ -41,6 +43,32 @@ public string Title
}
}

public string RepositoryOwner
{
get { return repositoryOwner; }
set
{
if (repositoryOwner != value)
{
repositoryOwner = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(RepositoryOwner)));
}
}
}

public string RepositoryName
{
get { return repositoryName; }
set
{
if (repositoryName != value)
{
repositoryName = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(RepositoryName)));
}
}
}

public ICommand OpenPullRequestsCommand { get; }
public ICommand ShowCurrentPullRequestCommand { get; }

Expand Down
5 changes: 4 additions & 1 deletion src/GitHub.InlineReviews/Views/PullRequestStatusView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@
Fill="White"
VerticalAlignment="Bottom"
Margin="0 0 4 0 "
Icon="git_pull_request" />
Icon="mark_github" />
<TextBlock VerticalAlignment="Center">
<Run Text="{Binding RepositoryOwner}" /> / <Run Text="{Binding RepositoryName}" />
</TextBlock>
</StackPanel>
</Button>
<Grid.ToolTip>
Expand Down
0