Update to work on Windows 7, by excluding the Win10Addon Assembly. Updated dependencies. Things are still crashing when WPF is used due to a fix for dotnet/wpf issues/771 not being available.

This commit is contained in:
Robin 2019-06-06 15:45:01 +02:00
commit 065dbcbbbf
No known key found for this signature in database
GPG key ID: CBBB6557491B1140
18 changed files with 123 additions and 123 deletions

View file

@ -15,7 +15,7 @@ steps:
- task: DotNetCoreInstaller@0 - task: DotNetCoreInstaller@0
displayName: 'Install .NET Core SDK 3.0' displayName: 'Install .NET Core SDK 3.0'
inputs: inputs:
version: '3.0.100-preview6-012162' version: '3.0.100-preview7-012279'
- task: NuGetToolInstaller@0 - task: NuGetToolInstaller@0
displayName: 'Use NuGet 5.0.0' displayName: 'Use NuGet 5.0.0'
@ -35,7 +35,7 @@ steps:
command: 'publish' command: 'publish'
publishWebProjects: false publishWebProjects: false
projects: 'src\Greenshot\Greenshot.csproj' projects: 'src\Greenshot\Greenshot.csproj'
arguments: '-f netcoreapp3.0 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true /p:UseAppHost=true /p:RuntimeIdentifier=win-x64' arguments: '-f netcoreapp3.0 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true /p:RuntimeIdentifier=win-x64'
zipAfterPublish: false zipAfterPublish: false
- task: CmdLine@2 - task: CmdLine@2
@ -49,7 +49,7 @@ steps:
command: 'publish' command: 'publish'
publishWebProjects: false publishWebProjects: false
projects: 'src\Greenshot\Greenshot.csproj' projects: 'src\Greenshot\Greenshot.csproj'
arguments: '-f netcoreapp3.0 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true /p:UseAppHost=true /p:RuntimeIdentifier=win-x86' arguments: '-f netcoreapp3.0 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true /p:RuntimeIdentifier=win-x86'
zipAfterPublish: false zipAfterPublish: false
- task: CmdLine@2 - task: CmdLine@2

View file

@ -14,10 +14,7 @@
<FileVersion>1.0.0</FileVersion> <FileVersion>1.0.0</FileVersion>
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<OsProductName>$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion@ProductName)</OsProductName> <RuntimeIdentifiers>win10-x64;win10-x86;win-x64;win-x86</RuntimeIdentifiers>
<!--RuntimeIdentifiers>win10-x64;win10-x86;win-x64;win-x86</RuntimeIdentifiers-->
<ExtrasEnableWpfProjectSetup>true</ExtrasEnableWpfProjectSetup>
<ExtrasEnableWinFormsProjectSetup>true</ExtrasEnableWinFormsProjectSetup>
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) --> <!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl> <PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB --> <!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
@ -28,6 +25,16 @@
<NoWarn>CS1591</NoWarn> <NoWarn>CS1591</NoWarn>
</PropertyGroup> </PropertyGroup>
<!-- ILLinker and single file settings -->
<ItemGroup Condition="$(MSBuildProjectName) == 'Greenshot'">
<TrimmerRootAssembly Include="netstandard" />
</ItemGroup>
<PropertyGroup Condition="$(MSBuildProjectName) == 'Greenshot'">
<IncludeSymbolsInSingleFile>false</IncludeSymbolsInSingleFile>
<ShowLinkerSizeComparison>true</ShowLinkerSizeComparison>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' != 'Debug' And !$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Demo'))"> <PropertyGroup Condition="'$(Configuration)' != 'Debug' And !$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Demo'))">
<GenerateDocumentationFile>false</GenerateDocumentationFile> <GenerateDocumentationFile>false</GenerateDocumentationFile>
<IsPackable>true</IsPackable> <IsPackable>true</IsPackable>
@ -53,19 +60,15 @@
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="$(MSBuildProjectName.Contains('.Addon.'))">
<RootPackageReference>true</RootPackageReference>
</PropertyGroup>
<ItemGroup Condition="!$(MSBuildProjectName.Contains('Tests')) And $(MSBuildProjectName.StartsWith('Greenshot'))"> <ItemGroup Condition="!$(MSBuildProjectName.Contains('Tests')) And $(MSBuildProjectName.StartsWith('Greenshot'))">
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.167"> <PackageReference Include="Nerdbank.GitVersioning" Version="2.3.167">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All"/> <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19270-01" PrivateAssets="All"/>
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" BeforeTargets="PostBuildEvent" Condition="'$(BuildingInsideVisualStudio)' == 'true' And $(MSBuildProjectName.Contains('Addon.')) And !$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Demo')) And ($(OsProductName.Contains('Windows 10')) Or (!$(OsProductName.Contains('Windows 10')) And !$(MSBuildProjectName.Contains('Win10'))))"> <Target Name="PostBuild" BeforeTargets="PostBuildEvent" Condition="'$(BuildingInsideVisualStudio)' == 'true' And $(MSBuildProjectName.Contains('Addon.')) And !$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Demo'))">
<Exec Command=" <Exec Command="
xcopy /q /y /d &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)&quot;&#xD;&#xA; xcopy /q /y /d &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)&quot;&#xD;&#xA;
xcopy /q /y /d &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)&quot;&#xD;&#xA; xcopy /q /y /d &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)&quot;&#xD;&#xA;

View file

@ -59,14 +59,14 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|Any CPU.Build.0 = Debug|Any CPU {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|x64.ActiveCfg = Debug|x64 {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|x64.ActiveCfg = Debug|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|x64.Build.0 = Debug|x64 {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|x64.Build.0 = Debug|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|x86.ActiveCfg = Debug|Any CPU {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|x86.ActiveCfg = Debug|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|x86.Build.0 = Debug|Any CPU {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|x86.Build.0 = Debug|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|Any CPU.ActiveCfg = Release|Any CPU {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|Any CPU.Build.0 = Release|Any CPU {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|Any CPU.Build.0 = Release|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|x64.ActiveCfg = Release|x64 {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|x64.ActiveCfg = Release|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|x64.Build.0 = Release|x64 {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|x64.Build.0 = Release|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|x86.ActiveCfg = Release|Any CPU {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|x86.ActiveCfg = Release|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|x86.Build.0 = Release|Any CPU {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|x86.Build.0 = Release|Any CPU
{5B924697-4DCD-4F98-85F1-105CB84B7341}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5B924697-4DCD-4F98-85F1-105CB84B7341}.Debug|Any CPU.ActiveCfg = Debug|Any CPU

View file

@ -108,18 +108,13 @@ namespace Greenshot.Addon.InternetExplorer {
{ {
continue; continue;
} }
#if !NETCOREAPP3_0
var ieAccessible = new Accessible(directUiWd.Handle); var ieAccessible = new Accessible(directUiWd.Handle);
foreach (var url in ieAccessible.IETabUrls) foreach (var url in ieAccessible.IETabUrls)
{ {
yield return url; yield return url;
} }
#endif
} }
#if NETCOREAPP3_0
return Enumerable.Empty<string>();
#endif
} }
} }
} }

View file

@ -28,9 +28,7 @@ using System.Windows.Media.Imaging;
using Dapplo.HttpExtensions; using Dapplo.HttpExtensions;
using Dapplo.HttpExtensions.Extensions; using Dapplo.HttpExtensions.Extensions;
using Dapplo.Jira; using Dapplo.Jira;
#if !NETCOREAPP3_0
using Dapplo.Jira.Converters; using Dapplo.Jira.Converters;
#endif
using Dapplo.Jira.Entities; using Dapplo.Jira.Entities;
using Dapplo.Log; using Dapplo.Log;
using Greenshot.Addon.Jira.Configuration; using Greenshot.Addon.Jira.Configuration;
@ -98,15 +96,13 @@ namespace Greenshot.Addon.Jira
public void UpdateSvgSize(int size) public void UpdateSvgSize(int size)
{ {
#if !NETCOREAPP3_0
_jiraClient.Behaviour.SetConfig(new SvgConfiguration { Width = size, Height = size }); _jiraClient.Behaviour.SetConfig(new SvgConfiguration { Width = size, Height = size });
#endif
} }
/// <summary> /// <summary>
/// Internal login which catches the exceptions /// Internal login which catches the exceptions
/// </summary> /// </summary>
/// <returns>true if login was done sucessfully</returns> /// <returns>true if login was done successfully</returns>
private async Task<bool> DoLoginAsync(string user, string password, CancellationToken cancellationToken = default) private async Task<bool> DoLoginAsync(string user, string password, CancellationToken cancellationToken = default)
{ {
if (string.IsNullOrEmpty(user) || string.IsNullOrEmpty(password)) if (string.IsNullOrEmpty(user) || string.IsNullOrEmpty(password))

View file

@ -42,15 +42,20 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
[Serializable] [Serializable]
public class DrawableContainerList : List<IDrawableContainer>, IDrawableContainerList public class DrawableContainerList : List<IDrawableContainer>, IDrawableContainerList
{ {
public Guid ParentID { private readonly IEditorLanguage _editorLanguage;
public Guid ParentID {
get; get;
private set; private set;
} }
public DrawableContainerList() { public DrawableContainerList(IEditorLanguage editorLanguage)
} {
_editorLanguage = editorLanguage;
}
public DrawableContainerList(Guid parentId) { public DrawableContainerList(Guid parentId, IEditorLanguage editorLanguage) : this(editorLanguage)
{
ParentID = parentId; ParentID = parentId;
} }
@ -114,9 +119,9 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
return; return;
} }
var clone = new DrawableContainerList(); var clone = new DrawableContainerList(_editorLanguage);
clone.AddRange(this); clone.AddRange(this);
Parent.MakeUndoable(new DrawableContainerBoundsChangeMemento(clone), allowMerge); Parent.MakeUndoable(new DrawableContainerBoundsChangeMemento(clone, _editorLanguage), allowMerge);
} }
/// <summary> /// <summary>
@ -411,20 +416,18 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
bool push = surface.Elements.CanPushDown(this); bool push = surface.Elements.CanPushDown(this);
bool pull = surface.Elements.CanPullUp(this); bool pull = surface.Elements.CanPullUp(this);
var editorLanguage = CommonServiceLocator.ServiceLocator.Current.GetInstance<IEditorLanguage>();
ToolStripMenuItem item; ToolStripMenuItem item;
// Pull "up" // Pull "up"
if (pull) { if (pull) {
item = new ToolStripMenuItem(editorLanguage.EditorUptotop); item = new ToolStripMenuItem(_editorLanguage.EditorUptotop);
item.Click += (sender, args) => item.Click += (sender, args) =>
{ {
surface.Elements.PullElementsToTop(this); surface.Elements.PullElementsToTop(this);
surface.Elements.Invalidate(); surface.Elements.Invalidate();
}; };
menu.Items.Add(item); menu.Items.Add(item);
item = new ToolStripMenuItem(editorLanguage.EditorUponelevel); item = new ToolStripMenuItem(_editorLanguage.EditorUponelevel);
item.Click += (sender, args) => item.Click += (sender, args) =>
{ {
surface.Elements.PullElementsUp(this); surface.Elements.PullElementsUp(this);
@ -434,14 +437,14 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
} }
// Push "down" // Push "down"
if (push) { if (push) {
item = new ToolStripMenuItem(editorLanguage.EditorDowntobottom); item = new ToolStripMenuItem(_editorLanguage.EditorDowntobottom);
item.Click += (sender, args) => item.Click += (sender, args) =>
{ {
surface.Elements.PushElementsToBottom(this); surface.Elements.PushElementsToBottom(this);
surface.Elements.Invalidate(); surface.Elements.Invalidate();
}; };
menu.Items.Add(item); menu.Items.Add(item);
item = new ToolStripMenuItem(editorLanguage.EditorDownonelevel); item = new ToolStripMenuItem(_editorLanguage.EditorDownonelevel);
item.Click += (sender, args) => item.Click += (sender, args) =>
{ {
surface.Elements.PushElementsDown(this); surface.Elements.PushElementsDown(this);
@ -451,7 +454,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
} }
// Duplicate // Duplicate
item = new ToolStripMenuItem(editorLanguage.EditorDuplicate); item = new ToolStripMenuItem(_editorLanguage.EditorDuplicate);
item.Click += (sender, args) => item.Click += (sender, args) =>
{ {
IDrawableContainerList dcs = this.Clone(); IDrawableContainerList dcs = this.Clone();
@ -464,7 +467,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
menu.Items.Add(item); menu.Items.Add(item);
// Copy // Copy
item = new ToolStripMenuItem(editorLanguage.EditorCopytoclipboard) item = new ToolStripMenuItem(_editorLanguage.EditorCopytoclipboard)
{ {
Image = GreenshotResources.Instance.GetBitmap("copyToolStripMenuItem.Image", GetType()).NativeBitmap Image = GreenshotResources.Instance.GetBitmap("copyToolStripMenuItem.Image", GetType()).NativeBitmap
}; };
@ -472,7 +475,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
menu.Items.Add(item); menu.Items.Add(item);
// Cut // Cut
item = new ToolStripMenuItem(editorLanguage.EditorCuttoclipboard) item = new ToolStripMenuItem(_editorLanguage.EditorCuttoclipboard)
{ {
Image = GreenshotResources.Instance.GetBitmap("btnCut.Image", GetType()).NativeBitmap Image = GreenshotResources.Instance.GetBitmap("btnCut.Image", GetType()).NativeBitmap
}; };
@ -484,7 +487,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
menu.Items.Add(item); menu.Items.Add(item);
// Delete // Delete
item = new ToolStripMenuItem(editorLanguage.EditorDeleteelement) item = new ToolStripMenuItem(_editorLanguage.EditorDeleteelement)
{ {
Image = GreenshotResources.Instance.GetBitmap("removeObjectToolStripMenuItem.Image", GetType()).NativeBitmap Image = GreenshotResources.Instance.GetBitmap("removeObjectToolStripMenuItem.Image", GetType()).NativeBitmap
}; };
@ -507,7 +510,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
return; return;
} }
item = new ToolStripMenuItem(editorLanguage.EditorResetsize); item = new ToolStripMenuItem(_editorLanguage.EditorResetsize);
//item.Image = ((System.Drawing.Image)(editorFormResources.GetObject("removeObjectToolStripMenuItem.Image"))); //item.Image = ((System.Drawing.Image)(editorFormResources.GetObject("removeObjectToolStripMenuItem.Image")));
item.Click += (sender, args) => item.Click += (sender, args) =>
{ {

View file

@ -43,14 +43,14 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields
private readonly IDrawableContainerList _boundContainers; private readonly IDrawableContainerList _boundContainers;
private bool _internalUpdateRunning; private bool _internalUpdateRunning;
public FieldAggregator(ISurface parent, IEditorConfiguration editorConfiguration) : base(editorConfiguration) public FieldAggregator(ISurface parent, IEditorConfiguration editorConfiguration, IEditorLanguage editorLanguage) : base(editorConfiguration)
{ {
foreach (var fieldType in FieldTypes.Values) foreach (var fieldType in FieldTypes.Values)
{ {
var field = new Field(fieldType, GetType()); var field = new Field(fieldType, GetType());
AddField(field); AddField(field);
} }
_boundContainers = new DrawableContainerList _boundContainers = new DrawableContainerList(editorLanguage)
{ {
Parent = parent Parent = parent
}; };

View file

@ -63,6 +63,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
[NonSerialized] [NonSerialized]
private readonly IEditorConfiguration _editorConfiguration; private readonly IEditorConfiguration _editorConfiguration;
private readonly IEditorLanguage _editorLanguage;
[NonSerialized] [NonSerialized]
private readonly ICoreConfiguration _coreConfiguration; private readonly ICoreConfiguration _coreConfiguration;
@ -102,7 +104,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
private int _counterStart = 1; private int _counterStart = 1;
/// <summary> /// <summary>
/// the cropcontainer, when cropping this is set, do not serialize /// the crop container, when cropping this is set, do not serialize
/// </summary> /// </summary>
[NonSerialized] [NonSerialized]
private IDrawableContainer _cropContainer; private IDrawableContainer _cropContainer;
@ -219,14 +221,15 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
/// <summary> /// <summary>
/// Base Surface constructor /// Base Surface constructor
/// </summary> /// </summary>
public Surface(ICoreConfiguration coreConfiguration, IEditorConfiguration editorConfiguration) public Surface(ICoreConfiguration coreConfiguration, IEditorConfiguration editorConfiguration, IEditorLanguage editorLanguage)
{ {
_editorConfiguration = editorConfiguration; _editorConfiguration = editorConfiguration;
_editorLanguage = editorLanguage;
_coreConfiguration = coreConfiguration; _coreConfiguration = coreConfiguration;
_fieldAggregator = new FieldAggregator(this, editorConfiguration); _fieldAggregator = new FieldAggregator(this, editorConfiguration, editorLanguage);
Count++; Count++;
_elements = new DrawableContainerList(Id); _elements = new DrawableContainerList(Id, _editorLanguage);
_selectedElements = new DrawableContainerList(Id); _selectedElements = new DrawableContainerList(Id, _editorLanguage);
Log.Debug().WriteLine("Creating surface!"); Log.Debug().WriteLine("Creating surface!");
MouseDown += SurfaceMouseDown; MouseDown += SurfaceMouseDown;
MouseUp += SurfaceMouseUp; MouseUp += SurfaceMouseUp;
@ -255,7 +258,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
/// <param name="coreConfiguration">ICoreConfiguration</param> /// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="editorConfiguration">IEditorConfiguration</param> /// <param name="editorConfiguration">IEditorConfiguration</param>
/// <param name="newBitmap">IBitmapWithNativeSupport</param> /// <param name="newBitmap">IBitmapWithNativeSupport</param>
public Surface(ICoreConfiguration coreConfiguration, IEditorConfiguration editorConfiguration, IBitmapWithNativeSupport newBitmap) : this(coreConfiguration, editorConfiguration) public Surface(ICoreConfiguration coreConfiguration, IEditorConfiguration editorConfiguration, IEditorLanguage editorLanguage, IBitmapWithNativeSupport newBitmap) : this(coreConfiguration, editorConfiguration, editorLanguage)
{ {
Log.Debug().WriteLine("Got Bitmap with dimensions {0} and format {1}", newBitmap.Size, newBitmap.PixelFormat); Log.Debug().WriteLine("Got Bitmap with dimensions {0} and format {1}", newBitmap.Size, newBitmap.PixelFormat);
SetBitmap(newBitmap, true); SetBitmap(newBitmap, true);
@ -267,7 +270,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
/// <param name="coreConfiguration">ICoreConfiguration</param> /// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="editorConfiguration">IEditorConfiguration</param> /// <param name="editorConfiguration">IEditorConfiguration</param>
/// <param name="capture">ICapture</param> /// <param name="capture">ICapture</param>
public Surface(ICoreConfiguration coreConfiguration, IEditorConfiguration editorConfiguration, ICapture capture) : this(coreConfiguration, editorConfiguration) public Surface(ICoreConfiguration coreConfiguration, IEditorConfiguration editorConfiguration, IEditorLanguage editorLanguage, ICapture capture) : this(coreConfiguration, editorConfiguration, editorLanguage)
{ {
SetCapture(capture); SetCapture(capture);
} }
@ -665,7 +668,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
public void RemoveElements(IDrawableContainerList elementsToRemove, bool makeUndoable = true) public void RemoveElements(IDrawableContainerList elementsToRemove, bool makeUndoable = true)
{ {
// fix potential issues with iterating a changing list // fix potential issues with iterating a changing list
var cloned = new DrawableContainerList(); var cloned = new DrawableContainerList(_editorLanguage);
cloned.AddRange(elementsToRemove); cloned.AddRange(elementsToRemove);
if (makeUndoable) if (makeUndoable)
{ {
@ -724,7 +727,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
public void AddElements(IDrawableContainerList elementsToAdd, bool makeUndoable = true) public void AddElements(IDrawableContainerList elementsToAdd, bool makeUndoable = true)
{ {
// fix potential issues with iterating a changing list // fix potential issues with iterating a changing list
var cloned = new DrawableContainerList(); var cloned = new DrawableContainerList(_editorLanguage);
cloned.AddRange(elementsToAdd); cloned.AddRange(elementsToAdd);
if (makeUndoable) if (makeUndoable)
{ {
@ -1400,7 +1403,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
var rightClickedContainer = _elements.ClickableElementAt(_mouseStart.X, _mouseStart.Y); var rightClickedContainer = _elements.ClickableElementAt(_mouseStart.X, _mouseStart.Y);
if (rightClickedContainer != null) if (rightClickedContainer != null)
{ {
selectedList = new DrawableContainerList(Id) {rightClickedContainer}; selectedList = new DrawableContainerList(Id, _editorLanguage) {rightClickedContainer};
} }
} }
if (selectedList != null && selectedList.Count > 0) if (selectedList != null && selectedList.Count > 0)

View file

@ -61,6 +61,7 @@ namespace Greenshot.Addon.LegacyEditor
.RegisterType<EditorFactory>() .RegisterType<EditorFactory>()
.AsSelf() .AsSelf()
.SingleInstance(); .SingleInstance();
builder builder
.RegisterType<ResizeSettingsForm>() .RegisterType<ResizeSettingsForm>()
.AsSelf(); .AsSelf();

View file

@ -111,7 +111,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AutoProperties.Fody" Version="1.21.0" /> <PackageReference Include="AutoProperties.Fody" Version="1.21.0" />
<PackageReference Include="CommonServiceLocator" Version="2.0.4" />
<PackageReference Include="Fody" Version="4.2.1"> <PackageReference Include="Fody" Version="4.2.1">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>

View file

@ -34,16 +34,18 @@ namespace Greenshot.Addon.LegacyEditor.Memento
private readonly List<NativePoint> _points = new List<NativePoint>(); private readonly List<NativePoint> _points = new List<NativePoint>();
private readonly List<Size> _sizes = new List<Size>(); private readonly List<Size> _sizes = new List<Size>();
private IDrawableContainerList _listOfdrawableContainer; private IDrawableContainerList _listOfdrawableContainer;
private readonly IEditorLanguage _editorLanguage;
public DrawableContainerBoundsChangeMemento(IDrawableContainerList listOfdrawableContainer) public DrawableContainerBoundsChangeMemento(IDrawableContainerList listOfdrawableContainer, IEditorLanguage editorLanguage)
{ {
_listOfdrawableContainer = listOfdrawableContainer; _listOfdrawableContainer = listOfdrawableContainer;
StoreBounds(); _editorLanguage = editorLanguage;
StoreBounds();
} }
public DrawableContainerBoundsChangeMemento(IDrawableContainer drawableContainer) public DrawableContainerBoundsChangeMemento(IDrawableContainer drawableContainer)
{ {
_listOfdrawableContainer = new DrawableContainerList _listOfdrawableContainer = new DrawableContainerList(_editorLanguage)
{ {
drawableContainer drawableContainer
}; };
@ -73,7 +75,7 @@ namespace Greenshot.Addon.LegacyEditor.Memento
public IMemento Restore() public IMemento Restore()
{ {
var oldState = new DrawableContainerBoundsChangeMemento(_listOfdrawableContainer); var oldState = new DrawableContainerBoundsChangeMemento(_listOfdrawableContainer, _editorLanguage);
for (var index = 0; index < _listOfdrawableContainer.Count; index++) for (var index = 0; index < _listOfdrawableContainer.Count; index++)
{ {
var drawableContainer = _listOfdrawableContainer[index]; var drawableContainer = _listOfdrawableContainer[index];

View file

@ -33,25 +33,31 @@ namespace Greenshot.Addon.Win10
/// <inheritdoc /> /// <inheritdoc />
protected override void Load(ContainerBuilder builder) protected override void Load(ContainerBuilder builder)
{ {
if (WindowsVersion.IsWindows10OrLater) if (!WindowsVersion.IsWindows10OrLater)
{ {
builder // Workaround: Remove the assembly out of the visibility of CaliburnMicro so we don't get an exception
.RegisterType<Win10OcrDestination>() builder.RegisterBuildCallback(container =>
.As<IDestination>() {
.SingleInstance(); var assemblyResolver = container.Resolve<IAssemblyResolver>();
assemblyResolver.LoadedAssemblies.Remove(ThisAssembly.GetName().Name);
#if !NETCOREAPP3_0 });
builder return;
.RegisterType<Win10FormEnhancer>()
.As<IFormEnhancer>()
.SingleInstance();
#endif
builder
.RegisterType<Win10ShareDestination>()
.As<IDestination>()
.SingleInstance();
} }
builder
.RegisterType<Win10OcrDestination>()
.As<IDestination>()
.SingleInstance();
builder
.RegisterType<Win10FormEnhancer>()
.As<IFormEnhancer>()
.SingleInstance();
builder
.RegisterType<Win10ShareDestination>()
.As<IDestination>()
.SingleInstance();
base.Load(builder); base.Load(builder);
} }
} }

View file

@ -17,8 +17,6 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#if !NETCOREAPP3_0
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
@ -90,5 +88,4 @@ namespace Greenshot.Addon.Win10
_inkToolbar.TargetInkCanvas = _inkCanvas; _inkToolbar.TargetInkCanvas = _inkCanvas;
} }
} }
} }
#endif

View file

@ -18,10 +18,10 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AutoProperties.Fody" Version="1.21.0" /> <PackageReference Include="AutoProperties.Fody" Version="1.21.0" />
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.31" /> <PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.32" />
<PackageReference Include="Dapplo.CaliburnMicro.Metro" Version="1.2.31" /> <PackageReference Include="Dapplo.CaliburnMicro.Metro" Version="1.2.32" />
<PackageReference Include="Dapplo.CaliburnMicro.Toasts" Version="1.2.31" /> <PackageReference Include="Dapplo.CaliburnMicro.Toasts" Version="1.2.32" />
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.31" /> <PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.32" />
<PackageReference Include="Dapplo.HttpExtensions" Version="0.9.21" /> <PackageReference Include="Dapplo.HttpExtensions" Version="0.9.21" />
<PackageReference Include="Dapplo.HttpExtensions.JsonNet" Version="0.9.21" /> <PackageReference Include="Dapplo.HttpExtensions.JsonNet" Version="0.9.21" />
<PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.21" /> <PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.21" />

View file

@ -8,7 +8,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapplo.Addons" Version="1.2.14" /> <PackageReference Include="Dapplo.Addons" Version="1.2.16" />
<PackageReference Include="Dapplo.Log" Version="1.3.20" /> <PackageReference Include="Dapplo.Log" Version="1.3.20" />
<PackageReference Include="Dapplo.Windows" Version="0.8.33" /> <PackageReference Include="Dapplo.Windows" Version="0.8.33" />
<PackageReference Include="Dapplo.Windows.Dpi" Version="0.8.33" /> <PackageReference Include="Dapplo.Windows.Dpi" Version="0.8.33" />

View file

@ -17,7 +17,6 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#if !NETCOREAPP3_0
using System; using System;
using System.ServiceModel.Syndication; using System.ServiceModel.Syndication;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -51,5 +50,4 @@ namespace Greenshot.Tests
} }
} }
} }
} }
#endif

View file

@ -9,8 +9,6 @@
<ApplicationManifest>greenshot.manifest</ApplicationManifest> <ApplicationManifest>greenshot.manifest</ApplicationManifest>
<AssemblyTitle>Greenshot</AssemblyTitle> <AssemblyTitle>Greenshot</AssemblyTitle>
<AssemblyName>Greenshot</AssemblyName> <AssemblyName>Greenshot</AssemblyName>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -36,11 +34,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac.Extras.CommonServiceLocator" Version="5.0.0" />
<PackageReference Include="AutoProperties.Fody" Version="1.21.0" /> <PackageReference Include="AutoProperties.Fody" Version="1.21.0" />
<PackageReference Include="CommandLineParser" Version="2.5.0" /> <PackageReference Include="CommandLineParser" Version="2.5.0" />
<PackageReference Include="CommonServiceLocator" Version="2.0.4" /> <PackageReference Include="Dapplo.CaliburnMicro.Dapp" Version="1.2.32" />
<PackageReference Include="Dapplo.CaliburnMicro.Dapp" Version="1.2.31" />
<PackageReference Include="Dapplo.Log.LogFile" Version="1.3.20" /> <PackageReference Include="Dapplo.Log.LogFile" Version="1.3.20" />
<PackageReference Include="Dapplo.Log.Loggers" Version="1.3.20" /> <PackageReference Include="Dapplo.Log.Loggers" Version="1.3.20" />
<PackageReference Include="Dapplo.Windows.Multimedia" Version="0.8.33" /> <PackageReference Include="Dapplo.Windows.Multimedia" Version="0.8.33" />
@ -48,22 +44,16 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="gong-wpf-dragdrop" Version="2.0.1" /> <PackageReference Include="gong-wpf-dragdrop" Version="2.0.2" />
<PackageReference Include="Svg" Version="2.4.3" /> <PackageReference Include="Svg" Version="2.4.3" />
<PackageReference Include="System.Runtime" Version="4.3.1" />
<PackageReference Include="System.Runtime.Extensions" Version="4.3.1" />
<PackageReference Include="System.Runtime.WindowsRuntime" Version="4.6.0-preview4.19212.13" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Greenshot.Addon.ExternalCommand\Greenshot.Addon.ExternalCommand.csproj" /> <ProjectReference Include="..\Greenshot.Addon.ExternalCommand\Greenshot.Addon.ExternalCommand.csproj" />
<TrimmerRootAssembly Include="Greenshot.Addon.ExternalCommand" />
<ProjectReference Include="..\Greenshot.Addon.InternetExplorer\Greenshot.Addon.InternetExplorer.csproj" /> <ProjectReference Include="..\Greenshot.Addon.InternetExplorer\Greenshot.Addon.InternetExplorer.csproj" />
<TrimmerRootAssembly Include="Greenshot.Addon.InternetExplorer" />
<ProjectReference Include="..\Greenshot.Addon.LegacyEditor\Greenshot.Addon.LegacyEditor.csproj" /> <ProjectReference Include="..\Greenshot.Addon.LegacyEditor\Greenshot.Addon.LegacyEditor.csproj" />
<TrimmerRootAssembly Include="Greenshot.Addon.LegacyEditor" />
<ProjectReference Include="..\Greenshot.Addon.Office\Greenshot.Addon.Office.csproj" /> <ProjectReference Include="..\Greenshot.Addon.Office\Greenshot.Addon.Office.csproj" />
<TrimmerRootAssembly Include="Greenshot.Addon.Office" /> <ProjectReference Include="..\Greenshot.Addon.Win10\Greenshot.Addon.Win10.csproj" />
<ProjectReference Include="..\Greenshot.Core\Greenshot.Core.csproj" /> <ProjectReference Include="..\Greenshot.Core\Greenshot.Core.csproj" />
<ProjectReference Include="..\Greenshot.Gfx\Greenshot.Gfx.csproj" /> <ProjectReference Include="..\Greenshot.Gfx\Greenshot.Gfx.csproj" />
<ProjectReference Include="..\Greenshot.Addons\Greenshot.Addons.csproj" /> <ProjectReference Include="..\Greenshot.Addons\Greenshot.Addons.csproj" />

View file

@ -72,9 +72,6 @@ namespace Greenshot
.WithMutex("F48E86D3-E34C-4DB7-8F8F-9A0EA55F0D08") .WithMutex("F48E86D3-E34C-4DB7-8F8F-9A0EA55F0D08")
.WithCaliburnMicro() .WithCaliburnMicro()
.WithoutCopyOfEmbeddedAssemblies() .WithoutCopyOfEmbeddedAssemblies()
#if !NETCOREAPP3_0
.WithoutCopyOfAssembliesToProbingPath()
#endif
.WithAssemblyPatterns("Greenshot.Addon.*") .WithAssemblyPatterns("Greenshot.Addon.*")
.BuildApplicationConfig(); .BuildApplicationConfig();
@ -93,7 +90,7 @@ namespace Greenshot
return -1; return -1;
} }
//RegisterErrorHandlers(application); RegisterErrorHandlers(application);
application.Run(); application.Run();
return 0; return 0;
@ -118,28 +115,39 @@ namespace Greenshot
/// <param name="exception">Exception</param> /// <param name="exception">Exception</param>
private static async void DisplayErrorViewModel(Dapplication application, Exception exception) private static async void DisplayErrorViewModel(Dapplication application, Exception exception)
{ {
var windowManager = application.Bootstrapper.Container?.Resolve<IWindowManager>(); var log = new LogSource();
if (windowManager == null) log.Error().WriteLine(exception, "An error occured:", null);
try
{ {
Debugger.Break(); var windowManager = application.Bootstrapper.Container?.Resolve<IWindowManager>();
return; if (windowManager == null)
}
using (var errorViewModel = application.Bootstrapper.Container.Resolve<Owned<ErrorViewModel>>())
{
if (errorViewModel == null)
{ {
Debugger.Break();
return; return;
} }
errorViewModel.Value.SetExceptionToDisplay(exception);
if (!UiContext.HasUiAccess) using (var errorViewModel = application.Bootstrapper.Container.Resolve<Owned<ErrorViewModel>>())
{ {
await UiContext.RunOn(() => windowManager.ShowDialog(errorViewModel.Value)); if (errorViewModel == null)
} {
else return;
{ }
windowManager.ShowDialog(errorViewModel.Value);
errorViewModel.Value.SetExceptionToDisplay(exception);
if (!UiContext.HasUiAccess)
{
await UiContext.RunOn(() => windowManager.ShowDialog(errorViewModel.Value));
}
else
{
windowManager.ShowDialog(errorViewModel.Value);
}
} }
} }
catch (Exception ex)
{
log.Error().WriteLine(ex, "An error occured while displaying the error:", null);
}
} }
/// <summary> /// <summary>
@ -174,7 +182,6 @@ namespace Greenshot
using (var multiInstanceForm = new DpiAwareForm using (var multiInstanceForm = new DpiAwareForm
{ {
// TODO: Fix a problem that in this case instance is null
Icon = greenshotResources.GetGreenshotIcon(), Icon = greenshotResources.GetGreenshotIcon(),
ShowInTaskbar = true, ShowInTaskbar = true,
MaximizeBox = false, MaximizeBox = false,