From 2c8cba5d70f8c341d51cc3806a2f833e81762095 Mon Sep 17 00:00:00 2001 From: MrLuje Date: Wed, 24 Oct 2018 21:51:20 +0200 Subject: [PATCH] Dark theme (#16) * use Microsoft.VisualStudio.Shell.14.0 for compatibility * fix(ui): use brushkey to support themes fix #15 * proper Microsoft.VisualStudio.CoreUtility version --- paket.dependencies | 3 + paket.lock | 23 +++++++- vs-commitizen.Tests/paket.references | 3 +- .../vs-commitizen.Tests.csproj | 52 ++++++++++------- .../Controls/TextBoxWithHint.xaml | 22 ++++--- .../Controls/TextBoxWithHint.xaml.cs | 5 ++ vs-commitizen.vs2015/VsCommitizenView.xaml | 25 ++++---- vs-commitizen.vs2017/paket.references | 3 +- .../vs-commitizen.vs2017.csproj | 58 +++++++++++-------- 9 files changed, 127 insertions(+), 67 deletions(-) diff --git a/paket.dependencies b/paket.dependencies index fccb790..fe8ae1a 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -21,6 +21,7 @@ group vs14 framework: auto-detect source https://api.nuget.org/v3/index.json nuget Microsoft.TeamFoundationServer.ExtendedClient 14.102.0 redirects: force, copy_local: false + nuget Microsoft.VisualStudio.CoreUtility 15.5.27130 copy_local: false # avoid Could not detect any platforms from 'UAP10' issue nuget Microsoft.VisualStudio.Shell.14.0 ~> 14.0 copy_local: false nuget Microsoft.VisualStudio.Shell.Immutable.10.0 < 15.0 nuget Microsoft.VisualStudio.Shell.Immutable.11.0 < 15.0 @@ -32,7 +33,9 @@ group vs14 group vs15 framework: auto-detect source https://api.nuget.org/v3/index.json + nuget Microsoft.VisualStudio.CoreUtility 15.6.27740 copy_local: false # avoid Could not detect any platforms from 'UAP10' issue nuget Microsoft.TeamFoundationServer.ExtendedClient 15.112.1 redirects: force, copy_local: false + nuget Microsoft.VisualStudio.Shell.14.0 ~> 14.0 copy_local: false nuget Microsoft.VisualStudio.Shell.15.0 ~> 15.0 copy_local: false nuget Microsoft.VisualStudio.Shell.Interop.12.0 ~> 12.0 nuget Microsoft.VisualStudio.Threading ~> 15.0 \ No newline at end of file diff --git a/paket.lock b/paket.lock index d612833..0e0ea4b 100644 --- a/paket.lock +++ b/paket.lock @@ -254,6 +254,19 @@ NUGET Newtonsoft.Json (>= 8.0.3) System.IdentityModel.Tokens.Jwt (>= 4.0.2.206221351) WindowsAzure.ServiceBus (>= 3.3.2) + Microsoft.VisualStudio.Shell.14.0 (14.3.25407) - copy_local: false + Microsoft.VisualStudio.Imaging (>= 14.3.25407) + Microsoft.VisualStudio.OLE.Interop (>= 7.10.6070) + Microsoft.VisualStudio.Shell.Immutable.10.0 (>= 10.0.30319) + Microsoft.VisualStudio.Shell.Immutable.11.0 (>= 11.0.50727) + Microsoft.VisualStudio.Shell.Immutable.12.0 (>= 12.0.21003) + Microsoft.VisualStudio.Shell.Immutable.14.0 (>= 14.3.25407) + Microsoft.VisualStudio.Shell.Interop (>= 7.10.6071) + Microsoft.VisualStudio.Shell.Interop.8.0 (>= 8.0.50727) + Microsoft.VisualStudio.Shell.Interop.9.0 (>= 9.0.30729) + Microsoft.VisualStudio.TextManager.Interop (>= 7.10.6070) + Microsoft.VisualStudio.Threading (>= 14.1.111) + Microsoft.VisualStudio.Utilities (>= 14.3.25407) Microsoft.VisualStudio.Shell.15.0 (15.6.27413) - copy_local: false Microsoft.VisualStudio.Imaging (>= 15.6.27413) Microsoft.VisualStudio.SDK.EmbedInteropTypes (>= 15.0.16) @@ -267,6 +280,14 @@ NUGET Microsoft.VisualStudio.CoreUtility (>= 15.6.27413) Microsoft.VisualStudio.OLE.Interop (>= 7.10.6071) Microsoft.VisualStudio.Utilities (>= 15.6.27413) + Microsoft.VisualStudio.Shell.Immutable.10.0 (15.0.25415) - copy_local: false + Microsoft.VisualStudio.Shell.Framework (>= 15.0.25415) + Microsoft.VisualStudio.Shell.Immutable.11.0 (15.0.25415) - copy_local: false + Microsoft.VisualStudio.Shell.Framework (>= 15.0.25415) + Microsoft.VisualStudio.Shell.Immutable.12.0 (15.0.25415) - copy_local: false + Microsoft.VisualStudio.Shell.Framework (>= 15.0.25415) + Microsoft.VisualStudio.Shell.Immutable.14.0 (15.0.25405) - copy_local: false + Microsoft.VisualStudio.Shell.Framework (>= 15.0.25405) Microsoft.VisualStudio.Shell.Interop (7.10.6072) - copy_local: false Microsoft.VisualStudio.TextManager.Interop (>= 7.10.6071) Microsoft.VisualStudio.Shell.Interop.10.0 (10.0.30320) @@ -301,7 +322,7 @@ NUGET Microsoft.VisualStudio.Utilities (15.6.27413) - copy_local: false Microsoft.VisualStudio.Threading (>= 15.4.4) StreamJsonRpc (>= 1.2.8) - Microsoft.VisualStudio.Validation (15.3.32) + Microsoft.VisualStudio.Validation (15.3.32) - copy_local: false Newtonsoft.Json (11.0.1) - copy_local: false, redirects: force StreamJsonRpc (1.3.23) - copy_local: false Microsoft.VisualStudio.Threading (>= 15.3.20) diff --git a/vs-commitizen.Tests/paket.references b/vs-commitizen.Tests/paket.references index 2f79537..0fd434f 100644 --- a/vs-commitizen.Tests/paket.references +++ b/vs-commitizen.Tests/paket.references @@ -9,5 +9,6 @@ Xunit.StaFact group vs15 Microsoft.TeamFoundationServer.ExtendedClient copy_local: true - Microsoft.VisualStudio.Shell.15.0 copy_local: true + Microsoft.VisualStudio.Shell.14.0 copy_local: true + # Microsoft.VisualStudio.Shell.15.0 copy_local: true Microsoft.VisualStudio.Shell.Interop.12.0 \ No newline at end of file diff --git a/vs-commitizen.Tests/vs-commitizen.Tests.csproj b/vs-commitizen.Tests/vs-commitizen.Tests.csproj index a9240dc..055216c 100644 --- a/vs-commitizen.Tests/vs-commitizen.Tests.csproj +++ b/vs-commitizen.Tests/vs-commitizen.Tests.csproj @@ -605,8 +605,8 @@ - - ..\packages\vs15\Microsoft.VisualStudio.Shell.15.0\lib\net45\Microsoft.VisualStudio.Shell.15.0.dll + + ..\packages\vs15\Microsoft.VisualStudio.Shell.14.0\lib\Microsoft.VisualStudio.Shell.14.0.dll True True @@ -627,8 +627,8 @@ - - ..\packages\vs15\Microsoft.VisualStudio.Shell.Interop\lib\net11\Microsoft.VisualStudio.Shell.Interop.dll + + ..\packages\vs15\Microsoft.VisualStudio.Shell.Immutable.10.0\lib\net45\Microsoft.VisualStudio.Shell.Immutable.10.0.dll True True @@ -638,8 +638,8 @@ - - ..\packages\vs15\Microsoft.VisualStudio.Shell.Interop.10.0\lib\net20\Microsoft.VisualStudio.Shell.Interop.10.0.dll + + ..\packages\vs15\Microsoft.VisualStudio.Shell.Immutable.11.0\lib\net45\Microsoft.VisualStudio.Shell.Immutable.11.0.dll True True @@ -649,8 +649,8 @@ - - ..\packages\vs15\Microsoft.VisualStudio.Shell.Interop.11.0\lib\net20\Microsoft.VisualStudio.Shell.Interop.11.0.dll + + ..\packages\vs15\Microsoft.VisualStudio.Shell.Immutable.12.0\lib\net45\Microsoft.VisualStudio.Shell.Immutable.12.0.dll True True @@ -660,8 +660,8 @@ - - ..\packages\vs15\Microsoft.VisualStudio.Shell.Interop.12.0\lib\net20\Microsoft.VisualStudio.Shell.Interop.12.0.dll + + ..\packages\vs15\Microsoft.VisualStudio.Shell.Immutable.14.0\lib\net45\Microsoft.VisualStudio.Shell.Immutable.14.0.dll True True @@ -671,8 +671,8 @@ - - ..\packages\vs15\Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime\lib\net20\Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime.dll + + ..\packages\vs15\Microsoft.VisualStudio.Shell.Interop\lib\net11\Microsoft.VisualStudio.Shell.Interop.dll True True @@ -682,8 +682,8 @@ - - ..\packages\vs15\Microsoft.VisualStudio.Shell.Interop.15.6.DesignTime\lib\net20\Microsoft.VisualStudio.Shell.Interop.15.6.DesignTime.dll + + ..\packages\vs15\Microsoft.VisualStudio.Shell.Interop.10.0\lib\net20\Microsoft.VisualStudio.Shell.Interop.10.0.dll True True @@ -693,8 +693,8 @@ - - ..\packages\vs15\Microsoft.VisualStudio.Shell.Interop.8.0\lib\net11\Microsoft.VisualStudio.Shell.Interop.8.0.dll + + ..\packages\vs15\Microsoft.VisualStudio.Shell.Interop.11.0\lib\net20\Microsoft.VisualStudio.Shell.Interop.11.0.dll True True @@ -704,8 +704,19 @@ - - ..\packages\vs15\Microsoft.VisualStudio.Shell.Interop.9.0\lib\net11\Microsoft.VisualStudio.Shell.Interop.9.0.dll + + ..\packages\vs15\Microsoft.VisualStudio.Shell.Interop.12.0\lib\net20\Microsoft.VisualStudio.Shell.Interop.12.0.dll + True + True + + + + + + + + + ..\packages\vs15\Microsoft.VisualStudio.Shell.Interop.8.0\lib\net11\Microsoft.VisualStudio.Shell.Interop.8.0.dll True True @@ -715,8 +726,8 @@ - - ..\packages\vs15\Microsoft.VisualStudio.Text.Data\lib\net46\Microsoft.VisualStudio.Text.Data.dll + + ..\packages\vs15\Microsoft.VisualStudio.Shell.Interop.9.0\lib\net11\Microsoft.VisualStudio.Shell.Interop.9.0.dll True True @@ -761,7 +772,6 @@ - diff --git a/vs-commitizen.vs2015/Controls/TextBoxWithHint.xaml b/vs-commitizen.vs2015/Controls/TextBoxWithHint.xaml index 46acbf4..80ad522 100644 --- a/vs-commitizen.vs2015/Controls/TextBoxWithHint.xaml +++ b/vs-commitizen.vs2015/Controls/TextBoxWithHint.xaml @@ -1,24 +1,28 @@  + xmlns:platformUi="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.14.0" + mc:Ignorable="d"> - + - + Text="{Binding Path=Text, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" + MaxLength="{Binding Path=MaxLength, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" + Foreground="{DynamicResource {x:Static platformUi:CommonControlsColors.TextBoxTextBrushKey}}" + GotFocus="TxtInputBox_OnGotFocus"> + - + \ No newline at end of file diff --git a/vs-commitizen.vs2015/Controls/TextBoxWithHint.xaml.cs b/vs-commitizen.vs2015/Controls/TextBoxWithHint.xaml.cs index 26e1152..af17798 100644 --- a/vs-commitizen.vs2015/Controls/TextBoxWithHint.xaml.cs +++ b/vs-commitizen.vs2015/Controls/TextBoxWithHint.xaml.cs @@ -53,5 +53,10 @@ private void OnPropertyChanged([CallerMemberName] string propertyName = null) PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } public event PropertyChangedEventHandler PropertyChanged; + + private void TxtInputBox_OnGotFocus(object sender, RoutedEventArgs e) + { + ((TextBox)sender).SelectAll(); + } } } diff --git a/vs-commitizen.vs2015/VsCommitizenView.xaml b/vs-commitizen.vs2015/VsCommitizenView.xaml index 3a07b91..003fc32 100644 --- a/vs-commitizen.vs2015/VsCommitizenView.xaml +++ b/vs-commitizen.vs2015/VsCommitizenView.xaml @@ -4,15 +4,15 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:vs_commitizen.vs" - xmlns:Controls="clr-namespace:vs_commitizen.vs2015.Controls" xmlns:ViewModels="clr-namespace:vs_commitizen.vs.ViewModels" x:Class="vs_commitizen.vs.VsCommitizenView" + xmlns:Controls="clr-namespace:vs_commitizen.vs2015.Controls" xmlns:ViewModels="clr-namespace:vs_commitizen.vs.ViewModels" + xmlns:platformUi="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.14.0" + x:Class="vs_commitizen.vs.VsCommitizenView" x:Name="CtrlCommitizen" mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="300"> - -