Skip to content

Commit 4e1d076

Browse files
committed
bitbucket: add stub WPF-based UI helper for Bitbucket
1 parent 14c9cd0 commit 4e1d076

12 files changed

+198
-0
lines changed

Git-Credential-Manager.sln

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Atlassian.Bitbucket.UI.Aval
5757
EndProject
5858
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.UI.Windows", "src\windows\GitHub.UI.Windows\GitHub.UI.Windows.csproj", "{0A86ED89-1FC5-42AA-925C-4578FA30607A}"
5959
EndProject
60+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Atlassian.Bitbucket.UI.Windows", "src\windows\Atlassian.Bitbucket.UI.Windows\Atlassian.Bitbucket.UI.Windows.csproj", "{3F015046-DAF2-4D2A-96EC-F9782F169E45}"
61+
EndProject
6062
Global
6163
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6264
Debug|Any CPU = Debug|Any CPU
@@ -385,6 +387,16 @@ Global
385387
{0A86ED89-1FC5-42AA-925C-4578FA30607A}.MacRelease|Any CPU.ActiveCfg = Release|Any CPU
386388
{0A86ED89-1FC5-42AA-925C-4578FA30607A}.WindowsRelease|Any CPU.ActiveCfg = Release|Any CPU
387389
{0A86ED89-1FC5-42AA-925C-4578FA30607A}.WindowsRelease|Any CPU.Build.0 = Release|Any CPU
390+
{3F015046-DAF2-4D2A-96EC-F9782F169E45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
391+
{3F015046-DAF2-4D2A-96EC-F9782F169E45}.MacDebug|Any CPU.ActiveCfg = Debug|Any CPU
392+
{3F015046-DAF2-4D2A-96EC-F9782F169E45}.Release|Any CPU.ActiveCfg = Release|Any CPU
393+
{3F015046-DAF2-4D2A-96EC-F9782F169E45}.WindowsDebug|Any CPU.ActiveCfg = Debug|Any CPU
394+
{3F015046-DAF2-4D2A-96EC-F9782F169E45}.WindowsDebug|Any CPU.Build.0 = Debug|Any CPU
395+
{3F015046-DAF2-4D2A-96EC-F9782F169E45}.LinuxDebug|Any CPU.ActiveCfg = Debug|Any CPU
396+
{3F015046-DAF2-4D2A-96EC-F9782F169E45}.LinuxRelease|Any CPU.ActiveCfg = Release|Any CPU
397+
{3F015046-DAF2-4D2A-96EC-F9782F169E45}.MacRelease|Any CPU.ActiveCfg = Release|Any CPU
398+
{3F015046-DAF2-4D2A-96EC-F9782F169E45}.WindowsRelease|Any CPU.ActiveCfg = Release|Any CPU
399+
{3F015046-DAF2-4D2A-96EC-F9782F169E45}.WindowsRelease|Any CPU.Build.0 = Release|Any CPU
388400
EndGlobalSection
389401
GlobalSection(SolutionProperties) = preSolution
390402
HideSolutionNode = FALSE
@@ -416,6 +428,7 @@ Global
416428
{459501A8-31E6-41CB-BE54-D31FFF4B2007} = {D5277A0E-997E-453A-8CB9-4EFCC8B16A29}
417429
{714ACBE7-0C69-4D8A-9224-22792CAA8264} = {D5277A0E-997E-453A-8CB9-4EFCC8B16A29}
418430
{0A86ED89-1FC5-42AA-925C-4578FA30607A} = {66722747-1B61-40E4-A89B-1AC8E6D62EA9}
431+
{3F015046-DAF2-4D2A-96EC-F9782F169E45} = {66722747-1B61-40E4-A89B-1AC8E6D62EA9}
419432
EndGlobalSection
420433
GlobalSection(ExtensibilityGlobals) = postSolution
421434
SolutionGuid = {0EF9FC65-E6BA-45D4-A455-262A9EA4366B}
13.1 KB
Loading
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net472</TargetFramework>
6+
<UseWPF>true</UseWPF>
7+
<RootNamespace>Atlassian.Bitbucket.UI</RootNamespace>
8+
<AssemblyName>Atlassian.Bitbucket.UI</AssemblyName>
9+
<StartupObject>Atlassian.Bitbucket.UI.Program</StartupObject>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<ProjectReference Include="..\..\shared\Atlassian.Bitbucket.UI\Atlassian.Bitbucket.UI.csproj" />
14+
<ProjectReference Include="..\..\shared\Microsoft.Git.CredentialManager.UI\Microsoft.Git.CredentialManager.UI.csproj" />
15+
<ProjectReference Include="..\Shared.UI.Windows\Shared.UI.Windows.csproj" />
16+
</ItemGroup>
17+
18+
<ItemGroup Condition="'$(OSPlatform)' != 'windows'">
19+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
20+
</ItemGroup>
21+
22+
<ItemGroup>
23+
<Resource Include="Assets\atlassian-logo.png" />
24+
</ItemGroup>
25+
26+
</Project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Threading;
2+
using System.Threading.Tasks;
3+
using Atlassian.Bitbucket.UI.ViewModels;
4+
using Atlassian.Bitbucket.UI.Views;
5+
using Microsoft.Git.CredentialManager;
6+
using Microsoft.Git.CredentialManager.UI;
7+
8+
namespace Atlassian.Bitbucket.UI.Commands
9+
{
10+
public class CredentialsCommandImpl : CredentialsCommand
11+
{
12+
public CredentialsCommandImpl(ICommandContext context) : base(context) { }
13+
14+
protected override Task ShowAsync(CredentialsViewModel viewModel, CancellationToken ct)
15+
{
16+
return Gui.ShowDialogWindow(viewModel, () => new CredentialsView(), GetParentHandle());
17+
}
18+
}
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Threading;
2+
using System.Threading.Tasks;
3+
using Atlassian.Bitbucket.UI.ViewModels;
4+
using Atlassian.Bitbucket.UI.Views;
5+
using Microsoft.Git.CredentialManager;
6+
using Microsoft.Git.CredentialManager.UI;
7+
8+
namespace Atlassian.Bitbucket.UI.Commands
9+
{
10+
public class OAuthCommandImpl : OAuthCommand
11+
{
12+
public OAuthCommandImpl(ICommandContext context) : base(context) { }
13+
14+
protected override Task ShowAsync(OAuthViewModel viewModel, CancellationToken ct)
15+
{
16+
return Gui.ShowDialogWindow(viewModel, () => new OAuthView(), GetParentHandle());
17+
}
18+
}
19+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Window x:Class="Atlassian.Bitbucket.UI.Controls.TesterWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
mc:Ignorable="d"
7+
Title="Bitbucket Authentication Dialog Tester"
8+
Height="240" Width="420" ResizeMode="NoResize">
9+
<DockPanel>
10+
<Button Content="Show Credentials Dialog" Padding="10" Click="ShowCredentials" />
11+
<Button Content="Show OAuth Dialog" Padding="10" Click="ShowOAuth" />
12+
</DockPanel>
13+
</Window>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System.Windows;
2+
using Atlassian.Bitbucket.UI.ViewModels;
3+
using Atlassian.Bitbucket.UI.Views;
4+
using Microsoft.Git.CredentialManager.Interop.Windows;
5+
using Microsoft.Git.CredentialManager.UI.Controls;
6+
7+
namespace Atlassian.Bitbucket.UI.Controls
8+
{
9+
public partial class TesterWindow : Window
10+
{
11+
private readonly WindowsEnvironment _environment = new WindowsEnvironment(new WindowsFileSystem());
12+
13+
public TesterWindow()
14+
{
15+
InitializeComponent();
16+
}
17+
18+
private void ShowCredentials(object sender, RoutedEventArgs e)
19+
{
20+
var vm = new CredentialsViewModel(_environment);
21+
var view = new CredentialsView();
22+
var window = new DialogWindow(view) { DataContext = vm };
23+
window.ShowDialog();
24+
}
25+
26+
private void ShowOAuth(object sender, RoutedEventArgs e)
27+
{
28+
var vm = new OAuthViewModel(_environment);
29+
var view = new OAuthView();
30+
var window = new DialogWindow(view) { DataContext = vm };
31+
window.ShowDialog();
32+
}
33+
}
34+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Atlassian.Bitbucket.UI.Commands;
4+
using Atlassian.Bitbucket.UI.Controls;
5+
using Microsoft.Git.CredentialManager;
6+
using Microsoft.Git.CredentialManager.UI;
7+
8+
namespace Atlassian.Bitbucket.UI
9+
{
10+
public static class Program
11+
{
12+
public static async Task Main(string[] args)
13+
{
14+
string appPath = ApplicationBase.GetEntryApplicationPath();
15+
using (var context = new CommandContext(appPath))
16+
using (var app = new HelperApplication(context))
17+
{
18+
if (args.Length == 0)
19+
{
20+
await Gui.ShowWindow(() => new TesterWindow(), IntPtr.Zero);
21+
return;
22+
}
23+
24+
app.RegisterCommand(new CredentialsCommandImpl(context));
25+
app.RegisterCommand(new OAuthCommandImpl(context));
26+
27+
int exitCode = app.RunAsync(args)
28+
.ConfigureAwait(false)
29+
.GetAwaiter()
30+
.GetResult();
31+
32+
Environment.Exit(exitCode);
33+
}
34+
}
35+
}
36+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<UserControl x:Class="Atlassian.Bitbucket.UI.Views.CredentialsView"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
mc:Ignorable="d">
7+
</UserControl>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Windows.Controls;
2+
3+
namespace Atlassian.Bitbucket.UI.Views
4+
{
5+
public partial class CredentialsView : UserControl
6+
{
7+
public CredentialsView()
8+
{
9+
InitializeComponent();
10+
}
11+
}
12+
}

0 commit comments

Comments
 (0)