зеркало из https://github.com/github/VisualStudio.git
Show GitHub repository on status bar
This commit is contained in:
Родитель
6295d83005
Коммит
e12d36d6d3
|
@ -98,7 +98,7 @@ namespace GitHub.InlineReviews.Services
|
|||
return;
|
||||
}
|
||||
|
||||
var viewModel = CreatePullRequestStatusViewModel(session);
|
||||
var viewModel = CreatePullRequestStatusViewModel(repository, session);
|
||||
ShowStatus(viewModel);
|
||||
}
|
||||
|
||||
|
@ -155,12 +155,14 @@ namespace GitHub.InlineReviews.Services
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ namespace GitHub.InlineReviews.ViewModels
|
|||
{
|
||||
int? number;
|
||||
string title;
|
||||
string repositoryName;
|
||||
string repositoryOwner;
|
||||
|
||||
public PullRequestStatusViewModel(ICommand openPullRequestsCommand, ICommand showCurrentPullRequestCommand)
|
||||
{
|
||||
|
@ -41,6 +43,32 @@ namespace GitHub.InlineReviews.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
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; }
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Загрузка…
Ссылка в новой задаче