From b64c85afed025c8c51ef3ba6b8321c1ae1062630 Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 14 Jun 2019 09:51:03 +0200 Subject: [PATCH] Using a workaround for current WPF issues. --- NuGet.Config | 1 + azure-pipelines.yml | 6 +- src/Greenshot-Full.sln | 8 +- .../Greenshot.Addon.Win10.csproj | 4 +- src/Greenshot.Addon.Win10/Win10AddonModule.cs | 7 +- .../Win10FormEnhancer.cs | 91 ------------------- src/Greenshot.Addons/Greenshot.Addons.csproj | 1 + src/Greenshot.Gfx/Greenshot.Gfx.csproj | 2 - src/Greenshot/Greenshot.csproj | 3 +- src/Greenshot/Startup.cs | 4 + 10 files changed, 17 insertions(+), 110 deletions(-) delete mode 100644 src/Greenshot.Addon.Win10/Win10FormEnhancer.cs diff --git a/NuGet.Config b/NuGet.Config index fbdb80797..ef15aa6a7 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -2,6 +2,7 @@ + diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7609a7831..cad86b485 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -15,12 +15,12 @@ steps: - task: DotNetCoreInstaller@0 displayName: 'Install .NET Core SDK 3.0' inputs: - version: '3.0.100-preview7-012284' + version: '3.0.100-preview7-012395' - task: NuGetToolInstaller@0 - displayName: 'Use NuGet 5.0.0' + displayName: 'Use NuGet 5.0.2' inputs: - versionSpec: 5.0.0 + versionSpec: 5.0.2 checkLatest: true - task: NuGetCommand@2 diff --git a/src/Greenshot-Full.sln b/src/Greenshot-Full.sln index 876688b5b..61668ddbf 100644 --- a/src/Greenshot-Full.sln +++ b/src/Greenshot-Full.sln @@ -227,14 +227,14 @@ Global {D106F86C-CD3D-44FF-B151-2A5D47268B5C}.Release|x86.Build.0 = Release|Any CPU {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Debug|x64.ActiveCfg = Debug|x64 - {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Debug|x64.Build.0 = Debug|x64 + {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Debug|x64.ActiveCfg = Debug|Any CPU + {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Debug|x64.Build.0 = Debug|Any CPU {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Debug|x86.ActiveCfg = Debug|Any CPU {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Debug|x86.Build.0 = Debug|Any CPU {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Release|Any CPU.ActiveCfg = Release|Any CPU {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Release|Any CPU.Build.0 = Release|Any CPU - {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Release|x64.ActiveCfg = Release|x64 - {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Release|x64.Build.0 = Release|x64 + {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Release|x64.ActiveCfg = Release|Any CPU + {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Release|x64.Build.0 = Release|Any CPU {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Release|x86.ActiveCfg = Release|Any CPU {F041C685-EB96-4ED1-9ACE-0F5BD836610F}.Release|x86.Build.0 = Release|Any CPU {5D594C8A-2137-46E1-8D01-B83662825C7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU diff --git a/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj b/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj index 3668214cd..b918270bb 100644 --- a/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj +++ b/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj @@ -20,7 +20,7 @@ - - + + \ No newline at end of file diff --git a/src/Greenshot.Addon.Win10/Win10AddonModule.cs b/src/Greenshot.Addon.Win10/Win10AddonModule.cs index 78ca41863..6e4e2facf 100644 --- a/src/Greenshot.Addon.Win10/Win10AddonModule.cs +++ b/src/Greenshot.Addon.Win10/Win10AddonModule.cs @@ -23,7 +23,6 @@ using Autofac; using Dapplo.Addons; using Dapplo.Windows.Common; using Greenshot.Addons.Components; -using Greenshot.Addons.Interfaces; namespace Greenshot.Addon.Win10 { @@ -49,15 +48,11 @@ namespace Greenshot.Addon.Win10 .As() .SingleInstance(); - builder - .RegisterType() - .As() - .SingleInstance(); - builder .RegisterType() .As() .SingleInstance(); + base.Load(builder); } } diff --git a/src/Greenshot.Addon.Win10/Win10FormEnhancer.cs b/src/Greenshot.Addon.Win10/Win10FormEnhancer.cs deleted file mode 100644 index 4b0736053..000000000 --- a/src/Greenshot.Addon.Win10/Win10FormEnhancer.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2019 Thomas Braun, Jens Klingen, Robin Krom -// -// For more information see: http://getgreenshot.org/ -// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 1 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -using System; -using System.Drawing; -using System.Windows.Forms; -using Greenshot.Addons.Interfaces; -using Microsoft.Toolkit.Forms.UI.XamlHost; - -namespace Greenshot.Addon.Win10 -{ - public class Win10FormEnhancer : IFormEnhancer - { - private WindowsXamlHost _inkCanvasHost; - private WindowsXamlHost _inkToolbarHost; - private Windows.UI.Xaml.Controls.InkCanvas _inkCanvas; - private Windows.UI.Xaml.Controls.InkToolbar _inkToolbar; - - public void InitializeComponent(Form target) - { - if (target is null) - { - return; - } - // InkCanvas - _inkCanvasHost = new WindowsXamlHost - { - InitialTypeName = "Windows.UI.Xaml.Controls.InkCanvas", - Dock = DockStyle.Fill, - BackColor = Color.Transparent, - - }; - _inkCanvasHost.ChildChanged += InkCanvas_ChildChanged; - - // InkToolbar - _inkToolbarHost = new WindowsXamlHost - { - InitialTypeName = "Windows.UI.Xaml.Controls.InkToolbar", - // Layout - Top = 0, - Left = 0, - Height = 50, - Dock = DockStyle.Top, - BackColor = Color.Transparent - }; - _inkToolbarHost.ChildChanged += InkToolbar_ChildChanged; - - // Add to Window - target.Controls.Add(_inkToolbarHost); - target.Controls.Add(_inkCanvasHost); - } - - private void InkToolbar_ChildChanged(object sender, EventArgs e) - { - _inkToolbar = ((WindowsXamlHost)sender).Child as Windows.UI.Xaml.Controls.InkToolbar; - InitializeUwpControls(); - } - - private void InkCanvas_ChildChanged(object sender, EventArgs e) - { - _inkCanvas = ((WindowsXamlHost)sender).Child as Windows.UI.Xaml.Controls.InkCanvas; - InitializeUwpControls(); - } - - private void InitializeUwpControls() - { - if (_inkToolbar == null || _inkCanvas == null) - { - return; - } - - _inkToolbar.TargetInkCanvas = _inkCanvas; - } - } -} \ No newline at end of file diff --git a/src/Greenshot.Addons/Greenshot.Addons.csproj b/src/Greenshot.Addons/Greenshot.Addons.csproj index 292dcb0fd..f1bcc2e12 100644 --- a/src/Greenshot.Addons/Greenshot.Addons.csproj +++ b/src/Greenshot.Addons/Greenshot.Addons.csproj @@ -33,6 +33,7 @@ all runtime; build; native; contentfiles; analyzers + diff --git a/src/Greenshot.Gfx/Greenshot.Gfx.csproj b/src/Greenshot.Gfx/Greenshot.Gfx.csproj index fbb179b94..874543ad0 100644 --- a/src/Greenshot.Gfx/Greenshot.Gfx.csproj +++ b/src/Greenshot.Gfx/Greenshot.Gfx.csproj @@ -3,8 +3,6 @@ netcoreapp3.0 true - 8 - AnyCPU;x64 diff --git a/src/Greenshot/Greenshot.csproj b/src/Greenshot/Greenshot.csproj index 81e0419f3..7bcefd699 100644 --- a/src/Greenshot/Greenshot.csproj +++ b/src/Greenshot/Greenshot.csproj @@ -44,8 +44,6 @@ all runtime; build; native; contentfiles; analyzers - - @@ -53,6 +51,7 @@ + diff --git a/src/Greenshot/Startup.cs b/src/Greenshot/Startup.cs index 96479c434..503a8672b 100644 --- a/src/Greenshot/Startup.cs +++ b/src/Greenshot/Startup.cs @@ -20,6 +20,7 @@ using System; using System.Diagnostics; using System.Drawing; +using System.Globalization; using System.Text; using System.Windows; using System.Windows.Forms; @@ -56,6 +57,9 @@ namespace Greenshot [STAThread] public static int Main(string[] arguments) { + // Workaround for https://github.com/dotnet/wpf/issues/684 & https://github.com/dotnet/wpf/issues/913 + CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo("en-US"); + // TODO: Set via build StringEncryptionTypeConverter.RgbIv = "dlgjowejgogkklwj"; StringEncryptionTypeConverter.RgbKey = "lsjvkwhvwujkagfauguwcsjgu2wueuff";