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

Commit 0203883

Browse files
committed
Show Login UI outside of VS
1 parent 26f76ec commit 0203883

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/GitHub.VisualStudio.TestApp/MainWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
mc:Ignorable="d"
88
Title="MainWindow" Height="450" Width="800">
99
<Grid>
10+
<Button Content="Login" HorizontalAlignment="Left" Margin="57,30,0,0" VerticalAlignment="Top" Width="133" Click="Login_Click" />
1011
<Button Content="Open from GitHub" HorizontalAlignment="Left" Margin="57,55,0,0" VerticalAlignment="Top" Width="133" Click="CloneOrOpenRepository_Click" />
1112
<Button Content="Create Repository" HorizontalAlignment="Left" Margin="57,80,0,0" VerticalAlignment="Top" Width="133" Click="CreateRepository_Click" />
1213
</Grid>

src/GitHub.VisualStudio.TestApp/MainWindow.xaml.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public MainWindow()
2020
InitializeComponent();
2121
}
2222

23+
private void Login_Click(object sender, RoutedEventArgs e)
24+
{
25+
LoginAsync();
26+
}
27+
2328
private void CloneOrOpenRepository_Click(object sender, RoutedEventArgs e)
2429
{
2530
CloneOrOpenRepositoryAsync();
@@ -30,13 +35,21 @@ private void CreateRepository_Click(object sender, RoutedEventArgs e)
3035
CreateRepositoryAsync();
3136
}
3237

38+
async Task LoginAsync()
39+
{
40+
var compositionContainer = CreateCompositionContainer();
41+
42+
var dialogService = compositionContainer.GetExportedValue<IDialogService>();
43+
await dialogService.ShowLoginDialog();
44+
}
45+
3346
async Task CreateRepositoryAsync()
3447
{
3548
var compositionContainer = CreateCompositionContainer();
3649

3750
var dialogService = compositionContainer.GetExportedValue<IDialogService>();
3851
var connection = await dialogService.ShowLoginDialog();
39-
if(connection != null)
52+
if (connection != null)
4053
{
4154
await dialogService.ShowCreateRepositoryDialog(connection);
4255
}

0 commit comments

Comments
 (0)