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

Commit bd791b9

Browse files
committed
Make the "not a github repos" button work.
Shows the Team Explorer Sync page and opens the GitHub publish section.
1 parent 71b8bcf commit bd791b9

File tree

5 files changed

+24
-26
lines changed

5 files changed

+24
-26
lines changed

src/GitHub.App/ViewModels/NotAGitHubRepositoryViewModel.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.ComponentModel.Composition;
33
using GitHub.Exports;
4+
using GitHub.Models;
45
using GitHub.Services;
56
using GitHub.UI;
67
using ReactiveUI;
@@ -14,12 +15,15 @@ namespace GitHub.ViewModels
1415
[PartCreationPolicy(CreationPolicy.NonShared)]
1516
public class NotAGitHubRepositoryViewModel : BaseViewModel, INotAGitHubRepositoryViewModel
1617
{
18+
ITeamExplorerServices teamExplorerServices;
19+
1720
/// <summary>
1821
/// Initializes a new instance of the <see cref="NotAGitHubRepositoryViewModel"/> class.
1922
/// </summary>
2023
[ImportingConstructor]
21-
public NotAGitHubRepositoryViewModel()
24+
public NotAGitHubRepositoryViewModel(ITeamExplorerServices teamExplorerServices)
2225
{
26+
this.teamExplorerServices = teamExplorerServices;
2327
Publish = ReactiveCommand.Create();
2428
Publish.Subscribe(_ => OnPublish());
2529
}
@@ -29,17 +33,12 @@ public NotAGitHubRepositoryViewModel()
2933
/// </summary>
3034
public IReactiveCommand<object> Publish { get; }
3135

32-
/// <summary>
33-
/// Gets or sets a value indicating whether the repository publish dialog will be opened
34-
/// with the private option checked.
35-
/// </summary>
36-
public bool PublishPrivate { get; set; }
37-
3836
/// <summary>
3937
/// Called when the <see cref="Publish"/> command is executed.
4038
/// </summary>
4139
private void OnPublish()
4240
{
41+
teamExplorerServices.ShowPublishSection();
4342
}
4443
}
4544
}

src/GitHub.Exports/Services/ITeamExplorerServices.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ namespace GitHub.Services
44
{
55
public interface ITeamExplorerServices : INotificationService
66
{
7+
void ShowPublishSection();
78
void ClearNotifications();
89
}
910
}

src/GitHub.TeamFoundation.14/Services/TeamExplorerServices.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
using System;
22
using System.ComponentModel.Composition;
33
using System.Windows.Input;
4+
using GitHub.Extensions;
5+
using GitHub.VisualStudio.TeamExplorer.Sync;
46
using Microsoft.TeamFoundation.Controls;
57
using Microsoft.VisualStudio.Shell;
6-
using GitHub.Extensions;
78

89
namespace GitHub.Services
910
{
@@ -27,6 +28,14 @@ public TeamExplorerServices([Import(typeof(SVsServiceProvider))] IServiceProvide
2728
this.serviceProvider = serviceProvider;
2829
}
2930

31+
public void ShowPublishSection()
32+
{
33+
var te = serviceProvider.TryGetService<ITeamExplorer>();
34+
var foo = te.NavigateToPage(new Guid(TeamExplorerPageIds.GitCommits), null);
35+
var publish = foo?.GetSection(new Guid(GitHubPublishSection.GitHubPublishSectionId)) as GitHubPublishSection;
36+
publish?.ShowPublish();
37+
}
38+
3039
public void ShowMessage(string message)
3140
{
3241
manager = serviceProvider.TryGetService<ITeamExplorer>() as ITeamExplorerNotificationManager;

src/GitHub.TeamFoundation.14/Sync/GitHubPublishSection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void StartFlow(UIControllerFlow controllerFlow)
111111
uiProvider.RunUI();
112112
}
113113

114-
void ShowPublish()
114+
public void ShowPublish()
115115
{
116116
IsBusy = true;
117117
var uiProvider = ServiceProvider.GetExportedValue<IUIProvider>();

src/GitHub.VisualStudio/UI/Views/NotAGitHubRepositoryView.xaml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,12 @@
3838
TextAlignment="Center"
3939
HorizontalAlignment="Center"
4040
Text="Publish this repository to GitHub and get powerful collaboration, code review, and code management for open source and private projects." />
41-
<StackPanel
42-
Margin="0,5"
43-
HorizontalAlignment="Center"
44-
Orientation="Vertical">
45-
46-
<CheckBox Foreground="{DynamicResource GitHubVsToolWindowText}"
47-
IsChecked="{Binding PublishPrivate}"
48-
Margin="10">
49-
Publish as a private repository
50-
</CheckBox>
51-
52-
<Button HorizontalAlignment="Center" Style="{DynamicResource GitHubVsPrimaryActionButton}"
53-
Command="{Binding Publish}">
54-
Publish to GitHub
55-
</Button>
56-
57-
</StackPanel>
41+
<Button HorizontalAlignment="Center"
42+
Margin="0,15"
43+
Style="{DynamicResource GitHubVsPrimaryActionButton}"
44+
Command="{Binding Publish}">
45+
Get Started
46+
</Button>
5847
</StackPanel>
5948
</DockPanel>
6049
</local:GenericNotAGitHubRepositoryView>

0 commit comments

Comments
 (0)