Skip to content

Commit c8643f6

Browse files
committed
winui: extract shared WPF UI into project
Extract common/shared WPF UI into its own project to be consumed by the various UI helpers (GitHub.UI currently).
1 parent 235bc09 commit c8643f6

24 files changed

+82
-58
lines changed

Git-Credential-Manager.sln

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Atlassian.Bitbucket", "src\
6464
EndProject
6565
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Atlassian.Bitbucket.Tests", "src\shared\Atlassian.Bitbucket.Tests\Atlassian.Bitbucket.Tests.csproj", "{025E5329-A0B1-4BA9-9203-B70B44A5F9E0}"
6666
EndProject
67+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared.UI.Windows", "src\windows\Shared.UI.Windows\Shared.UI.Windows.csproj", "{2B3CD8FF-84A6-4B53-A28B-D7A75B0AB4D7}"
68+
EndProject
6769
Global
6870
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6971
Debug|Any CPU = Debug|Any CPU
@@ -234,6 +236,14 @@ Global
234236
{025E5329-A0B1-4BA9-9203-B70B44A5F9E0}.MacDebug|Any CPU.Build.0 = Debug|Any CPU
235237
{025E5329-A0B1-4BA9-9203-B70B44A5F9E0}.MacRelease|Any CPU.ActiveCfg = Debug|Any CPU
236238
{025E5329-A0B1-4BA9-9203-B70B44A5F9E0}.MacRelease|Any CPU.Build.0 = Debug|Any CPU
239+
{2B3CD8FF-84A6-4B53-A28B-D7A75B0AB4D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
240+
{2B3CD8FF-84A6-4B53-A28B-D7A75B0AB4D7}.MacDebug|Any CPU.ActiveCfg = Debug|Any CPU
241+
{2B3CD8FF-84A6-4B53-A28B-D7A75B0AB4D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
242+
{2B3CD8FF-84A6-4B53-A28B-D7A75B0AB4D7}.WindowsDebug|Any CPU.ActiveCfg = Debug|Any CPU
243+
{2B3CD8FF-84A6-4B53-A28B-D7A75B0AB4D7}.WindowsDebug|Any CPU.Build.0 = Debug|Any CPU
244+
{2B3CD8FF-84A6-4B53-A28B-D7A75B0AB4D7}.MacRelease|Any CPU.ActiveCfg = Release|Any CPU
245+
{2B3CD8FF-84A6-4B53-A28B-D7A75B0AB4D7}.WindowsRelease|Any CPU.ActiveCfg = Release|Any CPU
246+
{2B3CD8FF-84A6-4B53-A28B-D7A75B0AB4D7}.WindowsRelease|Any CPU.Build.0 = Release|Any CPU
237247
EndGlobalSection
238248
GlobalSection(SolutionProperties) = preSolution
239249
HideSolutionNode = FALSE
@@ -257,6 +267,7 @@ Global
257267
{4C2DBC8A-B3F2-4C64-870A-BA79DA4BD403} = {66722747-1B61-40E4-A89B-1AC8E6D62EA9}
258268
{B49881A6-E734-490E-8EA7-FB0D9E296CFB} = {D5277A0E-997E-453A-8CB9-4EFCC8B16A29}
259269
{025E5329-A0B1-4BA9-9203-B70B44A5F9E0} = {D5277A0E-997E-453A-8CB9-4EFCC8B16A29}
270+
{2B3CD8FF-84A6-4B53-A28B-D7A75B0AB4D7} = {66722747-1B61-40E4-A89B-1AC8E6D62EA9}
260271
EndGlobalSection
261272
GlobalSection(ExtensibilityGlobals) = postSolution
262273
SolutionGuid = {0EF9FC65-E6BA-45D4-A455-262A9EA4366B}

src/windows/GitHub.UI.Windows/AuthenticationPrompts.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
3-
using GitHub.UI.Controls;
43
using GitHub.UI.Dialog;
54
using GitHub.UI.Login;
5+
using Microsoft.Git.CredentialManager.UI;
66

77
namespace GitHub.UI
88
{

src/windows/GitHub.UI.Windows/Controls/IShortcutContainer.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/windows/GitHub.UI.Windows/Dialog/WindowViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using Microsoft.Git.CredentialManager.UI;
23

34
namespace GitHub.UI
45
{

src/windows/GitHub.UI.Windows/GitHub.UI.Windows.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<ItemGroup>
1313
<ProjectReference Include="..\..\shared\Microsoft.Git.CredentialManager\Microsoft.Git.CredentialManager.csproj" />
14+
<ProjectReference Include="..\Shared.UI.Windows\Shared.UI.Windows.csproj" />
1415
</ItemGroup>
1516

1617
<ItemGroup Condition="'$(OSPlatform)' != 'windows'">

src/windows/GitHub.UI.Windows/Login/Login2FaViewModel.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
using Microsoft.Git.CredentialManager;
2-
using System.Windows.Input;
1+
using System.Windows.Input;
2+
using Microsoft.Git.CredentialManager;
3+
using Microsoft.Git.CredentialManager.UI;
34

45
namespace GitHub.UI.Login
56
{

src/windows/GitHub.UI.Windows/Login/LoginCredentialsView.xaml

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<UserControl x:Class="GitHub.UI.Login.LoginCredentialsView"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
Style="{DynamicResource DialogUserControl}"
66
xmlns:controls="clr-namespace:GitHub.UI.Controls"
7-
xmlns:converters="clr-namespace:GitHub.UI.Converters"
7+
xmlns:sharedControls="clr-namespace:Microsoft.Git.CredentialManager.UI.Controls;assembly=Microsoft.Git.CredentialManager.UI"
8+
xmlns:sharedConverters="clr-namespace:Microsoft.Git.CredentialManager.UI.Converters;assembly=Microsoft.Git.CredentialManager.UI"
89
xmlns:octicons="clr-namespace:GitHub.UI.Octicons"
910
Background="{DynamicResource WindowPanelBrush}"
1011
Foreground="{DynamicResource WindowPanelTextBrush}"
@@ -18,23 +19,23 @@
1819
<ResourceDictionary.MergedDictionaries>
1920
<ResourceDictionary Source="..\Styles.xaml" />
2021
</ResourceDictionary.MergedDictionaries>
21-
<converters:NonEmptyStringToVisibleConverter x:Key="NonEmptyStringToVisibleConverter" />
22-
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
23-
<converters:BooleanAndVisibilityConverter x:Key="BooleanAndVisibilityConverter" />
22+
<sharedConverters:NonEmptyStringToVisibleConverter x:Key="NonEmptyStringToVisibleConverter" />
23+
<sharedConverters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
24+
<sharedConverters:BooleanAndVisibilityConverter x:Key="BooleanAndVisibilityConverter" />
2425
</ResourceDictionary>
2526
</Control.Resources>
2627

2728
<DockPanel Style="{DynamicResource DialogContainerDockPanel}">
2829
<DockPanel.Resources>
29-
<Style TargetType="{x:Type controls:PromptTextBox}"
30-
BasedOn="{StaticResource {x:Type controls:PromptTextBox}}">
30+
<Style TargetType="{x:Type sharedControls:PromptTextBox}"
31+
BasedOn="{StaticResource {x:Type sharedControls:PromptTextBox}}">
3132
<Setter Property="Margin" Value="0" />
3233
</Style>
3334
<Style TargetType="{x:Type Border}" x:Key="LoginButtonBorder">
3435
<Setter Property="Margin" Value="0,0,0,15" />
3536
<Setter Property="HorizontalAlignment" Value="Center" />
3637
</Style>
37-
<Style TargetType="{x:Type controls:SecurePasswordBox}" BasedOn="{StaticResource {x:Type controls:SecurePasswordBox}}">
38+
<Style TargetType="{x:Type sharedControls:SecurePasswordBox}" BasedOn="{StaticResource {x:Type sharedControls:SecurePasswordBox}}">
3839
<Setter Property="Margin" Value="0" />
3940
</Style>
4041
</DockPanel.Resources>
@@ -47,7 +48,7 @@
4748
Margin="0,0,0,10"
4849
Style="{DynamicResource GitHubH1TextBlock}"
4950
IsHitTestVisible="False"
50-
Text="Sign in"
51+
Text="Sign in"
5152
x:Uid="loginLabel"/>
5253

5354
<controls:HorizontalShadowDivider Margin="0" />
@@ -83,18 +84,18 @@
8384
<StackPanel VerticalAlignment="Center" x:Name="dotComloginControlsPanel" Margin="0,0,0,30">
8485
<StackPanel>
8586
<StackPanel Visibility="{Binding IsLoginUsingUsernameAndPasswordVisible, Converter={StaticResource BooleanToVisibilityConverter}}">
86-
<controls:PromptTextBox Text="{Binding UsernameOrEmail, UpdateSourceTrigger=PropertyChanged, Delay=300}"
87-
PromptText="Username or email"
88-
Margin="0,0,0,10"
89-
x:Uid="loginBox"
90-
x:Name="loginBox"
91-
Localization.Attributes="PromptText (Modifiable Readable Text)"/>
87+
<sharedControls:PromptTextBox Text="{Binding UsernameOrEmail, UpdateSourceTrigger=PropertyChanged, Delay=300}"
88+
PromptText="Username or email"
89+
Margin="0,0,0,10"
90+
x:Uid="loginBox"
91+
x:Name="loginBox"
92+
Localization.Attributes="PromptText (Modifiable Readable Text)"/>
9293

93-
<controls:SecurePasswordBox Password="{Binding Password, UpdateSourceTrigger=PropertyChanged, Delay=300, Mode=OneWayToSource}"
94-
PromptText="Password"
95-
x:Uid="passwordBox"
96-
x:Name="passwordBox"
97-
Localization.Attributes="PromptText (Modifiable Readable Text)"/>
94+
<sharedControls:SecurePasswordBox Password="{Binding Password, UpdateSourceTrigger=PropertyChanged, Delay=300, Mode=OneWayToSource}"
95+
PromptText="Password"
96+
x:Uid="passwordBox"
97+
x:Name="passwordBox"
98+
Localization.Attributes="PromptText (Modifiable Readable Text)"/>
9899

99100
<Border Style="{StaticResource LoginButtonBorder}" Margin="0 16 0 0">
100101
<Button Content="Sign in"

src/windows/GitHub.UI.Windows/Login/LoginCredentialsViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.ComponentModel;
22
using System.Security;
3+
using Microsoft.Git.CredentialManager.UI;
34

45
namespace GitHub.UI.Login
56
{

src/windows/GitHub.UI.Windows/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Collections.Generic;
55
using System.Linq;
66
using Microsoft.Git.CredentialManager;
7+
using Microsoft.Git.CredentialManager.UI;
78

89
namespace GitHub.UI
910
{

src/windows/GitHub.UI.Windows/Styles.xaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
xmlns:controls="clr-namespace:GitHub.UI.Controls">
3+
xmlns:sharedControls="clr-namespace:Microsoft.Git.CredentialManager.UI.Controls;assembly=Microsoft.Git.CredentialManager.UI">
44

55
<ResourceDictionary.MergedDictionaries>
66
<!-- Pull in colors -->
@@ -90,7 +90,7 @@
9090
</Style.Triggers>
9191
</Style>
9292

93-
<Style x:Key="GitHubVsPromptTextBox" TargetType="{x:Type controls:PromptTextBox}">
93+
<Style x:Key="GitHubVsPromptTextBox" TargetType="{x:Type sharedControls:PromptTextBox}">
9494
<Setter Property="Background" Value="{DynamicResource TextBoxBackgroundBrush}"/>
9595
<Setter Property="Foreground" Value="{DynamicResource TextBoxTextBrushKey}"/>
9696
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrush}"/>
@@ -103,7 +103,7 @@
103103
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
104104
<Setter Property="Template">
105105
<Setter.Value>
106-
<ControlTemplate TargetType="{x:Type controls:PromptTextBox}">
106+
<ControlTemplate TargetType="{x:Type sharedControls:PromptTextBox}">
107107
<Grid>
108108
<Border x:Name="Bd"
109109
CornerRadius="0"
@@ -217,8 +217,8 @@
217217
</Style.Triggers>
218218
</Style>
219219

220-
<Style TargetType="{x:Type controls:PromptTextBox}" BasedOn="{StaticResource GitHubVsPromptTextBox}" />
221-
<Style TargetType="{x:Type controls:SecurePasswordBox}" BasedOn="{StaticResource GitHubVsPromptTextBox}" />
220+
<Style TargetType="{x:Type sharedControls:PromptTextBox}" BasedOn="{StaticResource GitHubVsPromptTextBox}" />
221+
<Style TargetType="{x:Type sharedControls:SecurePasswordBox}" BasedOn="{StaticResource GitHubVsPromptTextBox}" />
222222
<Style TargetType="{x:Type TextBlock}" x:Key="GitHubDescriptionTextBlock">
223223
<Setter Property="FontSize" Value="16" />
224224
<Setter Property="FontWeight" Value="Thin" />

0 commit comments

Comments
 (0)