From 538789078ae97b4864240497960989e26ce7134b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20B=C3=B6rchers?= Date: Sat, 27 Nov 2021 12:45:38 +0100 Subject: [PATCH] refactoring and working with cake --- .config/dotnet-tools.json | 18 ++++++ .gitignore | 3 +- App/GlobalUsings.cs | 3 - App/ModernWpfPlayground.csproj | 32 ---------- Controls/Controls.csproj | 13 ---- Controls/Properties/AssemblyInfo.cs | 9 --- Controls/controls.csproj.DotSettings | 2 - ModernWpfPlayground.sln | 30 ++++++---- build.cake | 60 +++++++++++++++++++ {App => src/App}/App.xaml | 0 {App => src/App}/App.xaml.cs | 5 +- {App => src/App}/AssemblyInfo.cs | 4 +- {App => src/App}/ContentDialogExample.xaml | 0 {App => src/App}/ContentDialogExample.xaml.cs | 6 +- {App => src/App}/MainWindow.xaml | 2 +- {App => src/App}/MainWindow.xaml.cs | 0 {App => src/App}/MainWindowViewModel.cs | 4 +- src/App/ModernWpfPlayground.csproj | 39 ++++++++++++ .../App}/PixelsToGridLengthConverter.cs | 4 +- {App => src/App}/Types/AccentColors.cs | 3 +- {App => src/App}/Types/ThemeMode.cs | 5 +- src/Controls/AssemblyInfo.cs | 10 ++++ src/Controls/Controls.csproj | 20 +++++++ .../EnumToItemSourceConverter.cs | 0 .../PropertyPresenter/MagicSymbolControl.cs | 0 .../PropertyPresenter/MagicSymbolConverter.cs | 0 .../PropertyDataTemplateSelector.cs | 0 .../PropertyPresenter/PropertyPresenter.xaml | 0 .../PropertyPresenter.xaml.cs | 0 .../Controls}/PropertyPresenter/TextBoxEx.cs | 0 .../PropertyPresenter/TextComponent.cs | 0 .../PropertyPresenter/ValueConverter.cs | 0 32 files changed, 189 insertions(+), 83 deletions(-) create mode 100644 .config/dotnet-tools.json delete mode 100644 App/GlobalUsings.cs delete mode 100644 App/ModernWpfPlayground.csproj delete mode 100644 Controls/Controls.csproj delete mode 100644 Controls/Properties/AssemblyInfo.cs delete mode 100644 Controls/controls.csproj.DotSettings create mode 100644 build.cake rename {App => src/App}/App.xaml (100%) rename {App => src/App}/App.xaml.cs (90%) rename {App => src/App}/AssemblyInfo.cs (95%) rename {App => src/App}/ContentDialogExample.xaml (100%) rename {App => src/App}/ContentDialogExample.xaml.cs (90%) rename {App => src/App}/MainWindow.xaml (99%) rename {App => src/App}/MainWindow.xaml.cs (100%) rename {App => src/App}/MainWindowViewModel.cs (97%) create mode 100644 src/App/ModernWpfPlayground.csproj rename {App => src/App}/PixelsToGridLengthConverter.cs (92%) rename {App => src/App}/Types/AccentColors.cs (94%) rename {App => src/App}/Types/ThemeMode.cs (92%) create mode 100644 src/Controls/AssemblyInfo.cs create mode 100644 src/Controls/Controls.csproj rename {Controls => src/Controls}/PropertyPresenter/EnumToItemSourceConverter.cs (100%) rename {Controls => src/Controls}/PropertyPresenter/MagicSymbolControl.cs (100%) rename {Controls => src/Controls}/PropertyPresenter/MagicSymbolConverter.cs (100%) rename {Controls => src/Controls}/PropertyPresenter/PropertyDataTemplateSelector.cs (100%) rename {Controls => src/Controls}/PropertyPresenter/PropertyPresenter.xaml (100%) rename {Controls => src/Controls}/PropertyPresenter/PropertyPresenter.xaml.cs (100%) rename {Controls => src/Controls}/PropertyPresenter/TextBoxEx.cs (100%) rename {Controls => src/Controls}/PropertyPresenter/TextComponent.cs (100%) rename {Controls => src/Controls}/PropertyPresenter/ValueConverter.cs (100%) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..0ac569e --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,18 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "cake.tool": { + "version": "2.0.0-rc0002", + "commands": [ + "dotnet-cake" + ] + }, + "gitversion.tool": { + "version": "5.8.1", + "commands": [ + "dotnet-gitversion" + ] + } + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2cfa8d0..dbb45d9 100644 --- a/.gitignore +++ b/.gitignore @@ -338,4 +338,5 @@ ASALocalRun/ # BeatPulse healthcheck temp database healthchecksdb -.ionide \ No newline at end of file +.ionide +/tools diff --git a/App/GlobalUsings.cs b/App/GlobalUsings.cs deleted file mode 100644 index dab0812..0000000 --- a/App/GlobalUsings.cs +++ /dev/null @@ -1,3 +0,0 @@ -global using System; -global using MvvmGen; -global using System.Windows; \ No newline at end of file diff --git a/App/ModernWpfPlayground.csproj b/App/ModernWpfPlayground.csproj deleted file mode 100644 index e134061..0000000 --- a/App/ModernWpfPlayground.csproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - WinExe - net6.0-windows - true - enable - true - true - win-x64 - true - enable - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Controls/Controls.csproj b/Controls/Controls.csproj deleted file mode 100644 index 3857f15..0000000 --- a/Controls/Controls.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net6.0-windows - true - enable - - - - - - - diff --git a/Controls/Properties/AssemblyInfo.cs b/Controls/Properties/AssemblyInfo.cs deleted file mode 100644 index 95e266e..0000000 --- a/Controls/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Windows.Markup; - -[assembly: ComVisible(false)] - -[assembly: CLSCompliant(true)] - -[assembly: XmlnsDefinition("http://wpflib.de/", "Controls")] \ No newline at end of file diff --git a/Controls/controls.csproj.DotSettings b/Controls/controls.csproj.DotSettings deleted file mode 100644 index 2985ba5..0000000 --- a/Controls/controls.csproj.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - True \ No newline at end of file diff --git a/ModernWpfPlayground.sln b/ModernWpfPlayground.sln index b2dd46c..8d4b47e 100644 --- a/ModernWpfPlayground.sln +++ b/ModernWpfPlayground.sln @@ -1,11 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30002.166 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31912.275 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModernWpfPlayground", "App\ModernWpfPlayground.csproj", "{E090F4BD-69CD-4D8B-A3A2-620DCE22AE29}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{216EA1DF-5F39-4D23-9E1F-887785D1FF6C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls", "Controls\Controls.csproj", "{3884FD41-5A46-4A67-A147-57C36F0059DC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModernWpfPlayground", "src\App\ModernWpfPlayground.csproj", "{D7364CD3-5150-4FA8-90D9-07093354D7A0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controls", "src\Controls\Controls.csproj", "{3AAA0309-C1C0-44C8-A53F-E3CE8556A4D4}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -13,18 +15,22 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E090F4BD-69CD-4D8B-A3A2-620DCE22AE29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E090F4BD-69CD-4D8B-A3A2-620DCE22AE29}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E090F4BD-69CD-4D8B-A3A2-620DCE22AE29}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E090F4BD-69CD-4D8B-A3A2-620DCE22AE29}.Release|Any CPU.Build.0 = Release|Any CPU - {3884FD41-5A46-4A67-A147-57C36F0059DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3884FD41-5A46-4A67-A147-57C36F0059DC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3884FD41-5A46-4A67-A147-57C36F0059DC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3884FD41-5A46-4A67-A147-57C36F0059DC}.Release|Any CPU.Build.0 = Release|Any CPU + {D7364CD3-5150-4FA8-90D9-07093354D7A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7364CD3-5150-4FA8-90D9-07093354D7A0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7364CD3-5150-4FA8-90D9-07093354D7A0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7364CD3-5150-4FA8-90D9-07093354D7A0}.Release|Any CPU.Build.0 = Release|Any CPU + {3AAA0309-C1C0-44C8-A53F-E3CE8556A4D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3AAA0309-C1C0-44C8-A53F-E3CE8556A4D4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3AAA0309-C1C0-44C8-A53F-E3CE8556A4D4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3AAA0309-C1C0-44C8-A53F-E3CE8556A4D4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {D7364CD3-5150-4FA8-90D9-07093354D7A0} = {216EA1DF-5F39-4D23-9E1F-887785D1FF6C} + {3AAA0309-C1C0-44C8-A53F-E3CE8556A4D4} = {216EA1DF-5F39-4D23-9E1F-887785D1FF6C} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {21075E5E-39D9-4681-91A0-D9E7E0BDBB85} EndGlobalSection diff --git a/build.cake b/build.cake new file mode 100644 index 0000000..c884b37 --- /dev/null +++ b/build.cake @@ -0,0 +1,60 @@ +#tool "dotnet:?package=GitVersion.Tool" + +using System; +var target = Argument("target", "Publish"); +var configuration = Argument("configuration", "Release"); + +var gitVersion = GitVersion(new GitVersionSettings()); + +////////////////////////////////////////////////////////////////////// +// TASKS +////////////////////////////////////////////////////////////////////// + +Task("Clean") + .WithCriteria(c => HasArgument("rebuild")) + .Does(() => +{ + CleanDirectory($"./src/App/bin/{configuration}"); +}); + +Task("Build") + .IsDependentOn("Clean") + .Does(() => +{ + DotNetBuild("./ModernWpfPlayground.sln", new DotNetBuildSettings + { + Configuration = configuration, ArgumentCustomization = c=> c.Append($"/p:Version={gitVersion.AssemblySemVer}") + + }); +}); + +Task("Publish") + .IsDependentOn("Build") + .Does(() => + { + DotNetPublish("./src/App/ModernWpfPlayground.csproj", new DotNetPublishSettings{ + Configuration = configuration, + EnableCompressionInSingleFile = true, + PublishReadyToRun = true, + PublishSingleFile = true, + Runtime = "win-x64", + SelfContained = true, + }); + }); + +// Task("Test") +// .IsDependentOn("Build") +// .Does(() => +// { +// DotNetCoreTest("./src/Example.sln", new DotNetCoreTestSettings +// { +// Configuration = configuration, +// NoBuild = true, +// }); +// }); + +////////////////////////////////////////////////////////////////////// +// EXECUTION +////////////////////////////////////////////////////////////////////// + +RunTarget(target); \ No newline at end of file diff --git a/App/App.xaml b/src/App/App.xaml similarity index 100% rename from App/App.xaml rename to src/App/App.xaml diff --git a/App/App.xaml.cs b/src/App/App.xaml.cs similarity index 90% rename from App/App.xaml.cs rename to src/App/App.xaml.cs index 25cc284..85d66da 100644 --- a/App/App.xaml.cs +++ b/src/App/App.xaml.cs @@ -1,4 +1,5 @@ -using ModernWpf; +using System.Windows; +using ModernWpf; using ModernWpfPlayground.Types; namespace ModernWpfPlayground @@ -15,4 +16,4 @@ namespace ModernWpfPlayground ThemeManager.Current.AccentColor = AccentColors.Green.ToWindowsColor(); } } -} +} \ No newline at end of file diff --git a/App/AssemblyInfo.cs b/src/App/AssemblyInfo.cs similarity index 95% rename from App/AssemblyInfo.cs rename to src/App/AssemblyInfo.cs index 9f33ab1..2211234 100644 --- a/App/AssemblyInfo.cs +++ b/src/App/AssemblyInfo.cs @@ -1,3 +1,5 @@ +using System.Windows; + [assembly:ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, @@ -5,4 +7,4 @@ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) -)] \ No newline at end of file +)] diff --git a/App/ContentDialogExample.xaml b/src/App/ContentDialogExample.xaml similarity index 100% rename from App/ContentDialogExample.xaml rename to src/App/ContentDialogExample.xaml diff --git a/App/ContentDialogExample.xaml.cs b/src/App/ContentDialogExample.xaml.cs similarity index 90% rename from App/ContentDialogExample.xaml.cs rename to src/App/ContentDialogExample.xaml.cs index 3f61b02..a1073ea 100644 --- a/App/ContentDialogExample.xaml.cs +++ b/src/App/ContentDialogExample.xaml.cs @@ -1,4 +1,6 @@ -namespace ModernWpfPlayground +using System.Windows; + +namespace ModernWpfPlayground { public partial class ContentDialogExample { @@ -16,4 +18,4 @@ InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/App/MainWindow.xaml b/src/App/MainWindow.xaml similarity index 99% rename from App/MainWindow.xaml rename to src/App/MainWindow.xaml index 6cfd1dc..17409da 100644 --- a/App/MainWindow.xaml +++ b/src/App/MainWindow.xaml @@ -2,12 +2,12 @@ x:Class="ModernWpfPlayground.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:controls="http://wpflib.de/" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks" xmlns:local="clr-namespace:ModernWpfPlayground" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ui="http://schemas.modernwpf.com/2019" + xmlns:controls="clr-namespace:Controls;assembly=Controls" x:Name="Window" Title="{Binding Title}" Width="{Binding WindowWidth, Mode=TwoWay}" diff --git a/App/MainWindow.xaml.cs b/src/App/MainWindow.xaml.cs similarity index 100% rename from App/MainWindow.xaml.cs rename to src/App/MainWindow.xaml.cs diff --git a/App/MainWindowViewModel.cs b/src/App/MainWindowViewModel.cs similarity index 97% rename from App/MainWindowViewModel.cs rename to src/App/MainWindowViewModel.cs index c17dfe8..9e6cf70 100644 --- a/App/MainWindowViewModel.cs +++ b/src/App/MainWindowViewModel.cs @@ -1,4 +1,6 @@ -using ModernWpfPlayground.Types; +using System.Windows; +using ModernWpfPlayground.Types; +using MvvmGen; using static ModernWpf.ThemeManager; namespace ModernWpfPlayground diff --git a/src/App/ModernWpfPlayground.csproj b/src/App/ModernWpfPlayground.csproj new file mode 100644 index 0000000..ffbeb67 --- /dev/null +++ b/src/App/ModernWpfPlayground.csproj @@ -0,0 +1,39 @@ + + + + WinExe + net6.0-windows + enable + true + + + + + + + + + + + + + + + + + + $(DefaultXamlRuntime) + MSBuild:Compile + + + + + + $(DefaultXamlRuntime) + + + $(DefaultXamlRuntime) + MSBuild:Compile + + + diff --git a/App/PixelsToGridLengthConverter.cs b/src/App/PixelsToGridLengthConverter.cs similarity index 92% rename from App/PixelsToGridLengthConverter.cs rename to src/App/PixelsToGridLengthConverter.cs index 39dd0ab..ae593bd 100644 --- a/App/PixelsToGridLengthConverter.cs +++ b/src/App/PixelsToGridLengthConverter.cs @@ -1,4 +1,6 @@ -using System.Globalization; +using System; +using System.Globalization; +using System.Windows; using System.Windows.Data; using System.Windows.Markup; diff --git a/App/Types/AccentColors.cs b/src/App/Types/AccentColors.cs similarity index 94% rename from App/Types/AccentColors.cs rename to src/App/Types/AccentColors.cs index 51c1a30..b4215aa 100644 --- a/App/Types/AccentColors.cs +++ b/src/App/Types/AccentColors.cs @@ -1,4 +1,5 @@ -using System.Windows.Media; +using System; +using System.Windows.Media; namespace ModernWpfPlayground.Types { diff --git a/App/Types/ThemeMode.cs b/src/App/Types/ThemeMode.cs similarity index 92% rename from App/Types/ThemeMode.cs rename to src/App/Types/ThemeMode.cs index d0ebf37..ced34f7 100644 --- a/App/Types/ThemeMode.cs +++ b/src/App/Types/ThemeMode.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; using ModernWpf; namespace ModernWpfPlayground.Types @@ -21,6 +22,6 @@ namespace ModernWpfPlayground.Types ThemeMode.UseSystemSetting => default, _ => throw new ArgumentOutOfRangeException(nameof(themeMode), themeMode, null) }; - } + } } } \ No newline at end of file diff --git a/src/Controls/AssemblyInfo.cs b/src/Controls/AssemblyInfo.cs new file mode 100644 index 0000000..8b5504e --- /dev/null +++ b/src/Controls/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/src/Controls/Controls.csproj b/src/Controls/Controls.csproj new file mode 100644 index 0000000..e8420a6 --- /dev/null +++ b/src/Controls/Controls.csproj @@ -0,0 +1,20 @@ + + + + net6.0-windows + enable + true + + + + + $(DefaultXamlRuntime) + + + + + + + + + diff --git a/Controls/PropertyPresenter/EnumToItemSourceConverter.cs b/src/Controls/PropertyPresenter/EnumToItemSourceConverter.cs similarity index 100% rename from Controls/PropertyPresenter/EnumToItemSourceConverter.cs rename to src/Controls/PropertyPresenter/EnumToItemSourceConverter.cs diff --git a/Controls/PropertyPresenter/MagicSymbolControl.cs b/src/Controls/PropertyPresenter/MagicSymbolControl.cs similarity index 100% rename from Controls/PropertyPresenter/MagicSymbolControl.cs rename to src/Controls/PropertyPresenter/MagicSymbolControl.cs diff --git a/Controls/PropertyPresenter/MagicSymbolConverter.cs b/src/Controls/PropertyPresenter/MagicSymbolConverter.cs similarity index 100% rename from Controls/PropertyPresenter/MagicSymbolConverter.cs rename to src/Controls/PropertyPresenter/MagicSymbolConverter.cs diff --git a/Controls/PropertyPresenter/PropertyDataTemplateSelector.cs b/src/Controls/PropertyPresenter/PropertyDataTemplateSelector.cs similarity index 100% rename from Controls/PropertyPresenter/PropertyDataTemplateSelector.cs rename to src/Controls/PropertyPresenter/PropertyDataTemplateSelector.cs diff --git a/Controls/PropertyPresenter/PropertyPresenter.xaml b/src/Controls/PropertyPresenter/PropertyPresenter.xaml similarity index 100% rename from Controls/PropertyPresenter/PropertyPresenter.xaml rename to src/Controls/PropertyPresenter/PropertyPresenter.xaml diff --git a/Controls/PropertyPresenter/PropertyPresenter.xaml.cs b/src/Controls/PropertyPresenter/PropertyPresenter.xaml.cs similarity index 100% rename from Controls/PropertyPresenter/PropertyPresenter.xaml.cs rename to src/Controls/PropertyPresenter/PropertyPresenter.xaml.cs diff --git a/Controls/PropertyPresenter/TextBoxEx.cs b/src/Controls/PropertyPresenter/TextBoxEx.cs similarity index 100% rename from Controls/PropertyPresenter/TextBoxEx.cs rename to src/Controls/PropertyPresenter/TextBoxEx.cs diff --git a/Controls/PropertyPresenter/TextComponent.cs b/src/Controls/PropertyPresenter/TextComponent.cs similarity index 100% rename from Controls/PropertyPresenter/TextComponent.cs rename to src/Controls/PropertyPresenter/TextComponent.cs diff --git a/Controls/PropertyPresenter/ValueConverter.cs b/src/Controls/PropertyPresenter/ValueConverter.cs similarity index 100% rename from Controls/PropertyPresenter/ValueConverter.cs rename to src/Controls/PropertyPresenter/ValueConverter.cs