From 5f8decc2f2e886da3713e975fdc94d6072ecfe53 Mon Sep 17 00:00:00 2001 From: Marcos Maia Date: Tue, 22 Jan 2019 17:15:55 -0200 Subject: [PATCH 1/7] Ported projects to .net core 3.0 --- src/Forge.Application.Demo/App.xaml.cs | 8 -- .../Forge.Application.Demo.csproj | 124 +----------------- .../Forge.Application.csproj | 48 +------ 3 files changed, 10 insertions(+), 170 deletions(-) diff --git a/src/Forge.Application.Demo/App.xaml.cs b/src/Forge.Application.Demo/App.xaml.cs index 8b10194..de0a143 100644 --- a/src/Forge.Application.Demo/App.xaml.cs +++ b/src/Forge.Application.Demo/App.xaml.cs @@ -8,14 +8,6 @@ /// public partial class App { - [STAThread] - public static void Main(string[] args) - { - var app = new App(); - app.InitializeComponent(); - app.Run(); - } - protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); diff --git a/src/Forge.Application.Demo/Forge.Application.Demo.csproj b/src/Forge.Application.Demo/Forge.Application.Demo.csproj index 91b3493..44bcb50 100644 --- a/src/Forge.Application.Demo/Forge.Application.Demo.csproj +++ b/src/Forge.Application.Demo/Forge.Application.Demo.csproj @@ -1,128 +1,18 @@ - - - + - Debug - AnyCPU - {3BAC5194-3399-428B-82DA-80CA5DBE9895} WinExe - Forge.Application.Demo - Forge.Application.Demo - v4.6.1 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + net461;netcoreapp3.0 + true + false + + - - - - - - - - - - 4.0 - - - - - - - - - - AboutView.xaml - - - ContactView.xaml - - - HomeView.xaml - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - {88934993-2F5B-49F2-BA5A-6B7BE3FF2DFA} - Forge.Application - - - - - Designer - MSBuild:Compile - + - \ No newline at end of file diff --git a/src/Forge.Application/Forge.Application.csproj b/src/Forge.Application/Forge.Application.csproj index b05a86d..ee262da 100644 --- a/src/Forge.Application/Forge.Application.csproj +++ b/src/Forge.Application/Forge.Application.csproj @@ -1,53 +1,11 @@ - + - net461 - $(MSBuildToolsPath)\Microsoft.CSharp.targets + net461;netcoreapp3.0 + true - - - - - - 4.9.2 - all - runtime; build; native; contentfiles; analyzers - - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - - - - - - - - - - - - - - \ No newline at end of file From 4873b2782abba66cad9be0db575e8777eac94cff Mon Sep 17 00:00:00 2001 From: Marcos Maia Date: Wed, 23 Jan 2019 08:39:29 -0200 Subject: [PATCH 2/7] Added Nuget package properties --- src/Forge.Application/Forge.Application.csproj | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Forge.Application/Forge.Application.csproj b/src/Forge.Application/Forge.Application.csproj index ee262da..d8c6f77 100644 --- a/src/Forge.Application/Forge.Application.csproj +++ b/src/Forge.Application/Forge.Application.csproj @@ -2,6 +2,13 @@ net461;netcoreapp3.0 true + + + $(VersionSuffix) + https://raw.githubusercontent.com/WPF-Forge/Forge.Application/master/LICENSE + https://github.com/WPF-Forge/Forge.Application + https://github.com/WPF-Forge/Forge.Application + ViewModel-first WPF framework From 58ba417a2be489cdb0bd5313e96c48701b1d62f5 Mon Sep 17 00:00:00 2001 From: Marcos Cordeiro Date: Mon, 1 Jun 2020 16:16:31 -0300 Subject: [PATCH 3/7] Update packages --- src/Forge.Application.Demo/App.xaml | 2 +- .../Forge.Application.Demo.csproj | 10 ++--- .../Views/AboutView.xaml | 2 +- .../Views/ContactView.xaml | 2 +- .../Controls/MaterialRoutesWindow.xaml | 1 - .../Forge.Application.csproj | 6 +-- .../Infrastructure/Internal/PaletteService.cs | 39 +++++++++++++++---- .../Forge.Application.Template.csproj | 6 +-- 8 files changed, 46 insertions(+), 22 deletions(-) diff --git a/src/Forge.Application.Demo/App.xaml b/src/Forge.Application.Demo/App.xaml index 553ac7b..aad8d8a 100644 --- a/src/Forge.Application.Demo/App.xaml +++ b/src/Forge.Application.Demo/App.xaml @@ -6,7 +6,7 @@ - + diff --git a/src/Forge.Application.Demo/Forge.Application.Demo.csproj b/src/Forge.Application.Demo/Forge.Application.Demo.csproj index 44bcb50..ab81c5c 100644 --- a/src/Forge.Application.Demo/Forge.Application.Demo.csproj +++ b/src/Forge.Application.Demo/Forge.Application.Demo.csproj @@ -1,16 +1,16 @@  WinExe - net461;netcoreapp3.0 + net461;netcoreapp3.1 true false - - - + + + - + diff --git a/src/Forge.Application.Demo/Views/AboutView.xaml b/src/Forge.Application.Demo/Views/AboutView.xaml index 4f129a7..c821de4 100644 --- a/src/Forge.Application.Demo/Views/AboutView.xaml +++ b/src/Forge.Application.Demo/Views/AboutView.xaml @@ -11,7 +11,7 @@ VerticalAlignment="Stretch"> - + - + diff --git a/src/Forge.Application/Controls/MaterialRoutesWindow.xaml b/src/Forge.Application/Controls/MaterialRoutesWindow.xaml index 90cd5ff..a6e960f 100644 --- a/src/Forge.Application/Controls/MaterialRoutesWindow.xaml +++ b/src/Forge.Application/Controls/MaterialRoutesWindow.xaml @@ -18,7 +18,6 @@ IsDesignTimeCreatable=False}" internal:AttachedProperties.InputBindingsSource="{Binding Routes.Current.RouteConfig.KeyBindings}" Background="{DynamicResource MaterialDesignPaper}" - EnableDWMDropShadow="True" FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto" TextElement.FontSize="{Binding FontSize, Mode=OneWay}" diff --git a/src/Forge.Application/Forge.Application.csproj b/src/Forge.Application/Forge.Application.csproj index d8c6f77..5a07bb1 100644 --- a/src/Forge.Application/Forge.Application.csproj +++ b/src/Forge.Application/Forge.Application.csproj @@ -1,6 +1,6 @@  - net461;netcoreapp3.0 + net461;netcoreapp3.1 true @@ -11,8 +11,8 @@ ViewModel-first WPF framework - - + + \ No newline at end of file diff --git a/src/Forge.Application/Infrastructure/Internal/PaletteService.cs b/src/Forge.Application/Infrastructure/Internal/PaletteService.cs index ecaef3a..ddd19f1 100644 --- a/src/Forge.Application/Infrastructure/Internal/PaletteService.cs +++ b/src/Forge.Application/Infrastructure/Internal/PaletteService.cs @@ -1,7 +1,27 @@ -namespace Forge.Application.Infrastructure.Internal +using System.Windows.Media; + +namespace Forge.Application.Infrastructure.Internal { using MaterialDesignThemes.Wpf; + internal static class ThemeExtensions + { + public static void SetPrimaryColor(this ITheme theme, string primaryColor) + { + theme.SetPrimaryColor(ToColor(primaryColor)); + } + + public static void SetSecondaryColor(this ITheme theme, string accentColor) + { + theme.SetSecondaryColor(ToColor(accentColor)); + } + + private static Color ToColor(string hex) + { + return (Color) ColorConverter.ConvertFromString(hex); + } + } + internal class PaletteService : IPaletteService { public bool DarkMode { get; set; } @@ -16,36 +36,41 @@ internal class PaletteService : IPaletteService public void RefreshTheme() { - new PaletteHelper().SetLightDark(this.DarkMode); + var paletteHelper = new PaletteHelper(); + var theme = paletteHelper.GetTheme(); + theme.SetBaseTheme(this.DarkMode ? Theme.Dark : Theme.Light); + paletteHelper.SetTheme(theme); } + public void RefreshPalette() { var paletteHelper = new PaletteHelper(); + var theme = paletteHelper.GetTheme(); if (this.DarkMode) { if (this.DarkModePrimary != null) { - paletteHelper.ReplacePrimaryColor(this.DarkModePrimary); + theme.SetPrimaryColor(this.DarkModePrimary); } if (this.DarkModeAccent != null) { - paletteHelper.ReplaceAccentColor(this.DarkModeAccent); + theme.SetSecondaryColor(this.DarkModeAccent); } } else { if (this.LightModePrimary != null) { - paletteHelper.ReplacePrimaryColor(this.LightModePrimary); + theme.SetPrimaryColor(this.LightModePrimary); } if (this.LightModeAccent != null) { - paletteHelper.ReplaceAccentColor(this.LightModeAccent); + theme.SetSecondaryColor(this.LightModeAccent); } } } } -} +} \ No newline at end of file diff --git a/tools/Forge.Application.Template/Forge.Application.Template.csproj b/tools/Forge.Application.Template/Forge.Application.Template.csproj index f2922bf..73268b7 100644 --- a/tools/Forge.Application.Template/Forge.Application.Template.csproj +++ b/tools/Forge.Application.Template/Forge.Application.Template.csproj @@ -37,9 +37,9 @@ 1.0.1 - - - + + + From a4a5d1182b37ab139813cda489b771f7d4a85771 Mon Sep 17 00:00:00 2001 From: Marcos Cordeiro Date: Mon, 1 Jun 2020 16:17:10 -0300 Subject: [PATCH 4/7] Fix app.xaml for template --- tools/Forge.Application.Template/App.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Forge.Application.Template/App.xaml b/tools/Forge.Application.Template/App.xaml index 31a9196..36b6fd5 100644 --- a/tools/Forge.Application.Template/App.xaml +++ b/tools/Forge.Application.Template/App.xaml @@ -6,7 +6,7 @@ - + From 25fd418561226fd798dad1466608f36443b04002 Mon Sep 17 00:00:00 2001 From: Marcos Cordeiro Date: Mon, 1 Jun 2020 16:19:03 -0300 Subject: [PATCH 5/7] Enable assembly generation for demo project --- .../Forge.Application.Demo.csproj | 1 - .../Properties/AssemblyInfo.cs | 53 -------- .../Properties/Resources.Designer.cs | 71 ----------- .../Properties/Resources.resx | 117 ------------------ .../Properties/Settings.Designer.cs | 30 ----- .../Properties/Settings.settings | 7 -- 6 files changed, 279 deletions(-) delete mode 100644 src/Forge.Application.Demo/Properties/AssemblyInfo.cs delete mode 100644 src/Forge.Application.Demo/Properties/Resources.Designer.cs delete mode 100644 src/Forge.Application.Demo/Properties/Resources.resx delete mode 100644 src/Forge.Application.Demo/Properties/Settings.Designer.cs delete mode 100644 src/Forge.Application.Demo/Properties/Settings.settings diff --git a/src/Forge.Application.Demo/Forge.Application.Demo.csproj b/src/Forge.Application.Demo/Forge.Application.Demo.csproj index ab81c5c..100c60b 100644 --- a/src/Forge.Application.Demo/Forge.Application.Demo.csproj +++ b/src/Forge.Application.Demo/Forge.Application.Demo.csproj @@ -3,7 +3,6 @@ WinExe net461;netcoreapp3.1 true - false diff --git a/src/Forge.Application.Demo/Properties/AssemblyInfo.cs b/src/Forge.Application.Demo/Properties/AssemblyInfo.cs deleted file mode 100644 index 22c6078..0000000 --- a/src/Forge.Application.Demo/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Forge.Application.Demo")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Forge.Application.Demo")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[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) -)] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Forge.Application.Demo/Properties/Resources.Designer.cs b/src/Forge.Application.Demo/Properties/Resources.Designer.cs deleted file mode 100644 index 1e94223..0000000 --- a/src/Forge.Application.Demo/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Forge.Application.Demo.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Material.Demo.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/src/Forge.Application.Demo/Properties/Resources.resx b/src/Forge.Application.Demo/Properties/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/src/Forge.Application.Demo/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/src/Forge.Application.Demo/Properties/Settings.Designer.cs b/src/Forge.Application.Demo/Properties/Settings.Designer.cs deleted file mode 100644 index 7faa960..0000000 --- a/src/Forge.Application.Demo/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Forge.Application.Demo.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/src/Forge.Application.Demo/Properties/Settings.settings b/src/Forge.Application.Demo/Properties/Settings.settings deleted file mode 100644 index 033d7a5..0000000 --- a/src/Forge.Application.Demo/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file From a69ac4de30ebf94ffbca4485cd69c6706591fb22 Mon Sep 17 00:00:00 2001 From: Marcos Cordeiro Date: Mon, 1 Jun 2020 23:43:57 -0300 Subject: [PATCH 6/7] Fixes window shadow --- src/Forge.Application/Controls/MaterialRoutesWindow.xaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Forge.Application/Controls/MaterialRoutesWindow.xaml b/src/Forge.Application/Controls/MaterialRoutesWindow.xaml index a6e960f..f01c615 100644 --- a/src/Forge.Application/Controls/MaterialRoutesWindow.xaml +++ b/src/Forge.Application/Controls/MaterialRoutesWindow.xaml @@ -1,4 +1,4 @@ - + mc:Ignorable="d" + ResizeBorderThickness="10" + BorderThickness="0" + GlowBrush="{StaticResource MaterialDesignShadowBrush}"> From 6b5d65d5236d0ff312fa1e796a861f2882bfb21f Mon Sep 17 00:00:00 2001 From: Marcos Cordeiro Date: Mon, 1 Jun 2020 23:44:05 -0300 Subject: [PATCH 7/7] Exposes WindowState to controller --- .../Controls/MaterialRoutesWindow.xaml | 4 ++-- .../Helpers/Internal/AttachedProperties.cs | 1 - .../Infrastructure/AppController.cs | 18 +++++++++++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/Forge.Application/Controls/MaterialRoutesWindow.xaml b/src/Forge.Application/Controls/MaterialRoutesWindow.xaml index f01c615..e7ed570 100644 --- a/src/Forge.Application/Controls/MaterialRoutesWindow.xaml +++ b/src/Forge.Application/Controls/MaterialRoutesWindow.xaml @@ -1,4 +1,4 @@ -)e.NewValue; foreach (var binding in bindings) diff --git a/src/Forge.Application/Infrastructure/AppController.cs b/src/Forge.Application/Infrastructure/AppController.cs index 44dfbd4..0df43ce 100644 --- a/src/Forge.Application/Infrastructure/AppController.cs +++ b/src/Forge.Application/Infrastructure/AppController.cs @@ -26,10 +26,10 @@ public abstract class AppController : INotifyPropertyChanged, IRouteErrorListene { public bool CloseOnClickAway { - get => this._closeOnClickAway; + get => this.closeOnClickAway; set { - this._closeOnClickAway = value; + this.closeOnClickAway = value; try { @@ -53,7 +53,8 @@ public bool CloseOnClickAway private ICommand menuCommand; private string title; private bool toggleState; - private bool _closeOnClickAway; + private bool closeOnClickAway; + private WindowState windowState; protected AppController() { @@ -142,6 +143,17 @@ public bool IsMenuOpen } } + public WindowState WindowState + { + get { return this.windowState; } + set + { + if (value == this.windowState) return; + this.windowState = value; + this.OnPropertyChanged(); + } + } + public string Title { get { return this.title; }