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
displayName: 'Install .NET Core SDK 3.0'
inputs:
version: '3.0.100-preview6-012162'
version: '3.0.100-preview7-012279'
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 5.0.0'
@ -35,7 +35,7 @@ steps:
command: 'publish'
publishWebProjects: false
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
- task: CmdLine@2
@ -49,7 +49,7 @@ steps:
command: 'publish'
publishWebProjects: false
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
- task: CmdLine@2

View file

@ -14,10 +14,7 @@
<FileVersion>1.0.0</FileVersion>
<UseWPF>true</UseWPF>
<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-->
<ExtrasEnableWpfProjectSetup>true</ExtrasEnableWpfProjectSetup>
<ExtrasEnableWinFormsProjectSetup>true</ExtrasEnableWinFormsProjectSetup>
<RuntimeIdentifiers>win10-x64;win10-x86;win-x64;win-x86</RuntimeIdentifiers>
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
@ -28,6 +25,16 @@
<NoWarn>CS1591</NoWarn>
</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'))">
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<IsPackable>true</IsPackable>
@ -53,19 +60,15 @@
<DebugSymbols>True</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition="$(MSBuildProjectName.Contains('.Addon.'))">
<RootPackageReference>true</RootPackageReference>
</PropertyGroup>
<ItemGroup Condition="!$(MSBuildProjectName.Contains('Tests')) And $(MSBuildProjectName.StartsWith('Greenshot'))">
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.167">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</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>
<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="
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;

View file

@ -59,14 +59,14 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{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|x64.ActiveCfg = Debug|x64
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|x64.Build.0 = Debug|x64
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|x64.ActiveCfg = Debug|Any CPU
{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.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.Build.0 = Release|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|x64.ActiveCfg = Release|x64
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|x64.Build.0 = Release|x64
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|x64.ActiveCfg = Release|Any CPU
{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.Build.0 = Release|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;
}
#if !NETCOREAPP3_0
var ieAccessible = new Accessible(directUiWd.Handle);
foreach (var url in ieAccessible.IETabUrls)
{
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.Extensions;
using Dapplo.Jira;
#if !NETCOREAPP3_0
using Dapplo.Jira.Converters;
#endif
using Dapplo.Jira.Entities;
using Dapplo.Log;
using Greenshot.Addon.Jira.Configuration;
@ -98,15 +96,13 @@ namespace Greenshot.Addon.Jira
public void UpdateSvgSize(int size)
{
#if !NETCOREAPP3_0
_jiraClient.Behaviour.SetConfig(new SvgConfiguration { Width = size, Height = size });
#endif
}
/// <summary>
/// Internal login which catches the exceptions
/// </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)
{
if (string.IsNullOrEmpty(user) || string.IsNullOrEmpty(password))

View file

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

View file

@ -43,14 +43,14 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields
private readonly IDrawableContainerList _boundContainers;
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)
{
var field = new Field(fieldType, GetType());
AddField(field);
}
_boundContainers = new DrawableContainerList
_boundContainers = new DrawableContainerList(editorLanguage)
{
Parent = parent
};

View file

@ -63,6 +63,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
[NonSerialized]
private readonly IEditorConfiguration _editorConfiguration;
private readonly IEditorLanguage _editorLanguage;
[NonSerialized]
private readonly ICoreConfiguration _coreConfiguration;
@ -219,14 +221,15 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
/// <summary>
/// Base Surface constructor
/// </summary>
public Surface(ICoreConfiguration coreConfiguration, IEditorConfiguration editorConfiguration)
public Surface(ICoreConfiguration coreConfiguration, IEditorConfiguration editorConfiguration, IEditorLanguage editorLanguage)
{
_editorConfiguration = editorConfiguration;
_editorLanguage = editorLanguage;
_coreConfiguration = coreConfiguration;
_fieldAggregator = new FieldAggregator(this, editorConfiguration);
_fieldAggregator = new FieldAggregator(this, editorConfiguration, editorLanguage);
Count++;
_elements = new DrawableContainerList(Id);
_selectedElements = new DrawableContainerList(Id);
_elements = new DrawableContainerList(Id, _editorLanguage);
_selectedElements = new DrawableContainerList(Id, _editorLanguage);
Log.Debug().WriteLine("Creating surface!");
MouseDown += SurfaceMouseDown;
MouseUp += SurfaceMouseUp;
@ -255,7 +258,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="editorConfiguration">IEditorConfiguration</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);
SetBitmap(newBitmap, true);
@ -267,7 +270,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="editorConfiguration">IEditorConfiguration</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);
}
@ -665,7 +668,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
public void RemoveElements(IDrawableContainerList elementsToRemove, bool makeUndoable = true)
{
// fix potential issues with iterating a changing list
var cloned = new DrawableContainerList();
var cloned = new DrawableContainerList(_editorLanguage);
cloned.AddRange(elementsToRemove);
if (makeUndoable)
{
@ -724,7 +727,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
public void AddElements(IDrawableContainerList elementsToAdd, bool makeUndoable = true)
{
// fix potential issues with iterating a changing list
var cloned = new DrawableContainerList();
var cloned = new DrawableContainerList(_editorLanguage);
cloned.AddRange(elementsToAdd);
if (makeUndoable)
{
@ -1400,7 +1403,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
var rightClickedContainer = _elements.ClickableElementAt(_mouseStart.X, _mouseStart.Y);
if (rightClickedContainer != null)
{
selectedList = new DrawableContainerList(Id) {rightClickedContainer};
selectedList = new DrawableContainerList(Id, _editorLanguage) {rightClickedContainer};
}
}
if (selectedList != null && selectedList.Count > 0)

View file

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

View file

@ -111,7 +111,6 @@
<ItemGroup>
<PackageReference Include="AutoProperties.Fody" Version="1.21.0" />
<PackageReference Include="CommonServiceLocator" Version="2.0.4" />
<PackageReference Include="Fody" Version="4.2.1">
<PrivateAssets>all</PrivateAssets>
<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<Size> _sizes = new List<Size>();
private IDrawableContainerList _listOfdrawableContainer;
private readonly IEditorLanguage _editorLanguage;
public DrawableContainerBoundsChangeMemento(IDrawableContainerList listOfdrawableContainer)
public DrawableContainerBoundsChangeMemento(IDrawableContainerList listOfdrawableContainer, IEditorLanguage editorLanguage)
{
_listOfdrawableContainer = listOfdrawableContainer;
_editorLanguage = editorLanguage;
StoreBounds();
}
public DrawableContainerBoundsChangeMemento(IDrawableContainer drawableContainer)
{
_listOfdrawableContainer = new DrawableContainerList
_listOfdrawableContainer = new DrawableContainerList(_editorLanguage)
{
drawableContainer
};
@ -73,7 +75,7 @@ namespace Greenshot.Addon.LegacyEditor.Memento
public IMemento Restore()
{
var oldState = new DrawableContainerBoundsChangeMemento(_listOfdrawableContainer);
var oldState = new DrawableContainerBoundsChangeMemento(_listOfdrawableContainer, _editorLanguage);
for (var index = 0; index < _listOfdrawableContainer.Count; index++)
{
var drawableContainer = _listOfdrawableContainer[index];

View file

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

View file

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

View file

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

View file

@ -8,7 +8,7 @@
</PropertyGroup>
<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.Windows" 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
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#if !NETCOREAPP3_0
using System;
using System.ServiceModel.Syndication;
using System.Threading.Tasks;
@ -52,4 +51,3 @@ namespace Greenshot.Tests
}
}
}
#endif

View file

@ -9,8 +9,6 @@
<ApplicationManifest>greenshot.manifest</ApplicationManifest>
<AssemblyTitle>Greenshot</AssemblyTitle>
<AssemblyName>Greenshot</AssemblyName>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
@ -36,11 +34,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Autofac.Extras.CommonServiceLocator" Version="5.0.0" />
<PackageReference Include="AutoProperties.Fody" Version="1.21.0" />
<PackageReference Include="CommandLineParser" Version="2.5.0" />
<PackageReference Include="CommonServiceLocator" Version="2.0.4" />
<PackageReference Include="Dapplo.CaliburnMicro.Dapp" Version="1.2.31" />
<PackageReference Include="Dapplo.CaliburnMicro.Dapp" Version="1.2.32" />
<PackageReference Include="Dapplo.Log.LogFile" Version="1.3.20" />
<PackageReference Include="Dapplo.Log.Loggers" Version="1.3.20" />
<PackageReference Include="Dapplo.Windows.Multimedia" Version="0.8.33" />
@ -48,22 +44,16 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</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="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>
<ProjectReference Include="..\Greenshot.Addon.ExternalCommand\Greenshot.Addon.ExternalCommand.csproj" />
<TrimmerRootAssembly Include="Greenshot.Addon.ExternalCommand" />
<ProjectReference Include="..\Greenshot.Addon.InternetExplorer\Greenshot.Addon.InternetExplorer.csproj" />
<TrimmerRootAssembly Include="Greenshot.Addon.InternetExplorer" />
<ProjectReference Include="..\Greenshot.Addon.LegacyEditor\Greenshot.Addon.LegacyEditor.csproj" />
<TrimmerRootAssembly Include="Greenshot.Addon.LegacyEditor" />
<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.Gfx\Greenshot.Gfx.csproj" />
<ProjectReference Include="..\Greenshot.Addons\Greenshot.Addons.csproj" />

View file

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