mirror of
https://github.com/greenshot/greenshot
synced 2025-08-25 15:46:22 -07:00
Merge pull request #88 from greenshot/feature/autofac
Merge for the autofac implementation
This commit is contained in:
commit
45290a526c
202 changed files with 3540 additions and 3186 deletions
|
@ -1,4 +1,4 @@
|
|||
#region Greenshot GNU General Public License
|
||||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
|
||||
|
@ -21,37 +21,29 @@
|
|||
|
||||
#endregion
|
||||
|
||||
#region Usings
|
||||
using Autofac;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Greenshot.Addon.Box.ViewModels;
|
||||
using Greenshot.Addons.Components;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Greenshot.Addons.Addons;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Greenshot.Addons.Interfaces.Plugin
|
||||
namespace Greenshot.Addon.Box
|
||||
{
|
||||
public interface IGreenshotPlugin : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Is called after the plugin is instanciated
|
||||
/// </summary>
|
||||
/// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
|
||||
bool Initialize();
|
||||
/// <inheritdoc />
|
||||
public class BoxAddonModule : AddonModule
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder
|
||||
.RegisterType<BoxDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<BoxConfigViewModel>()
|
||||
.As<IConfigScreen>()
|
||||
.SingleInstance();
|
||||
|
||||
/// <summary>
|
||||
/// Unload of the plugin
|
||||
/// </summary>
|
||||
void Shutdown();
|
||||
|
||||
/// <summary>
|
||||
/// Return IDestination's, if the plugin wants to
|
||||
/// </summary>
|
||||
IEnumerable<IDestination> Destinations();
|
||||
|
||||
/// <summary>
|
||||
/// Return IProcessor's, if the plugin wants to
|
||||
/// </summary>
|
||||
IEnumerable<IProcessor> Processors();
|
||||
}
|
||||
}
|
||||
base.Load(builder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,22 +25,21 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Dapplo.Addons.Bootstrapper.Resolving;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.HttpExtensions;
|
||||
using Dapplo.HttpExtensions.OAuth;
|
||||
using Dapplo.Log;
|
||||
using Dapplo.Utils;
|
||||
using Greenshot.Addon.Box.Entities;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Controls;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Extensions;
|
||||
|
@ -58,19 +57,23 @@ namespace Greenshot.Addon.Box
|
|||
private readonly IBoxConfiguration _boxConfiguration;
|
||||
private readonly IBoxLanguage _boxLanguage;
|
||||
private readonly INetworkConfiguration _networkConfiguration;
|
||||
private readonly IResourceProvider _resourceProvider;
|
||||
private readonly OAuth2Settings _oauth2Settings;
|
||||
private static readonly Uri UploadFileUri = new Uri("https://upload.box.com/api/2.0/files/content");
|
||||
private static readonly Uri FilesUri = new Uri("https://www.box.com/api/2.0/files/");
|
||||
|
||||
[ImportingConstructor]
|
||||
public BoxDestination(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
IBoxConfiguration boxConfiguration,
|
||||
IBoxLanguage boxLanguage,
|
||||
INetworkConfiguration networkConfiguration)
|
||||
INetworkConfiguration networkConfiguration,
|
||||
IResourceProvider resourceProvider) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_boxConfiguration = boxConfiguration;
|
||||
_boxLanguage = boxLanguage;
|
||||
_networkConfiguration = networkConfiguration;
|
||||
_resourceProvider = resourceProvider;
|
||||
|
||||
_oauth2Settings = new OAuth2Settings
|
||||
{
|
||||
|
@ -100,8 +103,7 @@ namespace Greenshot.Addon.Box
|
|||
get
|
||||
{
|
||||
// TODO: Optimize this
|
||||
var embeddedResource = GetType().Assembly.FindEmbeddedResources(@".*box\.png").FirstOrDefault();
|
||||
using (var bitmapStream = GetType().Assembly.GetEmbeddedResourceAsStream(embeddedResource))
|
||||
using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "box.png"))
|
||||
{
|
||||
return BitmapHelper.FromStream(bitmapStream);
|
||||
}
|
||||
|
@ -152,7 +154,7 @@ namespace Greenshot.Addon.Box
|
|||
catch (Exception ex)
|
||||
{
|
||||
Log.Error().WriteLine(ex, "Error uploading.");
|
||||
MessageBox.Show(_boxLanguage.UploadFailure + " " + ex.Message);
|
||||
MessageBox.Show(_boxLanguage.UploadFailure + @" " + ex.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,15 @@
|
|||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Extras.AttributeMetadata, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Extras.AttributeMetadata.4.0.1\lib\net45\Autofac.Extras.AttributeMetadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Mef, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Mef.4.0.0\lib\net45\Autofac.Integration.Mef.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -37,29 +46,29 @@
|
|||
<Reference Include="CommonServiceLocator, Version=2.0.3.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommonServiceLocator.2.0.3\lib\net45\CommonServiceLocator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.0.5.56\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.1.0.44\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.0.5.56\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.1.0.44\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.0.5.28\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.1.0.42\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.0.5.28\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.1.0.42\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.0.5.28\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.1.0.42\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.0.5.28\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.1.0.42\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.0.5.28\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.1.0.42\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.0.5.28\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.42\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.HttpExtensions, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.0.8.35\lib\net45\Dapplo.HttpExtensions.dll</HintPath>
|
||||
|
@ -70,14 +79,14 @@
|
|||
<Reference Include="Dapplo.HttpExtensions.OAuth, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.OAuth.0.8.35\lib\net45\Dapplo.HttpExtensions.OAuth.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.24\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.InterfaceImpl, Version=0.2.12.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.InterfaceImpl.0.2.12\lib\net45\Dapplo.InterfaceImpl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.24\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.28\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Log, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Log.1.2.1\lib\net45\Dapplo.Log.dll</HintPath>
|
||||
|
@ -151,6 +160,7 @@
|
|||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BoxAddonModule.cs" />
|
||||
<Compile Include="Entities\BoxEntity.cs" />
|
||||
<Compile Include="Entities\BoxFile.cs" />
|
||||
<Compile Include="Entities\BoxItem.cs" />
|
||||
|
@ -203,7 +213,7 @@
|
|||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"
|
||||
|
|
|
@ -29,7 +29,6 @@ using Dapplo.HttpExtensions.OAuth;
|
|||
using Dapplo.Ini;
|
||||
using Dapplo.InterfaceImpl.Extensions;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Core.Enums;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#endregion
|
||||
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Reactive.Disposables;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Dapplo.CaliburnMicro.Extensions;
|
||||
|
@ -31,7 +30,6 @@ using Greenshot.Addons.ViewModels;
|
|||
|
||||
namespace Greenshot.Addon.Box.ViewModels
|
||||
{
|
||||
[Export(typeof(IConfigScreen))]
|
||||
public sealed class BoxConfigViewModel : SimpleConfigScreen
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -39,17 +37,26 @@ namespace Greenshot.Addon.Box.ViewModels
|
|||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
[Import]
|
||||
public IBoxConfiguration BoxConfiguration { get; set; }
|
||||
public IBoxConfiguration BoxConfiguration { get; }
|
||||
|
||||
[Import]
|
||||
public IBoxLanguage BoxLanguage { get; set; }
|
||||
public IBoxLanguage BoxLanguage { get; }
|
||||
|
||||
[Import]
|
||||
public IGreenshotLanguage GreenshotLanguage { get; set; }
|
||||
public IGreenshotLanguage GreenshotLanguage { get; }
|
||||
|
||||
[Import]
|
||||
public FileConfigPartViewModel FileConfigPartViewModel { get; private set; }
|
||||
public FileConfigPartViewModel FileConfigPartViewModel { get; }
|
||||
|
||||
public BoxConfigViewModel(
|
||||
IBoxConfiguration boxConfiguration,
|
||||
IBoxLanguage boxLanguage,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
FileConfigPartViewModel fileConfigPartViewModel
|
||||
)
|
||||
{
|
||||
BoxConfiguration = boxConfiguration;
|
||||
BoxLanguage = boxLanguage;
|
||||
GreenshotLanguage = greenshotLanguage;
|
||||
FileConfigPartViewModel = fileConfigPartViewModel;
|
||||
}
|
||||
|
||||
public override void Initialize(IConfig config)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.3.0" newVersion="2.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.8.1.0" newVersion="4.8.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,22 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="4.8.1" targetFramework="net452" />
|
||||
<package id="Autofac.Extras.AttributeMetadata" version="4.0.1" targetFramework="net452" />
|
||||
<package id="Autofac.Mef" version="4.0.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net452" />
|
||||
<package id="CommonServiceLocator" version="2.0.3" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions.JsonNet" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions.OAuth" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Log" version="1.2.1" targetFramework="net452" />
|
||||
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows" version="0.5.56" targetFramework="net452" />
|
||||
|
|
49
src/Greenshot.Addon.Confluence/ConfluenceAddonModule.cs
Normal file
49
src/Greenshot.Addon.Confluence/ConfluenceAddonModule.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using Autofac;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Greenshot.Addon.Confluence.ViewModels;
|
||||
using Greenshot.Addons.Components;
|
||||
|
||||
namespace Greenshot.Addon.Confluence
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class ConfluenceAddonModule : AddonModule
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder
|
||||
.RegisterType<ConfluenceDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<ConfluenceConfigViewModel>()
|
||||
.As<IConfigScreen>()
|
||||
.SingleInstance();
|
||||
|
||||
base.Load(builder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Threading;
|
||||
|
@ -33,7 +32,8 @@ using System.Windows;
|
|||
using Dapplo.Confluence;
|
||||
using Dapplo.Confluence.Entities;
|
||||
using Dapplo.Log;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Controls;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
|
@ -55,7 +55,7 @@ namespace Greenshot.Addon.Confluence
|
|||
private readonly IConfluenceConfiguration _confluenceConfiguration;
|
||||
private readonly IConfluenceLanguage _confluenceLanguage;
|
||||
private IConfluenceClient _confluenceClient;
|
||||
private Content _page;
|
||||
private readonly Content _page;
|
||||
|
||||
static ConfluenceDestination()
|
||||
{
|
||||
|
@ -76,14 +76,27 @@ namespace Greenshot.Addon.Confluence
|
|||
}
|
||||
}
|
||||
|
||||
[ImportingConstructor]
|
||||
public ConfluenceDestination(IConfluenceConfiguration confluenceConfiguration, IConfluenceLanguage confluenceLanguage)
|
||||
public ConfluenceDestination(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
IConfluenceConfiguration confluenceConfiguration,
|
||||
IConfluenceLanguage confluenceLanguage) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_confluenceConfiguration = confluenceConfiguration;
|
||||
_confluenceLanguage = confluenceLanguage;
|
||||
}
|
||||
|
||||
public static bool IsInitialized { get; private set; }
|
||||
protected ConfluenceDestination(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
IConfluenceConfiguration confluenceConfiguration,
|
||||
IConfluenceLanguage confluenceLanguage,
|
||||
Content page) : this(coreConfiguration, greenshotLanguage, confluenceConfiguration, confluenceLanguage)
|
||||
{
|
||||
_page = page;
|
||||
}
|
||||
|
||||
public static bool IsInitialized { get; private set; }
|
||||
|
||||
public override string Description
|
||||
{
|
||||
|
@ -112,7 +125,7 @@ namespace Greenshot.Addon.Confluence
|
|||
}
|
||||
foreach (var currentPage in currentPages)
|
||||
{
|
||||
yield return new ConfluenceDestination(_confluenceConfiguration, _confluenceLanguage);
|
||||
yield return new ConfluenceDestination(CoreConfiguration, GreenshotLanguage, _confluenceConfiguration, _confluenceLanguage, currentPage);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,15 @@
|
|||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Extras.AttributeMetadata, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Extras.AttributeMetadata.4.0.1\lib\net45\Autofac.Extras.AttributeMetadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Mef, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Mef.4.0.0\lib\net45\Autofac.Integration.Mef.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -53,32 +62,32 @@
|
|||
<Reference Include="CommonServiceLocator, Version=2.0.3.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommonServiceLocator.2.0.3\lib\net45\CommonServiceLocator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Costura, Version=2.0.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Costura.Fody.2.0.0\lib\net452\Costura.dll</HintPath>
|
||||
<Reference Include="Costura, Version=2.0.1.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Costura.Fody.2.0.1\lib\net452\Costura.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.0.5.56\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.1.0.44\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.0.5.56\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.1.0.44\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.0.5.28\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.1.0.42\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.0.5.28\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.1.0.42\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.0.5.28\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.1.0.42\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.0.5.28\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.1.0.42\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.0.5.28\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.1.0.42\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.0.5.28\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.42\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Confluence, Version=0.7.19.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Confluence.0.7.19\lib\net45\Dapplo.Confluence.dll</HintPath>
|
||||
|
@ -92,14 +101,14 @@
|
|||
<Reference Include="Dapplo.HttpExtensions.OAuth, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.OAuth.0.8.35\lib\net45\Dapplo.HttpExtensions.OAuth.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.24\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.InterfaceImpl, Version=0.2.12.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.InterfaceImpl.0.2.12\lib\net45\Dapplo.InterfaceImpl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.24\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.28\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Log, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Log.1.2.1\lib\net45\Dapplo.Log.dll</HintPath>
|
||||
|
@ -182,6 +191,7 @@
|
|||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ConfluenceAddonModule.cs" />
|
||||
<Compile Include="IConfluenceLanguage.cs" />
|
||||
<Compile Include="IConfluenceConfiguration.cs" />
|
||||
<Compile Include="ConfluenceDestination.cs" />
|
||||
|
@ -223,7 +233,7 @@
|
|||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"</PostBuildEvent>
|
||||
|
@ -232,9 +242,9 @@ copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuratio
|
|||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Costura.Fody.2.0.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.2.0.0\build\Costura.Fody.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Fody.3.0.3\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.3.0.3\build\Fody.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Costura.Fody.2.0.0\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.2.0.0\build\Costura.Fody.targets')" />
|
||||
<Import Project="..\packages\Fody.3.0.3\build\Fody.targets" Condition="Exists('..\packages\Fody.3.0.3\build\Fody.targets')" />
|
||||
<Import Project="..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets')" />
|
||||
</Project>
|
|
@ -22,7 +22,6 @@
|
|||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Reactive.Disposables;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Dapplo.CaliburnMicro.Extensions;
|
||||
|
@ -33,7 +32,6 @@ using Greenshot.Addons.Extensions;
|
|||
|
||||
namespace Greenshot.Addon.Confluence.ViewModels
|
||||
{
|
||||
[Export(typeof(IConfigScreen))]
|
||||
public sealed class ConfluenceConfigViewModel : SimpleConfigScreen
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -41,14 +39,19 @@ namespace Greenshot.Addon.Confluence.ViewModels
|
|||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
[Import]
|
||||
public IConfluenceConfiguration ConfluenceConfiguration { get; set; }
|
||||
public IConfluenceConfiguration ConfluenceConfiguration { get; }
|
||||
public IConfluenceLanguage ConfluenceLanguage { get; }
|
||||
public IGreenshotLanguage GreenshotLanguage { get; }
|
||||
|
||||
[Import]
|
||||
public IConfluenceLanguage ConfluenceLanguage { get; set; }
|
||||
|
||||
[Import]
|
||||
public IGreenshotLanguage GreenshotLanguage { get; set; }
|
||||
public ConfluenceConfigViewModel(
|
||||
IConfluenceConfiguration confluenceConfiguration,
|
||||
IConfluenceLanguage confluenceLanguage,
|
||||
IGreenshotLanguage greenshotLanguage)
|
||||
{
|
||||
ConfluenceConfiguration = confluenceConfiguration;
|
||||
ConfluenceLanguage = confluenceLanguage;
|
||||
GreenshotLanguage = greenshotLanguage;
|
||||
}
|
||||
|
||||
public override void Initialize(IConfig config)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.3.0" newVersion="2.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.8.1.0" newVersion="4.8.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,24 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="4.8.1" targetFramework="net452" />
|
||||
<package id="Autofac.Extras.AttributeMetadata" version="4.0.1" targetFramework="net452" />
|
||||
<package id="Autofac.Mef" version="4.0.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net452" />
|
||||
<package id="CommonServiceLocator" version="2.0.3" targetFramework="net452" />
|
||||
<package id="Costura.Fody" version="2.0.0" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Costura.Fody" version="2.0.1" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.Confluence" version="0.7.19" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions.JsonSimple" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions.OAuth" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Log" version="1.2.1" targetFramework="net452" />
|
||||
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows" version="0.5.56" targetFramework="net452" />
|
||||
|
|
49
src/Greenshot.Addon.Dropbox/DropboxAddonModule.cs
Normal file
49
src/Greenshot.Addon.Dropbox/DropboxAddonModule.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using Autofac;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Greenshot.Addon.Dropbox.ViewModels;
|
||||
using Greenshot.Addons.Components;
|
||||
|
||||
namespace Greenshot.Addon.Dropbox
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class DropboxAddonModule : AddonModule
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder
|
||||
.RegisterType<DropboxDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<DropboxConfigViewModel>()
|
||||
.As<IConfigScreen>()
|
||||
.SingleInstance();
|
||||
|
||||
base.Load(builder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,22 +25,21 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Dapplo.Addons.Bootstrapper.Resolving;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.HttpExtensions;
|
||||
using Dapplo.HttpExtensions.OAuth;
|
||||
using Dapplo.Log;
|
||||
using Dapplo.Utils;
|
||||
using Greenshot.Addon.Dropbox.Entities;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Controls;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Extensions;
|
||||
|
@ -61,17 +60,22 @@ namespace Greenshot.Addon.Dropbox
|
|||
|
||||
private readonly IDropboxConfiguration _dropboxPluginConfiguration;
|
||||
private readonly IDropboxLanguage _dropboxLanguage;
|
||||
private readonly IResourceProvider _resourceProvider;
|
||||
private OAuth2Settings _oAuth2Settings;
|
||||
private IHttpBehaviour _oAuthHttpBehaviour;
|
||||
|
||||
[ImportingConstructor]
|
||||
public DropboxDestination(
|
||||
IDropboxConfiguration dropboxPluginConfiguration,
|
||||
IDropboxLanguage dropboxLanguage,
|
||||
INetworkConfiguration networkConfiguration)
|
||||
{
|
||||
INetworkConfiguration networkConfiguration,
|
||||
IResourceProvider resourceProvider,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_dropboxPluginConfiguration = dropboxPluginConfiguration;
|
||||
_dropboxLanguage = dropboxLanguage;
|
||||
_resourceProvider = resourceProvider;
|
||||
|
||||
_oAuth2Settings = new OAuth2Settings
|
||||
{
|
||||
|
@ -92,7 +96,7 @@ namespace Greenshot.Addon.Dropbox
|
|||
RedirectUrl = "http://localhost:47336",
|
||||
Token = dropboxPluginConfiguration
|
||||
};
|
||||
var httpBehaviour = OAuth2HttpBehaviourFactory.Create(_oAuth2Settings) as IChangeableHttpBehaviour;
|
||||
var httpBehaviour = OAuth2HttpBehaviourFactory.Create(_oAuth2Settings);
|
||||
|
||||
_oAuthHttpBehaviour = httpBehaviour;
|
||||
// Use the default network settings
|
||||
|
@ -103,9 +107,8 @@ namespace Greenshot.Addon.Dropbox
|
|||
{
|
||||
get
|
||||
{
|
||||
// TODO: Optimize this
|
||||
var embeddedResource = GetType().Assembly.FindEmbeddedResources(@".*Dropbox\.gif").FirstOrDefault();
|
||||
using (var bitmapStream = GetType().Assembly.GetEmbeddedResourceAsStream(embeddedResource))
|
||||
// TODO: Optimize this by caching
|
||||
using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "Dropbox.gif"))
|
||||
{
|
||||
return BitmapHelper.FromStream(bitmapStream);
|
||||
}
|
||||
|
@ -166,19 +169,20 @@ namespace Greenshot.Addon.Dropbox
|
|||
catch (Exception e)
|
||||
{
|
||||
Log.Error().WriteLine(e);
|
||||
MessageBox.Show(_dropboxLanguage.UploadFailure + " " + e.Message);
|
||||
MessageBox.Show(_dropboxLanguage.UploadFailure + @" " + e.Message);
|
||||
}
|
||||
return dropboxUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upload the HttpContent to dropbox
|
||||
/// </summary>
|
||||
/// <param name="filename">Name of the file</param>
|
||||
/// <param name="content">HttpContent</param>
|
||||
/// <param name="cancellationToken">CancellationToken</param>
|
||||
/// <returns>Url as string</returns>
|
||||
private async Task<string> UploadAsync(string filename, HttpContent content, IProgress<int> progress = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||
/// Upload the HttpContent to dropbox
|
||||
/// </summary>
|
||||
/// <param name="filename">Name of the file</param>
|
||||
/// <param name="content">HttpContent</param>
|
||||
/// <param name="progress">IProgress</param>
|
||||
/// <param name="cancellationToken">CancellationToken</param>
|
||||
/// <returns>Url as string</returns>
|
||||
private async Task<string> UploadAsync(string filename, HttpContent content, IProgress<int> progress = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
var oAuthHttpBehaviour = _oAuthHttpBehaviour.ShallowClone();
|
||||
// Use UploadProgress
|
||||
|
|
|
@ -37,6 +37,15 @@
|
|||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Extras.AttributeMetadata, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Extras.AttributeMetadata.4.0.1\lib\net45\Autofac.Extras.AttributeMetadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Mef, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Mef.4.0.0\lib\net45\Autofac.Integration.Mef.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -49,29 +58,29 @@
|
|||
<Reference Include="CommonServiceLocator, Version=2.0.3.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommonServiceLocator.2.0.3\lib\net45\CommonServiceLocator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.0.5.56\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.1.0.44\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.0.5.56\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.1.0.44\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.0.5.28\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.1.0.42\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.0.5.28\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.1.0.42\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.0.5.28\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.1.0.42\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.0.5.28\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.1.0.42\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.0.5.28\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.1.0.42\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.0.5.28\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.42\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.HttpExtensions, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.0.8.35\lib\net45\Dapplo.HttpExtensions.dll</HintPath>
|
||||
|
@ -82,14 +91,14 @@
|
|||
<Reference Include="Dapplo.HttpExtensions.OAuth, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.OAuth.0.8.35\lib\net45\Dapplo.HttpExtensions.OAuth.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.24\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.InterfaceImpl, Version=0.2.12.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.InterfaceImpl.0.2.12\lib\net45\Dapplo.InterfaceImpl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.24\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.28\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Log, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Log.1.2.1\lib\net45\Dapplo.Log.dll</HintPath>
|
||||
|
@ -162,6 +171,7 @@
|
|||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DropboxAddonModule.cs" />
|
||||
<Compile Include="Entities\CreateLinkReply.cs" />
|
||||
<Compile Include="Entities\CreateLinkRequest.cs" />
|
||||
<Compile Include="Entities\Error.cs" />
|
||||
|
@ -219,7 +229,7 @@
|
|||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"
|
||||
|
|
|
@ -29,7 +29,6 @@ using Dapplo.HttpExtensions.OAuth;
|
|||
using Dapplo.Ini;
|
||||
using Dapplo.InterfaceImpl.Extensions;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Core.Enums;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -21,17 +21,14 @@
|
|||
|
||||
#endregion
|
||||
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Reactive.Disposables;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Dapplo.CaliburnMicro.Extensions;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.ViewModels;
|
||||
|
||||
namespace Greenshot.Addon.Dropbox.ViewModels
|
||||
{
|
||||
[Export(typeof(IConfigScreen))]
|
||||
public sealed class DropboxConfigViewModel : SimpleConfigScreen
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -39,15 +36,23 @@ namespace Greenshot.Addon.Dropbox.ViewModels
|
|||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
[Import]
|
||||
public IDropboxConfiguration DropboxConfiguration { get; set; }
|
||||
|
||||
[Import]
|
||||
public IDropboxLanguage DropboxLanguage { get; set; }
|
||||
|
||||
[Import]
|
||||
public FileConfigPartViewModel FileConfigPartViewModel { get; private set; }
|
||||
|
||||
public DropboxConfigViewModel(
|
||||
IDropboxConfiguration dropboxConfiguration,
|
||||
IDropboxLanguage dropboxLanguage,
|
||||
FileConfigPartViewModel fileConfigPartViewModel
|
||||
)
|
||||
{
|
||||
DropboxConfiguration = dropboxConfiguration;
|
||||
DropboxLanguage = dropboxLanguage;
|
||||
FileConfigPartViewModel = fileConfigPartViewModel;
|
||||
}
|
||||
|
||||
public override void Initialize(IConfig config)
|
||||
{
|
||||
FileConfigPartViewModel.DestinationFileConfiguration = DropboxConfiguration;
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.3.0" newVersion="2.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.8.1.0" newVersion="4.8.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,22 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="4.8.1" targetFramework="net452" />
|
||||
<package id="Autofac.Extras.AttributeMetadata" version="4.0.1" targetFramework="net452" />
|
||||
<package id="Autofac.Mef" version="4.0.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net452" />
|
||||
<package id="CommonServiceLocator" version="2.0.3" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions.JsonNet" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions.OAuth" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Log" version="1.2.1" targetFramework="net452" />
|
||||
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows" version="0.5.56" targetFramework="net452" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#region Greenshot GNU General Public License
|
||||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
|
||||
|
@ -21,36 +21,31 @@
|
|||
|
||||
#endregion
|
||||
|
||||
#region Usings
|
||||
using Autofac;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Greenshot.Addon.ExternalCommand.ViewModels;
|
||||
using Greenshot.Addons.Components;
|
||||
|
||||
using System.Windows.Forms;
|
||||
using Dapplo.Windows.Dpi;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Greenshot.Addons.Interfaces.Plugin
|
||||
namespace Greenshot.Addon.ExternalCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// This interface is the GreenshotPluginHost, that which "Hosts" the plugin.
|
||||
/// For Greenshot this is implmented in the PluginHelper
|
||||
/// </summary>
|
||||
public interface IGreenshotHost
|
||||
{
|
||||
ContextMenuStrip MainMenu { get; }
|
||||
/// <inheritdoc />
|
||||
public class ExternalCommandAddonModule : AddonModule
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder
|
||||
.RegisterType<ExternalCommandDestinationProvider>()
|
||||
.As<IStartup>()
|
||||
.As<IDestinationProvider>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<ExternalCommandConfigViewModel>()
|
||||
.As<IConfigScreen>()
|
||||
.SingleInstance();
|
||||
|
||||
// This is a reference to the MainForm, can be used for Invoking on the UI thread.
|
||||
Form GreenshotForm { get; }
|
||||
base.Load(builder);
|
||||
}
|
||||
|
||||
NotifyIcon NotifyIcon { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The DPI handler for the context menu, which should be used for the plugins too
|
||||
/// </summary>
|
||||
DpiHandler ContextMenuDpiHandler { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the form
|
||||
/// </summary>
|
||||
void Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,7 +32,8 @@ using System.Text.RegularExpressions;
|
|||
using System.Threading;
|
||||
using Dapplo.Ini;
|
||||
using Dapplo.Log;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
using Greenshot.Addons.Interfaces.Plugin;
|
||||
|
@ -41,10 +42,10 @@ using Greenshot.Addons.Interfaces.Plugin;
|
|||
|
||||
namespace Greenshot.Addon.ExternalCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Description of OCRDestination.
|
||||
/// </summary>
|
||||
public class ExternalCommandDestination : AbstractDestination
|
||||
/// <summary>
|
||||
/// ExternalCommandDestination provides a destination to export to an external command
|
||||
/// </summary>
|
||||
public class ExternalCommandDestination : AbstractDestination
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
|
||||
|
@ -54,8 +55,11 @@ namespace Greenshot.Addon.ExternalCommand
|
|||
private static readonly IExternalCommandConfiguration Config = IniConfig.Current.Get<IExternalCommandConfiguration>();
|
||||
private readonly string _presetCommand;
|
||||
|
||||
public ExternalCommandDestination(string commando)
|
||||
{
|
||||
public ExternalCommandDestination(string commando,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_presetCommand = commando;
|
||||
}
|
||||
|
||||
|
@ -79,41 +83,43 @@ namespace Greenshot.Addon.ExternalCommand
|
|||
var outputSettings = new SurfaceOutputSettings();
|
||||
outputSettings.PreventGreenshotFormat();
|
||||
|
||||
if (_presetCommand != null)
|
||||
{
|
||||
if (!Config.RunInbackground.ContainsKey(_presetCommand))
|
||||
{
|
||||
Config.RunInbackground.Add(_presetCommand, true);
|
||||
}
|
||||
var runInBackground = Config.RunInbackground[_presetCommand];
|
||||
var fullPath = captureDetails.Filename;
|
||||
if (fullPath == null)
|
||||
{
|
||||
fullPath = ImageOutput.SaveNamedTmpFile(surface, captureDetails, outputSettings);
|
||||
}
|
||||
if (_presetCommand == null)
|
||||
{
|
||||
return exportInformation;
|
||||
}
|
||||
|
||||
if (runInBackground)
|
||||
{
|
||||
var commandThread = new Thread(() =>
|
||||
{
|
||||
CallExternalCommand(exportInformation, fullPath, out _, out _);
|
||||
ProcessExport(exportInformation, surface);
|
||||
})
|
||||
{
|
||||
Name = "Running " + _presetCommand,
|
||||
IsBackground = true
|
||||
};
|
||||
commandThread.SetApartmentState(ApartmentState.STA);
|
||||
commandThread.Start();
|
||||
exportInformation.ExportMade = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CallExternalCommand(exportInformation, fullPath, out _, out _);
|
||||
ProcessExport(exportInformation, surface);
|
||||
}
|
||||
}
|
||||
return exportInformation;
|
||||
if (!Config.RunInbackground.ContainsKey(_presetCommand))
|
||||
{
|
||||
Config.RunInbackground.Add(_presetCommand, true);
|
||||
}
|
||||
var runInBackground = Config.RunInbackground[_presetCommand];
|
||||
var fullPath = captureDetails.Filename;
|
||||
if (fullPath == null)
|
||||
{
|
||||
fullPath = ImageOutput.SaveNamedTmpFile(surface, captureDetails, outputSettings);
|
||||
}
|
||||
|
||||
if (runInBackground)
|
||||
{
|
||||
var commandThread = new Thread(() =>
|
||||
{
|
||||
CallExternalCommand(exportInformation, fullPath, out _, out _);
|
||||
ProcessExport(exportInformation, surface);
|
||||
})
|
||||
{
|
||||
Name = "Running " + _presetCommand,
|
||||
IsBackground = true
|
||||
};
|
||||
commandThread.SetApartmentState(ApartmentState.STA);
|
||||
commandThread.Start();
|
||||
exportInformation.ExportMade = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CallExternalCommand(exportInformation, fullPath, out _, out _);
|
||||
ProcessExport(exportInformation, surface);
|
||||
}
|
||||
return exportInformation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -133,24 +139,29 @@ namespace Greenshot.Addon.ExternalCommand
|
|||
if (CallExternalCommand(_presetCommand, fullPath, out output, out error) == 0)
|
||||
{
|
||||
exportInformation.ExportMade = true;
|
||||
if (!string.IsNullOrEmpty(output))
|
||||
{
|
||||
var uriMatches = UriRegexp.Matches(output);
|
||||
// Place output on the clipboard before the URI, so if one is found this overwrites
|
||||
if (Config.OutputToClipboard)
|
||||
{
|
||||
ClipboardHelper.SetClipboardData(output);
|
||||
}
|
||||
if (uriMatches.Count > 0)
|
||||
{
|
||||
exportInformation.Uri = uriMatches[0].Groups[1].Value;
|
||||
Log.Info().WriteLine("Got URI : {0} ", exportInformation.Uri);
|
||||
if (Config.UriToClipboard)
|
||||
{
|
||||
ClipboardHelper.SetClipboardData(exportInformation.Uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(output))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var uriMatches = UriRegexp.Matches(output);
|
||||
// Place output on the clipboard before the URI, so if one is found this overwrites
|
||||
if (Config.OutputToClipboard)
|
||||
{
|
||||
ClipboardHelper.SetClipboardData(output);
|
||||
}
|
||||
|
||||
if (uriMatches.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
exportInformation.Uri = uriMatches[0].Groups[1].Value;
|
||||
Log.Info().WriteLine("Got URI : {0} ", exportInformation.Uri);
|
||||
if (Config.UriToClipboard)
|
||||
{
|
||||
ClipboardHelper.SetClipboardData(exportInformation.Uri);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -217,56 +228,57 @@ namespace Greenshot.Addon.ExternalCommand
|
|||
var arguments = Config.Argument[commando];
|
||||
output = null;
|
||||
error = null;
|
||||
if (!string.IsNullOrEmpty(commandline))
|
||||
{
|
||||
using (var process = new Process())
|
||||
{
|
||||
// Fix variables
|
||||
commandline = FilenameHelper.FillVariables(commandline, true);
|
||||
commandline = FilenameHelper.FillCmdVariables(commandline);
|
||||
if (string.IsNullOrEmpty(commandline))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
arguments = FilenameHelper.FillVariables(arguments, false);
|
||||
arguments = FilenameHelper.FillCmdVariables(arguments, false);
|
||||
using (var process = new Process())
|
||||
{
|
||||
// Fix variables
|
||||
commandline = FilenameHelper.FillVariables(commandline, true);
|
||||
commandline = FilenameHelper.FillCmdVariables(commandline);
|
||||
|
||||
process.StartInfo.FileName = FilenameHelper.FillCmdVariables(commandline);
|
||||
process.StartInfo.Arguments = FormatArguments(arguments, fullPath);
|
||||
process.StartInfo.UseShellExecute = false;
|
||||
if (Config.RedirectStandardOutput)
|
||||
{
|
||||
process.StartInfo.RedirectStandardOutput = true;
|
||||
}
|
||||
if (Config.RedirectStandardError)
|
||||
{
|
||||
process.StartInfo.RedirectStandardError = true;
|
||||
}
|
||||
if (verb != null)
|
||||
{
|
||||
process.StartInfo.Verb = verb;
|
||||
}
|
||||
Log.Info().WriteLine("Starting : {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||
process.Start();
|
||||
process.WaitForExit();
|
||||
if (Config.RedirectStandardOutput)
|
||||
{
|
||||
output = process.StandardOutput.ReadToEnd();
|
||||
if (Config.ShowStandardOutputInLog && output.Trim().Length > 0)
|
||||
{
|
||||
Log.Info().WriteLine("Output:\n{0}", output);
|
||||
}
|
||||
}
|
||||
if (Config.RedirectStandardError)
|
||||
{
|
||||
error = process.StandardError.ReadToEnd();
|
||||
if (error.Trim().Length > 0)
|
||||
{
|
||||
Log.Warn().WriteLine("Error:\n{0}", error);
|
||||
}
|
||||
}
|
||||
Log.Info().WriteLine("Finished : {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||
return process.ExitCode;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
arguments = FilenameHelper.FillVariables(arguments, false);
|
||||
arguments = FilenameHelper.FillCmdVariables(arguments, false);
|
||||
|
||||
process.StartInfo.FileName = FilenameHelper.FillCmdVariables(commandline);
|
||||
process.StartInfo.Arguments = FormatArguments(arguments, fullPath);
|
||||
process.StartInfo.UseShellExecute = false;
|
||||
if (Config.RedirectStandardOutput)
|
||||
{
|
||||
process.StartInfo.RedirectStandardOutput = true;
|
||||
}
|
||||
if (Config.RedirectStandardError)
|
||||
{
|
||||
process.StartInfo.RedirectStandardError = true;
|
||||
}
|
||||
if (verb != null)
|
||||
{
|
||||
process.StartInfo.Verb = verb;
|
||||
}
|
||||
Log.Info().WriteLine("Starting : {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||
process.Start();
|
||||
process.WaitForExit();
|
||||
if (Config.RedirectStandardOutput)
|
||||
{
|
||||
output = process.StandardOutput.ReadToEnd();
|
||||
if (Config.ShowStandardOutputInLog && output.Trim().Length > 0)
|
||||
{
|
||||
Log.Info().WriteLine("Output:\n{0}", output);
|
||||
}
|
||||
}
|
||||
if (Config.RedirectStandardError)
|
||||
{
|
||||
error = process.StandardError.ReadToEnd();
|
||||
if (error.Trim().Length > 0)
|
||||
{
|
||||
Log.Warn().WriteLine("Error:\n{0}", error);
|
||||
}
|
||||
}
|
||||
Log.Info().WriteLine("Finished : {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||
return process.ExitCode;
|
||||
}
|
||||
}
|
||||
|
||||
public static string FormatArguments(string arguments, string fullpath)
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
#region Usings
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.Log;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Core;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Greenshot.Addon.ExternalCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Generate the external command destinations
|
||||
/// </summary>
|
||||
public sealed class ExternalCommandDestinationProvider : IStartup, IDestinationProvider
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
private readonly IExternalCommandConfiguration _externalCommandConfig;
|
||||
private readonly ICoreConfiguration _coreConfiguration;
|
||||
private readonly IGreenshotLanguage _greenshotLanguage;
|
||||
|
||||
public ExternalCommandDestinationProvider(
|
||||
IExternalCommandConfiguration externalCommandConfiguration,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage)
|
||||
{
|
||||
_externalCommandConfig = externalCommandConfiguration;
|
||||
_coreConfiguration = coreConfiguration;
|
||||
_greenshotLanguage = greenshotLanguage;
|
||||
|
||||
externalCommandConfiguration.AfterLoad();
|
||||
}
|
||||
|
||||
public IEnumerable<Lazy<IDestination, DestinationAttribute>> Provide()
|
||||
{
|
||||
return _externalCommandConfig.Commands
|
||||
.Select(command => new Lazy<IDestination, DestinationAttribute>(() => new ExternalCommandDestination(command, _coreConfiguration, _greenshotLanguage), new DestinationAttribute(command)));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Check and eventually fix the command settings
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns>false if the command is not correctly configured</returns>
|
||||
private bool IsCommandValid(string command)
|
||||
{
|
||||
if (!_externalCommandConfig.RunInbackground.ContainsKey(command))
|
||||
{
|
||||
Log.Warn().WriteLine("Found missing runInbackground for {0}", command);
|
||||
// Fix it
|
||||
_externalCommandConfig.RunInbackground.Add(command, true);
|
||||
}
|
||||
if (!_externalCommandConfig.Argument.ContainsKey(command))
|
||||
{
|
||||
Log.Warn().WriteLine("Found missing argument for {0}", command);
|
||||
// Fix it
|
||||
_externalCommandConfig.Argument.Add(command, "{0}");
|
||||
}
|
||||
if (!_externalCommandConfig.Commandline.ContainsKey(command))
|
||||
{
|
||||
Log.Warn().WriteLine("Found missing commandline for {0}", command);
|
||||
return false;
|
||||
}
|
||||
var commandline = FilenameHelper.FillVariables(_externalCommandConfig.Commandline[command], true);
|
||||
commandline = FilenameHelper.FillCmdVariables(commandline, true);
|
||||
|
||||
if (File.Exists(commandline))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Log.Warn().WriteLine("Found 'invalid' commandline {0} for command {1}", _externalCommandConfig.Commandline[command], command);
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
// Check configuration & cleanup
|
||||
foreach (var command in _externalCommandConfig.Commands.Where(command => !IsCommandValid(command)).ToList())
|
||||
{
|
||||
_externalCommandConfig.Delete(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,185 +0,0 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
#region Usings
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Dapplo.Log;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
using Greenshot.Addons.Interfaces.Plugin;
|
||||
using Greenshot.Gfx;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Greenshot.Addon.ExternalCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// An Plugin to run commands after an image was written
|
||||
/// </summary>
|
||||
[Export(typeof(IGreenshotPlugin))]
|
||||
public sealed class ExternalCommandPlugin : IGreenshotPlugin
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
private readonly IExternalCommandConfiguration _externalCommandConfig;
|
||||
private readonly IGreenshotHost _greenshotHost;
|
||||
private ToolStripMenuItem _itemPlugInRoot;
|
||||
|
||||
[ImportingConstructor]
|
||||
public ExternalCommandPlugin(IGreenshotHost greenshotGreenshotHost, IExternalCommandConfiguration externalCommandConfiguration)
|
||||
{
|
||||
_greenshotHost = greenshotGreenshotHost;
|
||||
_externalCommandConfig = externalCommandConfiguration;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
public IEnumerable<IDestination> Destinations()
|
||||
{
|
||||
return _externalCommandConfig.Commands.Select(command => new ExternalCommandDestination(command));
|
||||
}
|
||||
|
||||
public IEnumerable<IProcessor> Processors()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of the IGreenshotPlugin.Initialize
|
||||
/// </summary>
|
||||
public bool Initialize()
|
||||
{
|
||||
Log.Debug().WriteLine("Initialize called");
|
||||
|
||||
// Check configuration & cleanup
|
||||
foreach (var command in _externalCommandConfig.Commands.Where(command => !IsCommandValid(command)).ToList())
|
||||
{
|
||||
_externalCommandConfig.Delete(command);
|
||||
}
|
||||
|
||||
_itemPlugInRoot = new ToolStripMenuItem {Tag = _greenshotHost};
|
||||
_greenshotHost.ContextMenuDpiHandler.OnDpiChanged.Subscribe(OnIconSizeChanged);
|
||||
OnLanguageChanged(this, null);
|
||||
|
||||
PluginUtils.AddToContextMenu(_greenshotHost, _itemPlugInRoot);
|
||||
Language.LanguageChanged += OnLanguageChanged;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
Log.Debug().WriteLine("Shutdown");
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (_itemPlugInRoot != null)
|
||||
{
|
||||
_itemPlugInRoot.Dispose();
|
||||
_itemPlugInRoot = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check and eventually fix the command settings
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns>false if the command is not correctly configured</returns>
|
||||
private bool IsCommandValid(string command)
|
||||
{
|
||||
if (!_externalCommandConfig.RunInbackground.ContainsKey(command))
|
||||
{
|
||||
Log.Warn().WriteLine("Found missing runInbackground for {0}", command);
|
||||
// Fix it
|
||||
_externalCommandConfig.RunInbackground.Add(command, true);
|
||||
}
|
||||
if (!_externalCommandConfig.Argument.ContainsKey(command))
|
||||
{
|
||||
Log.Warn().WriteLine("Found missing argument for {0}", command);
|
||||
// Fix it
|
||||
_externalCommandConfig.Argument.Add(command, "{0}");
|
||||
}
|
||||
if (!_externalCommandConfig.Commandline.ContainsKey(command))
|
||||
{
|
||||
Log.Warn().WriteLine("Found missing commandline for {0}", command);
|
||||
return false;
|
||||
}
|
||||
var commandline = FilenameHelper.FillVariables(_externalCommandConfig.Commandline[command], true);
|
||||
commandline = FilenameHelper.FillCmdVariables(commandline, true);
|
||||
|
||||
if (File.Exists(commandline))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Log.Warn().WriteLine("Found 'invalid' commandline {0} for command {1}", _externalCommandConfig.Commandline[command], command);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fix icon reference
|
||||
/// </summary>
|
||||
/// <param name="dpi">double with DPI</param>
|
||||
private void OnIconSizeChanged(double dpi)
|
||||
{
|
||||
try
|
||||
{
|
||||
var exePath = PluginUtils.GetExePath("cmd.exe");
|
||||
if (exePath == null || !File.Exists(exePath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (true.Equals(_itemPlugInRoot.Tag))
|
||||
{
|
||||
_itemPlugInRoot.Image?.Dispose();
|
||||
}
|
||||
var exeIcon = PluginUtils.GetCachedExeIcon(exePath, 0, dpi > 100);
|
||||
_itemPlugInRoot.Image = exeIcon.ScaleIconForDisplaying(dpi);
|
||||
_itemPlugInRoot.Tag = !Equals(exeIcon, _itemPlugInRoot.Image);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warn().WriteLine(ex, "Couldn't get the cmd.exe image");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLanguageChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_itemPlugInRoot != null)
|
||||
{
|
||||
_itemPlugInRoot.Text = Language.GetString("externalcommand", "contextmenu_configure");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,6 +37,15 @@
|
|||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Extras.AttributeMetadata, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Extras.AttributeMetadata.4.0.1\lib\net45\Autofac.Extras.AttributeMetadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Mef, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Mef.4.0.0\lib\net45\Autofac.Integration.Mef.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -49,38 +58,38 @@
|
|||
<Reference Include="CommonServiceLocator, Version=2.0.3.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommonServiceLocator.2.0.3\lib\net45\CommonServiceLocator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.0.5.56\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.1.0.44\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.0.5.56\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.1.0.44\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.0.5.28\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.1.0.42\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.0.5.28\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.1.0.42\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.0.5.28\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.1.0.42\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.0.5.28\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.1.0.42\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.0.5.28\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.1.0.42\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.0.5.28\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.42\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.24\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.InterfaceImpl, Version=0.2.12.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.InterfaceImpl.0.2.12\lib\net45\Dapplo.InterfaceImpl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.24\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.28\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Log, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Log.1.2.1\lib\net45\Dapplo.Log.dll</HintPath>
|
||||
|
@ -151,9 +160,10 @@
|
|||
<Compile Include="ExternalCommandForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ExternalCommandPlugin.cs" />
|
||||
<Compile Include="ExternalCommandDestinationProvider.cs" />
|
||||
<Compile Include="IExternalCommandLanguage.cs" />
|
||||
<Compile Include="IconCache.cs" />
|
||||
<Compile Include="ExternalCommandAddonModule.cs" />
|
||||
<Compile Include="ListviewComparer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="IExternalCommandConfiguration.cs" />
|
||||
|
@ -211,7 +221,7 @@
|
|||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"</PostBuildEvent>
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace Greenshot.Addon.ExternalCommand
|
|||
}
|
||||
else
|
||||
{
|
||||
textBox_arguments.Text = "\"{0}\"";
|
||||
textBox_arguments.Text = @"""{0}""";
|
||||
}
|
||||
OkButtonState();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#endregion
|
||||
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Reactive.Disposables;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Dapplo.CaliburnMicro.Extensions;
|
||||
|
@ -30,7 +29,6 @@ using Greenshot.Addons.Core;
|
|||
|
||||
namespace Greenshot.Addon.ExternalCommand.ViewModels
|
||||
{
|
||||
[Export(typeof(IConfigScreen))]
|
||||
public sealed class ExternalCommandConfigViewModel : SimpleConfigScreen
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -38,14 +36,21 @@ namespace Greenshot.Addon.ExternalCommand.ViewModels
|
|||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
[Import]
|
||||
public IExternalCommandConfiguration ExternalCommandConfiguration { get; set; }
|
||||
public IExternalCommandConfiguration ExternalCommandConfiguration { get; }
|
||||
|
||||
[Import]
|
||||
public IExternalCommandLanguage ExternalCommandLanguage { get; set; }
|
||||
public IExternalCommandLanguage ExternalCommandLanguage { get; }
|
||||
|
||||
[Import]
|
||||
public IGreenshotLanguage GreenshotLanguage { get; set; }
|
||||
public IGreenshotLanguage GreenshotLanguage { get; }
|
||||
|
||||
public ExternalCommandConfigViewModel(
|
||||
IExternalCommandConfiguration externalCommandConfiguration,
|
||||
IExternalCommandLanguage externalCommandLanguage,
|
||||
IGreenshotLanguage greenshotLanguage)
|
||||
{
|
||||
ExternalCommandConfiguration = externalCommandConfiguration;
|
||||
ExternalCommandLanguage = externalCommandLanguage;
|
||||
GreenshotLanguage = greenshotLanguage;
|
||||
}
|
||||
|
||||
public override void Initialize(IConfig config)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.3.0" newVersion="2.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.8.1.0" newVersion="4.8.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,19 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="4.8.1" targetFramework="net452" />
|
||||
<package id="Autofac.Extras.AttributeMetadata" version="4.0.1" targetFramework="net452" />
|
||||
<package id="Autofac.Mef" version="4.0.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net452" />
|
||||
<package id="CommonServiceLocator" version="2.0.3" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Log" version="1.2.1" targetFramework="net452" />
|
||||
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows" version="0.5.56" targetFramework="net452" />
|
||||
|
|
49
src/Greenshot.Addon.Flickr/FlickrAddonModule.cs
Normal file
49
src/Greenshot.Addon.Flickr/FlickrAddonModule.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using Autofac;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Greenshot.Addon.Flickr.ViewModels;
|
||||
using Greenshot.Addons.Components;
|
||||
|
||||
namespace Greenshot.Addon.Flickr
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class FlickrAddonModule : AddonModule
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder
|
||||
.RegisterType<FlickrDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<FlickrConfigViewModel>()
|
||||
.As<IConfigScreen>()
|
||||
.SingleInstance();
|
||||
|
||||
base.Load(builder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -35,19 +34,18 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using Dapplo.Addons.Bootstrapper.Resolving;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.HttpExtensions;
|
||||
using Dapplo.HttpExtensions.Extensions;
|
||||
using Dapplo.HttpExtensions.Listener;
|
||||
using Dapplo.HttpExtensions.OAuth;
|
||||
using Dapplo.Log;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Controls;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Extensions;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
using Greenshot.Addons.Interfaces.Plugin;
|
||||
using Greenshot.Gfx;
|
||||
|
||||
#endregion
|
||||
|
@ -61,6 +59,7 @@ namespace Greenshot.Addon.Flickr
|
|||
private static readonly Uri FlickrOAuthUri = new Uri("https://api.flickr.com/services/oauth");
|
||||
private readonly IFlickrConfiguration _flickrConfiguration;
|
||||
private readonly IFlickrLanguage _flickrLanguage;
|
||||
private readonly IResourceProvider _resourceProvider;
|
||||
private readonly OAuth1Settings _oAuthSettings;
|
||||
private readonly OAuth1HttpBehaviour _oAuthHttpBehaviour;
|
||||
private const string FlickrFarmUrl = "https://farm{0}.staticflickr.com/{1}/{2}_{3}.jpg";
|
||||
|
@ -75,14 +74,20 @@ namespace Greenshot.Addon.Flickr
|
|||
}
|
||||
});
|
||||
|
||||
[ImportingConstructor]
|
||||
public FlickrDestination(IFlickrConfiguration flickrConfiguration,
|
||||
IFlickrLanguage flickrLanguage, INetworkConfiguration networkConfiguration)
|
||||
{
|
||||
public FlickrDestination(
|
||||
IFlickrConfiguration flickrConfiguration,
|
||||
IFlickrLanguage flickrLanguage,
|
||||
INetworkConfiguration networkConfiguration,
|
||||
IResourceProvider resourceProvider,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_flickrConfiguration = flickrConfiguration;
|
||||
_flickrLanguage = flickrLanguage;
|
||||
_resourceProvider = resourceProvider;
|
||||
|
||||
_oAuthSettings = new OAuth1Settings
|
||||
_oAuthSettings = new OAuth1Settings
|
||||
{
|
||||
Token = flickrConfiguration,
|
||||
ClientId = flickrConfiguration.ClientId,
|
||||
|
@ -116,9 +121,8 @@ namespace Greenshot.Addon.Flickr
|
|||
{
|
||||
get
|
||||
{
|
||||
// TODO: Optimize this
|
||||
var embeddedResource = GetType().Assembly.FindEmbeddedResources(@".*flickr\.png").FirstOrDefault();
|
||||
using (var bitmapStream = GetType().Assembly.GetEmbeddedResourceAsStream(embeddedResource))
|
||||
// TODO: Optimize this by caching
|
||||
using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "flickr.png"))
|
||||
{
|
||||
return BitmapHelper.FromStream(bitmapStream);
|
||||
}
|
||||
|
@ -174,7 +178,7 @@ namespace Greenshot.Addon.Flickr
|
|||
catch (Exception e)
|
||||
{
|
||||
Log.Error().WriteLine(e, "Error uploading.");
|
||||
MessageBox.Show(_flickrLanguage.UploadFailure + " " + e.Message);
|
||||
MessageBox.Show(_flickrLanguage.UploadFailure + @" " + e.Message);
|
||||
}
|
||||
return uploadUrl;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,15 @@
|
|||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Extras.AttributeMetadata, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Extras.AttributeMetadata.4.0.1\lib\net45\Autofac.Extras.AttributeMetadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Mef, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Mef.4.0.0\lib\net45\Autofac.Integration.Mef.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -49,29 +58,29 @@
|
|||
<Reference Include="CommonServiceLocator, Version=2.0.3.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommonServiceLocator.2.0.3\lib\net45\CommonServiceLocator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.0.5.56\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.1.0.44\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.0.5.56\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.1.0.44\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.0.5.28\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.1.0.42\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.0.5.28\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.1.0.42\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.0.5.28\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.1.0.42\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.0.5.28\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.1.0.42\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.0.5.28\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.1.0.42\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.0.5.28\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.42\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.HttpExtensions, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.0.8.35\lib\net45\Dapplo.HttpExtensions.dll</HintPath>
|
||||
|
@ -79,14 +88,14 @@
|
|||
<Reference Include="Dapplo.HttpExtensions.OAuth, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.OAuth.0.8.35\lib\net45\Dapplo.HttpExtensions.OAuth.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.24\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.InterfaceImpl, Version=0.2.12.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.InterfaceImpl.0.2.12\lib\net45\Dapplo.InterfaceImpl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.24\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.28\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Log, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Log.1.2.1\lib\net45\Dapplo.Log.dll</HintPath>
|
||||
|
@ -156,6 +165,7 @@
|
|||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FlickrAddonModule.cs" />
|
||||
<Compile Include="FlickrDestination.cs" />
|
||||
<Compile Include="IFlickrConfiguration.cs" />
|
||||
<Compile Include="IFlickrLanguage.cs" />
|
||||
|
@ -208,7 +218,7 @@
|
|||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"</PostBuildEvent>
|
||||
|
|
|
@ -29,7 +29,6 @@ using Dapplo.HttpExtensions.OAuth;
|
|||
using Dapplo.Ini;
|
||||
using Dapplo.InterfaceImpl.Extensions;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Core.Enums;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Reactive.Disposables;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Dapplo.CaliburnMicro.Extensions;
|
||||
|
@ -32,7 +31,6 @@ using Greenshot.Addons.ViewModels;
|
|||
|
||||
namespace Greenshot.Addon.Flickr.ViewModels
|
||||
{
|
||||
[Export(typeof(IConfigScreen))]
|
||||
public sealed class FlickrConfigViewModel : SimpleConfigScreen
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -40,14 +38,21 @@ namespace Greenshot.Addon.Flickr.ViewModels
|
|||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
[Import]
|
||||
public IFlickrConfiguration FlickrConfiguration { get; set; }
|
||||
public IFlickrConfiguration FlickrConfiguration { get; }
|
||||
|
||||
public IFlickrLanguage FlickrLanguage { get; }
|
||||
|
||||
public FileConfigPartViewModel FileConfigPartViewModel { get; }
|
||||
|
||||
[Import]
|
||||
public IFlickrLanguage FlickrLanguage { get; set; }
|
||||
|
||||
[Import]
|
||||
public FileConfigPartViewModel FileConfigPartViewModel { get; private set; }
|
||||
public FlickrConfigViewModel(
|
||||
IFlickrConfiguration flickrConfiguration,
|
||||
IFlickrLanguage flickrLanguage,
|
||||
FileConfigPartViewModel fileConfigPartViewModel)
|
||||
{
|
||||
FlickrConfiguration = flickrConfiguration;
|
||||
FlickrLanguage = flickrLanguage;
|
||||
FileConfigPartViewModel = fileConfigPartViewModel;
|
||||
}
|
||||
|
||||
public override void Initialize(IConfig config)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.3.0" newVersion="2.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.8.1.0" newVersion="4.8.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,21 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="4.8.1" targetFramework="net452" />
|
||||
<package id="Autofac.Extras.AttributeMetadata" version="4.0.1" targetFramework="net452" />
|
||||
<package id="Autofac.Mef" version="4.0.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net452" />
|
||||
<package id="CommonServiceLocator" version="2.0.3" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions.OAuth" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Log" version="1.2.1" targetFramework="net452" />
|
||||
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows" version="0.5.56" targetFramework="net452" />
|
||||
|
|
49
src/Greenshot.Addon.GooglePhotos/GooglePhotosAddonModule.cs
Normal file
49
src/Greenshot.Addon.GooglePhotos/GooglePhotosAddonModule.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using Autofac;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Greenshot.Addon.GooglePhotos.ViewModels;
|
||||
using Greenshot.Addons.Components;
|
||||
|
||||
namespace Greenshot.Addon.GooglePhotos
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class GooglePhotosAddonModule : AddonModule
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder
|
||||
.RegisterType<GooglePhotosDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<GooglePhotosConfigViewModel>()
|
||||
.As<IConfigScreen>()
|
||||
.SingleInstance();
|
||||
|
||||
base.Load(builder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,21 +25,20 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using Dapplo.Addons.Bootstrapper.Resolving;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.HttpExtensions;
|
||||
using Dapplo.HttpExtensions.OAuth;
|
||||
using Dapplo.Log;
|
||||
using Dapplo.Utils;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Controls;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Extensions;
|
||||
|
@ -57,17 +56,22 @@ namespace Greenshot.Addon.GooglePhotos
|
|||
private readonly IGooglePhotosConfiguration _googlePhotosConfiguration;
|
||||
private readonly IGooglePhotosLanguage _googlePhotosLanguage;
|
||||
private readonly INetworkConfiguration _networkConfiguration;
|
||||
private readonly IResourceProvider _resourceProvider;
|
||||
private readonly OAuth2Settings _oAuth2Settings;
|
||||
|
||||
[ImportingConstructor]
|
||||
public GooglePhotosDestination(
|
||||
IGooglePhotosConfiguration googlePhotosConfiguration,
|
||||
IGooglePhotosLanguage googlePhotosLanguage,
|
||||
INetworkConfiguration networkConfiguration)
|
||||
{
|
||||
INetworkConfiguration networkConfiguration,
|
||||
IResourceProvider resourceProvider,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_googlePhotosConfiguration = googlePhotosConfiguration;
|
||||
_googlePhotosLanguage = googlePhotosLanguage;
|
||||
_networkConfiguration = networkConfiguration;
|
||||
_resourceProvider = resourceProvider;
|
||||
|
||||
_oAuth2Settings = new OAuth2Settings
|
||||
{
|
||||
|
@ -96,9 +100,8 @@ namespace Greenshot.Addon.GooglePhotos
|
|||
{
|
||||
get
|
||||
{
|
||||
// TODO: Optimize this
|
||||
var embeddedResource = GetType().Assembly.FindEmbeddedResources(@".*GooglePhotos\.png").FirstOrDefault();
|
||||
using (var bitmapStream = GetType().Assembly.GetEmbeddedResourceAsStream(embeddedResource))
|
||||
// TODO: Optimize this by caching
|
||||
using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "GooglePhotos.png"))
|
||||
{
|
||||
return BitmapHelper.FromStream(bitmapStream);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,15 @@
|
|||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Extras.AttributeMetadata, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Extras.AttributeMetadata.4.0.1\lib\net45\Autofac.Extras.AttributeMetadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Mef, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Mef.4.0.0\lib\net45\Autofac.Integration.Mef.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -35,29 +44,29 @@
|
|||
<Reference Include="CommonServiceLocator, Version=2.0.3.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommonServiceLocator.2.0.3\lib\net45\CommonServiceLocator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.0.5.56\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.1.0.44\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.0.5.56\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.1.0.44\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.0.5.28\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.1.0.42\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.0.5.28\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.1.0.42\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.0.5.28\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.1.0.42\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.0.5.28\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.1.0.42\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.0.5.28\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.1.0.42\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.0.5.28\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.42\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.HttpExtensions, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.0.8.35\lib\net45\Dapplo.HttpExtensions.dll</HintPath>
|
||||
|
@ -65,14 +74,14 @@
|
|||
<Reference Include="Dapplo.HttpExtensions.OAuth, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.OAuth.0.8.35\lib\net45\Dapplo.HttpExtensions.OAuth.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.24\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.InterfaceImpl, Version=0.2.12.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.InterfaceImpl.0.2.12\lib\net45\Dapplo.InterfaceImpl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.24\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.28\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Log, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Log.1.2.1\lib\net45\Dapplo.Log.dll</HintPath>
|
||||
|
@ -143,6 +152,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<Compile Include="GooglePhotosAddonModule.cs" />
|
||||
<Compile Include="IGooglePhotosLanguage.cs" />
|
||||
<Compile Include="IGooglePhotosConfiguration.cs" />
|
||||
<Compile Include="GooglePhotosDestination.cs" />
|
||||
|
@ -185,7 +195,7 @@
|
|||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"
|
||||
|
|
|
@ -27,7 +27,6 @@ using System.ComponentModel;
|
|||
using System.Runtime.Serialization;
|
||||
using Dapplo.HttpExtensions.OAuth;
|
||||
using Dapplo.Ini;
|
||||
using Greenshot.Addons.Core.Enums;
|
||||
using Dapplo.InterfaceImpl.Extensions;
|
||||
using Greenshot.Addons.Core;
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#endregion
|
||||
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Reactive.Disposables;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Dapplo.CaliburnMicro.Extensions;
|
||||
|
@ -30,7 +29,6 @@ using Greenshot.Addons.ViewModels;
|
|||
|
||||
namespace Greenshot.Addon.GooglePhotos.ViewModels
|
||||
{
|
||||
[Export(typeof(IConfigScreen))]
|
||||
public sealed class GooglePhotosConfigViewModel : SimpleConfigScreen
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -38,14 +36,19 @@ namespace Greenshot.Addon.GooglePhotos.ViewModels
|
|||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
[Import]
|
||||
public IGooglePhotosConfiguration GooglePhotosConfiguration { get; set; }
|
||||
public IGooglePhotosConfiguration GooglePhotosConfiguration { get; }
|
||||
public IGooglePhotosLanguage GooglePhotosLanguage { get; }
|
||||
public FileConfigPartViewModel FileConfigPartViewModel { get; }
|
||||
|
||||
[Import]
|
||||
public IGooglePhotosLanguage GooglePhotosLanguage { get; set; }
|
||||
|
||||
[Import]
|
||||
public FileConfigPartViewModel FileConfigPartViewModel { get; private set; }
|
||||
public GooglePhotosConfigViewModel(
|
||||
IGooglePhotosConfiguration googlePhotosConfiguration,
|
||||
IGooglePhotosLanguage googlePhotosLanguage,
|
||||
FileConfigPartViewModel fileConfigPartViewModel)
|
||||
{
|
||||
GooglePhotosConfiguration = googlePhotosConfiguration;
|
||||
GooglePhotosLanguage = googlePhotosLanguage;
|
||||
FileConfigPartViewModel = fileConfigPartViewModel;
|
||||
}
|
||||
|
||||
public override void Initialize(IConfig config)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.3.0" newVersion="2.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.8.1.0" newVersion="4.8.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,21 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="4.8.1" targetFramework="net452" />
|
||||
<package id="Autofac.Extras.AttributeMetadata" version="4.0.1" targetFramework="net452" />
|
||||
<package id="Autofac.Mef" version="4.0.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net452" />
|
||||
<package id="CommonServiceLocator" version="2.0.3" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions.OAuth" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Log" version="1.2.1" targetFramework="net452" />
|
||||
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows" version="0.5.56" targetFramework="net452" />
|
||||
|
|
|
@ -39,6 +39,15 @@
|
|||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Extras.AttributeMetadata, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Extras.AttributeMetadata.4.0.1\lib\net45\Autofac.Extras.AttributeMetadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Mef, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Mef.4.0.0\lib\net45\Autofac.Integration.Mef.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -54,29 +63,29 @@
|
|||
<Reference Include="ControlzEx, Version=3.0.2.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.0.5.56\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.1.0.44\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.0.5.56\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.1.0.44\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.0.5.28\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.1.0.42\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.0.5.28\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.1.0.42\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.0.5.28\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.1.0.42\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.0.5.28\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.1.0.42\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.0.5.28\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.1.0.42\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.0.5.28\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.42\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.HttpExtensions, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.0.8.35\lib\net45\Dapplo.HttpExtensions.dll</HintPath>
|
||||
|
@ -87,14 +96,14 @@
|
|||
<Reference Include="Dapplo.HttpExtensions.OAuth, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.OAuth.0.8.35\lib\net45\Dapplo.HttpExtensions.OAuth.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.24\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.InterfaceImpl, Version=0.2.12.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.InterfaceImpl.0.2.12\lib\net45\Dapplo.InterfaceImpl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.24\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.28\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Log, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Log.1.2.1\lib\net45\Dapplo.Log.dll</HintPath>
|
||||
|
@ -129,8 +138,8 @@
|
|||
<Reference Include="Dapplo.Windows.User32, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.User32.0.5.56\lib\net45\Dapplo.Windows.User32.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MahApps.Metro, Version=1.6.1.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MahApps.Metro.1.6.1\lib\net45\MahApps.Metro.dll</HintPath>
|
||||
<Reference Include="MahApps.Metro, Version=1.6.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MahApps.Metro.1.6.4\lib\net45\MahApps.Metro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
|
@ -172,6 +181,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="Entities\ImgurData.cs" />
|
||||
<Compile Include="Entities\ImgurImage.cs" />
|
||||
<Compile Include="ImgurAddonModule.cs" />
|
||||
<Compile Include="IImgurLanguage.cs" />
|
||||
<Compile Include="ImgurApi.cs" />
|
||||
<Compile Include="ImgurDestination.cs" />
|
||||
|
@ -221,7 +231,7 @@
|
|||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"</PostBuildEvent>
|
||||
|
|
|
@ -31,7 +31,6 @@ using Dapplo.Ini;
|
|||
using Dapplo.InterfaceImpl.Extensions;
|
||||
using Greenshot.Addon.Imgur.Entities;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Core.Enums;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
56
src/Greenshot.Addon.Imgur/ImgurAddonModule.cs
Normal file
56
src/Greenshot.Addon.Imgur/ImgurAddonModule.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using Autofac;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Greenshot.Addon.Imgur.ViewModels;
|
||||
using Greenshot.Addons.Components;
|
||||
|
||||
namespace Greenshot.Addon.Imgur
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class ImgurAddonModule : AddonModule
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder
|
||||
.RegisterType<ImgurDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<ImgurConfigViewModel>()
|
||||
.As<IConfigScreen>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<ImgurHistoryViewModel>()
|
||||
.AsSelf();
|
||||
builder
|
||||
.RegisterType<ImgurApi>()
|
||||
.AsSelf()
|
||||
.SingleInstance();
|
||||
|
||||
base.Load(builder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
|
@ -50,7 +49,6 @@ namespace Greenshot.Addon.Imgur
|
|||
/// <summary>
|
||||
/// This contains the Imgur Api which is used by the destination and the history viewmodel
|
||||
/// </summary>
|
||||
[Export]
|
||||
public class ImgurApi
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
|
@ -60,7 +58,6 @@ namespace Greenshot.Addon.Imgur
|
|||
|
||||
private HttpBehaviour Behaviour { get; }
|
||||
|
||||
[ImportingConstructor]
|
||||
public ImgurApi(
|
||||
IImgurConfiguration imgurConfiguration,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
|
|
|
@ -24,18 +24,17 @@
|
|||
#region Usings
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Dapplo.Addons.Bootstrapper.Resolving;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.Log;
|
||||
using Dapplo.Windows.Extensions;
|
||||
using Greenshot.Addon.Imgur.Entities;
|
||||
using Greenshot.Addon.Imgur.ViewModels;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Controls;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
|
@ -49,7 +48,6 @@ namespace Greenshot.Addon.Imgur
|
|||
/// Description of ImgurDestination.
|
||||
/// </summary>
|
||||
[Destination("Imgur")]
|
||||
[Export]
|
||||
public class ImgurDestination : AbstractDestination
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
|
@ -57,14 +55,22 @@ namespace Greenshot.Addon.Imgur
|
|||
private readonly IImgurLanguage _imgurLanguage;
|
||||
private readonly ImgurApi _imgurApi;
|
||||
private readonly ImgurHistoryViewModel _imgurHistoryViewModel;
|
||||
private readonly IResourceProvider _resourceProvider;
|
||||
|
||||
[ImportingConstructor]
|
||||
public ImgurDestination(IImgurConfiguration imgurConfiguration, IImgurLanguage imgurLanguage, ImgurApi imgurApi, ImgurHistoryViewModel imgurHistoryViewModel)
|
||||
public ImgurDestination(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
IImgurConfiguration imgurConfiguration,
|
||||
IImgurLanguage imgurLanguage,
|
||||
ImgurApi imgurApi,
|
||||
ImgurHistoryViewModel imgurHistoryViewModel,
|
||||
IResourceProvider resourceProvider) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_imgurConfiguration = imgurConfiguration;
|
||||
_imgurLanguage = imgurLanguage;
|
||||
_imgurApi = imgurApi;
|
||||
_imgurHistoryViewModel = imgurHistoryViewModel;
|
||||
_resourceProvider = resourceProvider;
|
||||
}
|
||||
|
||||
public override string Description => _imgurLanguage.UploadMenuItem;
|
||||
|
@ -73,9 +79,8 @@ namespace Greenshot.Addon.Imgur
|
|||
{
|
||||
get
|
||||
{
|
||||
// TODO: Optimize this
|
||||
var embeddedResource = GetType().Assembly.FindEmbeddedResources(@".*Imgur\.png").FirstOrDefault();
|
||||
using (var bitmapStream = GetType().Assembly.GetEmbeddedResourceAsStream(embeddedResource))
|
||||
// TODO: Optimize this, by caching
|
||||
using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "Imgur.png"))
|
||||
{
|
||||
return BitmapHelper.FromStream(bitmapStream);
|
||||
}
|
||||
|
|
|
@ -21,18 +21,20 @@
|
|||
|
||||
#endregion
|
||||
|
||||
using System.ComponentModel.Composition;
|
||||
using System;
|
||||
using System.Reactive.Disposables;
|
||||
using Autofac.Features.OwnedInstances;
|
||||
using Caliburn.Micro;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Dapplo.CaliburnMicro.Extensions;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.ViewModels;
|
||||
|
||||
namespace Greenshot.Addon.Imgur.ViewModels
|
||||
{
|
||||
[Export(typeof(IConfigScreen))]
|
||||
/// <summary>
|
||||
/// The imgure config VM
|
||||
/// </summary>
|
||||
public sealed class ImgurConfigViewModel : SimpleConfigScreen
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -40,21 +42,30 @@ namespace Greenshot.Addon.Imgur.ViewModels
|
|||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
[Import]
|
||||
public IImgurConfiguration ImgurConfiguration { get; set; }
|
||||
public IImgurConfiguration ImgurConfiguration { get; }
|
||||
|
||||
[Import]
|
||||
public IImgurLanguage ImgurLanguage { get; set; }
|
||||
public IImgurLanguage ImgurLanguage { get; }
|
||||
|
||||
[Import]
|
||||
public IWindowManager WindowManager { get; set; }
|
||||
public IWindowManager WindowManager { get; }
|
||||
|
||||
[Import]
|
||||
public ImgurHistoryViewModel ImgurHistoryViewModel { get; set; }
|
||||
public Func<Owned<ImgurHistoryViewModel>> ImgurHistoryViewModelFactory { get;}
|
||||
|
||||
[Import]
|
||||
public FileConfigPartViewModel FileConfigPartViewModel { get; private set; }
|
||||
public FileConfigPartViewModel FileConfigPartViewModel { get; }
|
||||
|
||||
public ImgurConfigViewModel(
|
||||
IImgurConfiguration imgurConfiguration,
|
||||
IImgurLanguage imgurLanguage ,
|
||||
IWindowManager windowManager,
|
||||
Func<Owned<ImgurHistoryViewModel>> imgurHistoryViewModelFactory,
|
||||
FileConfigPartViewModel fileConfigPartViewModel
|
||||
)
|
||||
{
|
||||
ImgurConfiguration = imgurConfiguration;
|
||||
ImgurLanguage = imgurLanguage;
|
||||
WindowManager = windowManager;
|
||||
ImgurHistoryViewModelFactory = imgurHistoryViewModelFactory;
|
||||
FileConfigPartViewModel = fileConfigPartViewModel;
|
||||
}
|
||||
public override void Initialize(IConfig config)
|
||||
{
|
||||
// Make sure the destination settings are shown
|
||||
|
@ -86,7 +97,10 @@ namespace Greenshot.Addon.Imgur.ViewModels
|
|||
|
||||
public void ShowHistory()
|
||||
{
|
||||
WindowManager.ShowWindow(ImgurHistoryViewModel);
|
||||
using (var imgurHistoryViewModel = ImgurHistoryViewModelFactory())
|
||||
{
|
||||
WindowManager.ShowDialog(imgurHistoryViewModel.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
|
@ -38,7 +37,6 @@ using Greenshot.Addons.Core;
|
|||
|
||||
namespace Greenshot.Addon.Imgur.ViewModels
|
||||
{
|
||||
[Export]
|
||||
public sealed class ImgurHistoryViewModel : Screen
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
|
@ -48,19 +46,26 @@ namespace Greenshot.Addon.Imgur.ViewModels
|
|||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
[Import]
|
||||
public IImgurConfiguration ImgurConfiguration { get; set; }
|
||||
public IImgurConfiguration ImgurConfiguration { get; }
|
||||
|
||||
public ImgurApi ImgurApi { get; }
|
||||
|
||||
[Import]
|
||||
public ImgurApi ImgurApi { get; set; }
|
||||
public IImgurLanguage ImgurLanguage { get; }
|
||||
|
||||
[Import]
|
||||
public IImgurLanguage ImgurLanguage { get; set; }
|
||||
|
||||
[Import]
|
||||
public IGreenshotLanguage GreenshotLanguage { get; set; }
|
||||
public IGreenshotLanguage GreenshotLanguage { get; }
|
||||
|
||||
public ImgurHistoryViewModel(
|
||||
IImgurConfiguration imgurConfiguration,
|
||||
ImgurApi imgurApi,
|
||||
IImgurLanguage imgurLanguage,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
)
|
||||
{
|
||||
ImgurConfiguration = imgurConfiguration;
|
||||
ImgurApi = imgurApi;
|
||||
ImgurLanguage = imgurLanguage;
|
||||
GreenshotLanguage = greenshotLanguage;
|
||||
}
|
||||
/// <summary>
|
||||
/// The list of imgur items
|
||||
/// </summary>
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.3.0" newVersion="2.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.8.1.0" newVersion="4.8.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,23 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="4.8.1" targetFramework="net452" />
|
||||
<package id="Autofac.Extras.AttributeMetadata" version="4.0.1" targetFramework="net452" />
|
||||
<package id="Autofac.Mef" version="4.0.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net452" />
|
||||
<package id="CommonServiceLocator" version="2.0.3" targetFramework="net452" />
|
||||
<package id="ControlzEx" version="3.0.2.4" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions.JsonNet" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions.OAuth" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Log" version="1.2.1" targetFramework="net452" />
|
||||
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows" version="0.5.56" targetFramework="net452" />
|
||||
|
@ -29,7 +32,7 @@
|
|||
<package id="Dapplo.Windows.Kernel32" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows.Messages" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows.User32" version="0.5.56" targetFramework="net452" />
|
||||
<package id="MahApps.Metro" version="1.6.1" targetFramework="net452" />
|
||||
<package id="MahApps.Metro" version="1.6.4" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net452" />
|
||||
<package id="System.Reactive.Core" version="3.1.1" targetFramework="net45" />
|
||||
<package id="System.Reactive.Interfaces" version="3.1.1" targetFramework="net45" />
|
||||
|
|
|
@ -39,6 +39,15 @@
|
|||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Extras.AttributeMetadata, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Extras.AttributeMetadata.4.0.1\lib\net45\Autofac.Extras.AttributeMetadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Mef, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Mef.4.0.0\lib\net45\Autofac.Integration.Mef.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -51,32 +60,32 @@
|
|||
<Reference Include="CommonServiceLocator, Version=2.0.3.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommonServiceLocator.2.0.3\lib\net45\CommonServiceLocator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Costura, Version=2.0.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Costura.Fody.2.0.0\lib\net452\Costura.dll</HintPath>
|
||||
<Reference Include="Costura, Version=2.0.1.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Costura.Fody.2.0.1\lib\net452\Costura.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.0.5.56\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.1.0.44\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.0.5.56\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.1.0.44\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.0.5.28\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.1.0.42\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.0.5.28\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.1.0.42\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.0.5.28\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.1.0.42\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.0.5.28\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.1.0.42\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.0.5.28\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.1.0.42\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.0.5.28\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.42\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.HttpExtensions, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.0.8.35\lib\net45\Dapplo.HttpExtensions.dll</HintPath>
|
||||
|
@ -87,8 +96,8 @@
|
|||
<Reference Include="Dapplo.HttpExtensions.OAuth, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.OAuth.0.8.35\lib\net45\Dapplo.HttpExtensions.OAuth.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.24\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.InterfaceImpl, Version=0.2.12.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.InterfaceImpl.0.2.12\lib\net45\Dapplo.InterfaceImpl.dll</HintPath>
|
||||
|
@ -96,8 +105,8 @@
|
|||
<Reference Include="Dapplo.Jira, Version=0.7.10.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Jira.0.7.10\lib\net45\Dapplo.Jira.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.24\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.28\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Log, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Log.1.2.1\lib\net45\Dapplo.Log.dll</HintPath>
|
||||
|
@ -177,6 +186,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="IJiraLanguage.cs" />
|
||||
<Compile Include="JiraAddonModule.cs" />
|
||||
<Compile Include="IssueTypeBitmapCache.cs" />
|
||||
<Compile Include="JiraConnector.cs" />
|
||||
<Compile Include="IJiraConfiguration.cs" />
|
||||
|
@ -185,7 +195,6 @@
|
|||
<Compile Include="JiraEventArgs.cs" />
|
||||
<Compile Include="JiraEventTypes.cs" />
|
||||
<Compile Include="JiraMonitor.cs" />
|
||||
<Compile Include="JiraPlugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ViewModels\JiraViewModel.cs" />
|
||||
<Compile Include="ViewModels\JiraConfigViewModel.cs" />
|
||||
|
@ -205,9 +214,6 @@
|
|||
</None>
|
||||
<None Include="Languages\language_jiraplugin-zh-CN.xml" />
|
||||
<None Include="packages.config" />
|
||||
<EmbeddedResource Include="JiraPlugin.resx">
|
||||
<DependentUpon>JiraPlugin.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Greenshot.Addons\Greenshot.Addons.csproj">
|
||||
|
@ -215,6 +221,10 @@
|
|||
<Name>Greenshot.Addons</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Greenshot.Gfx\Greenshot.Gfx.csproj">
|
||||
<Project>{f041c685-eb96-4ed1-9ace-0f5bd836610f}</Project>
|
||||
<Name>Greenshot.Gfx</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="FodyWeavers.xml" />
|
||||
|
@ -248,10 +258,9 @@
|
|||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
"$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
del /q /s "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"\*
|
||||
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
|
||||
if "$(ConfigurationName)" == "Debug" (
|
||||
copy "$(ProjectDir)bin\$(Configuration)\Dapplo.*" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
|
@ -294,9 +303,9 @@ copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuratio
|
|||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Costura.Fody.2.0.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.2.0.0\build\Costura.Fody.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Fody.3.0.3\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.3.0.3\build\Fody.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Costura.Fody.2.0.0\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.2.0.0\build\Costura.Fody.targets')" />
|
||||
<Import Project="..\packages\Fody.3.0.3\build\Fody.targets" Condition="Exists('..\packages\Fody.3.0.3\build\Fody.targets')" />
|
||||
<Import Project="..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets')" />
|
||||
</Project>
|
63
src/Greenshot.Addon.Jira/JiraAddonModule.cs
Normal file
63
src/Greenshot.Addon.Jira/JiraAddonModule.cs
Normal file
|
@ -0,0 +1,63 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using Autofac;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.CaliburnMicro;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Greenshot.Addon.Jira.ViewModels;
|
||||
using Greenshot.Addons.Components;
|
||||
|
||||
namespace Greenshot.Addon.Jira
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class JiraAddonModule : AddonModule
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder
|
||||
.RegisterType<JiraDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<JiraConfigViewModel>()
|
||||
.As<IConfigScreen>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<JiraViewModel>()
|
||||
.AsSelf();
|
||||
builder
|
||||
.RegisterType<JiraConnector>()
|
||||
.AsSelf()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<JiraMonitor>()
|
||||
.As<IUiStartup>()
|
||||
.As<IUiShutdown>()
|
||||
.AsSelf()
|
||||
.SingleInstance();
|
||||
|
||||
base.Load(builder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
@ -50,7 +49,6 @@ namespace Greenshot.Addon.Jira
|
|||
/// <summary>
|
||||
/// This encapsulates the JiraClient to make it possible to change as less old Greenshot code as needed
|
||||
/// </summary>
|
||||
[Export]
|
||||
public class JiraConnector : IDisposable
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
|
@ -64,7 +62,6 @@ namespace Greenshot.Addon.Jira
|
|||
private readonly IJiraClient _jiraClient;
|
||||
private DateTimeOffset _loggedInTime = DateTimeOffset.MinValue;
|
||||
|
||||
[ImportingConstructor]
|
||||
public JiraConnector(
|
||||
IJiraConfiguration jiraConfiguration,
|
||||
JiraMonitor jiraMonitor,
|
||||
|
|
|
@ -25,19 +25,22 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Drawing;
|
||||
using System.IO.Compression;
|
||||
using System.Windows.Forms;
|
||||
using Autofac.Features.OwnedInstances;
|
||||
using Caliburn.Micro;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.HttpExtensions;
|
||||
using Dapplo.Jira.Entities;
|
||||
using Dapplo.Log;
|
||||
using Greenshot.Addon.Jira.ViewModels;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Controls;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
using Greenshot.Gfx;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -53,27 +56,42 @@ namespace Greenshot.Addon.Jira
|
|||
private readonly Issue _jiraIssue;
|
||||
private readonly JiraConnector _jiraConnector;
|
||||
private readonly IWindowManager _windowManager;
|
||||
private readonly JiraViewModel _jiraViewModel;
|
||||
private readonly Func<Owned<JiraViewModel>> _jiraViewModelFactory;
|
||||
private readonly IResourceProvider _resourceProvider;
|
||||
private readonly IJiraConfiguration _jiraConfiguration;
|
||||
private readonly IJiraLanguage _jiraLanguage;
|
||||
|
||||
[ImportingConstructor]
|
||||
public JiraDestination(IJiraConfiguration jiraConfiguration, IJiraLanguage jiraLanguage, JiraConnector jiraConnector, IWindowManager windowManager, JiraViewModel jiraViewModel)
|
||||
public JiraDestination(
|
||||
IJiraConfiguration jiraConfiguration,
|
||||
IJiraLanguage jiraLanguage,
|
||||
JiraConnector jiraConnector,
|
||||
Func<Owned<JiraViewModel>> jiraViewModelFactory,
|
||||
IWindowManager windowManager,
|
||||
IResourceProvider resourceProvider,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_jiraConfiguration = jiraConfiguration;
|
||||
_jiraLanguage = jiraLanguage;
|
||||
_jiraConnector = jiraConnector;
|
||||
_windowManager = windowManager;
|
||||
_jiraViewModel = jiraViewModel;
|
||||
_jiraViewModelFactory = jiraViewModelFactory;
|
||||
_resourceProvider = resourceProvider;
|
||||
}
|
||||
|
||||
public JiraDestination(IJiraConfiguration jiraConfiguration, IJiraLanguage jiraLanguage, JiraConnector jiraConnector, Issue jiraIssue, IWindowManager windowManager)
|
||||
protected JiraDestination(IJiraConfiguration jiraConfiguration,
|
||||
IJiraLanguage jiraLanguage,
|
||||
JiraConnector jiraConnector,
|
||||
Func<Owned<JiraViewModel>> jiraViewModelFactory,
|
||||
IWindowManager windowManager,
|
||||
IResourceProvider resourceProvider,
|
||||
Issue jiraIssue,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : this(jiraConfiguration, jiraLanguage, jiraConnector, jiraViewModelFactory, windowManager, resourceProvider, coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_jiraConfiguration = jiraConfiguration;
|
||||
_jiraLanguage = jiraLanguage;
|
||||
_jiraConnector = jiraConnector;
|
||||
_jiraIssue = jiraIssue;
|
||||
_windowManager = windowManager;
|
||||
}
|
||||
|
||||
public override string Description
|
||||
|
@ -119,8 +137,14 @@ namespace Greenshot.Addon.Jira
|
|||
}
|
||||
if (displayIcon == null)
|
||||
{
|
||||
var resources = new ComponentResourceManager(typeof(JiraPlugin));
|
||||
displayIcon = (Bitmap) resources.GetObject("Jira");
|
||||
using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "jira.svgz"))
|
||||
{
|
||||
using (var gzStream = new GZipStream(bitmapStream, CompressionMode.Decompress))
|
||||
{
|
||||
displayIcon = SvgBitmap.FromStream(gzStream).Bitmap;
|
||||
}
|
||||
//displayIcon = BitmapHelper.FromStream(bitmapStream);
|
||||
}
|
||||
}
|
||||
return displayIcon;
|
||||
}
|
||||
|
@ -134,12 +158,10 @@ namespace Greenshot.Addon.Jira
|
|||
}
|
||||
foreach (var jiraDetails in _jiraConnector.RecentJiras)
|
||||
{
|
||||
yield return new JiraDestination(_jiraConfiguration, _jiraLanguage, _jiraConnector, jiraDetails.JiraIssue, _windowManager)
|
||||
{
|
||||
CoreConfiguration = CoreConfiguration,
|
||||
GreenshotLanguage = GreenshotLanguage
|
||||
};
|
||||
}
|
||||
yield return new JiraDestination(
|
||||
_jiraConfiguration, _jiraLanguage, _jiraConnector, _jiraViewModelFactory,
|
||||
_windowManager, _resourceProvider, jiraDetails.JiraIssue, CoreConfiguration, GreenshotLanguage);
|
||||
}
|
||||
}
|
||||
|
||||
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
|
||||
|
@ -170,33 +192,36 @@ namespace Greenshot.Addon.Jira
|
|||
{
|
||||
// TODO: set filename
|
||||
// _jiraViewModel.SetFilename(filename);
|
||||
if (_windowManager.ShowDialog(_jiraViewModel) == true)
|
||||
using (var jiraViewModel = _jiraViewModelFactory())
|
||||
{
|
||||
try
|
||||
{
|
||||
surface.UploadUrl = _jiraConnector.JiraBaseUri.AppendSegments("browse", _jiraViewModel.JiraIssue.Key).AbsoluteUri;
|
||||
// Run upload in the background
|
||||
new PleaseWaitForm().ShowAndWait(Description, _jiraLanguage.CommunicationWait,
|
||||
async () =>
|
||||
{
|
||||
await _jiraConnector.AttachAsync(_jiraViewModel.JiraIssue.Key, surface, _jiraViewModel.Filename).ConfigureAwait(true);
|
||||
if (_windowManager.ShowDialog(jiraViewModel.Value) == true)
|
||||
{
|
||||
try
|
||||
{
|
||||
surface.UploadUrl = _jiraConnector.JiraBaseUri.AppendSegments("browse", jiraViewModel.Value.JiraIssue.Key).AbsoluteUri;
|
||||
// Run upload in the background
|
||||
new PleaseWaitForm().ShowAndWait(Description, _jiraLanguage.CommunicationWait,
|
||||
async () =>
|
||||
{
|
||||
await _jiraConnector.AttachAsync(jiraViewModel.Value.JiraIssue.Key, surface, jiraViewModel.Value.Filename).ConfigureAwait(true);
|
||||
|
||||
if (!string.IsNullOrEmpty(_jiraViewModel.Comment))
|
||||
{
|
||||
await _jiraConnector.AddCommentAsync(_jiraViewModel.JiraIssue.Key, _jiraViewModel.Comment).ConfigureAwait(true);
|
||||
}
|
||||
}
|
||||
);
|
||||
Log.Debug().WriteLine("Uploaded to Jira {0}", _jiraViewModel.JiraIssue.Key);
|
||||
exportInformation.ExportMade = true;
|
||||
exportInformation.Uri = surface.UploadUrl;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(_jiraLanguage.UploadFailure + " " + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(jiraViewModel.Value.Comment))
|
||||
{
|
||||
await _jiraConnector.AddCommentAsync(jiraViewModel.Value.JiraIssue.Key, jiraViewModel.Value.Comment).ConfigureAwait(true);
|
||||
}
|
||||
}
|
||||
);
|
||||
Log.Debug().WriteLine("Uploaded to Jira {0}", jiraViewModel.Value.JiraIssue.Key);
|
||||
exportInformation.ExportMade = true;
|
||||
exportInformation.Uri = surface.UploadUrl;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(_jiraLanguage.UploadFailure + " " + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ProcessExport(exportInformation, surface);
|
||||
return exportInformation;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
@ -46,8 +45,7 @@ namespace Greenshot.Addon.Jira
|
|||
/// It keeps a list of the last "accessed" jiras, and makes it easy to upload to one.
|
||||
/// Make sure this is instanciated on the UI thread!
|
||||
/// </summary>
|
||||
[UiStartupAction, Export, UiShutdownAction]
|
||||
public class JiraMonitor : IUiStartupAction, IUiShutdownAction
|
||||
public class JiraMonitor : IUiStartup, IUiShutdown
|
||||
{
|
||||
private readonly IJiraConfiguration _jiraConfiguration;
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
|
@ -58,7 +56,6 @@ namespace Greenshot.Addon.Jira
|
|||
// TODO: Add issues from issueHistory (JQL -> Where.IssueKey.InIssueHistory())
|
||||
private IDictionary<string, JiraDetails> _recentJiras = new Dictionary<string, JiraDetails>();
|
||||
|
||||
[ImportingConstructor]
|
||||
public JiraMonitor(IJiraConfiguration jiraConfiguration)
|
||||
{
|
||||
_jiraConfiguration = jiraConfiguration;
|
||||
|
|
|
@ -1,114 +0,0 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
#region Usings
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
using Dapplo.Log;
|
||||
using Dapplo.Windows.Dpi;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
using Greenshot.Addons.Interfaces.Plugin;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Greenshot.Addon.Jira
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the JiraPlugin base code
|
||||
/// </summary>
|
||||
[Export(typeof(IGreenshotPlugin))]
|
||||
public sealed class JiraPlugin : IGreenshotPlugin
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
private readonly IGreenshotHost _greenshotHost;
|
||||
private readonly ICoreConfiguration _coreConfiguration;
|
||||
private readonly JiraConnector _jiraConnector;
|
||||
|
||||
|
||||
[ImportingConstructor]
|
||||
public JiraPlugin(IGreenshotHost greenshotHost, ICoreConfiguration coreConfiguration, JiraConnector jiraConnector)
|
||||
{
|
||||
_greenshotHost = greenshotHost;
|
||||
_coreConfiguration = coreConfiguration;
|
||||
_jiraConnector = jiraConnector;
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public static JiraPlugin Instance { get; private set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
public IEnumerable<IDestination> Destinations()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
public IEnumerable<IProcessor> Processors()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of the IGreenshotPlugin.Initialize
|
||||
/// </summary>
|
||||
/// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
|
||||
public bool Initialize()
|
||||
{
|
||||
_greenshotHost.ContextMenuDpiHandler.OnDpiChanged.Subscribe(dpi =>
|
||||
{
|
||||
var size = DpiHandler.ScaleWithDpi(_coreConfiguration.IconSize.Width, dpi);
|
||||
|
||||
_jiraConnector.UpdateSvgSize(size);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
Log.Debug().WriteLine("Jira Plugin shutdown.");
|
||||
if (_jiraConnector != null)
|
||||
{
|
||||
Task.Run(async () => await _jiraConnector.LogoutAsync());
|
||||
}
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (!disposing)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_jiraConnector?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="Jira" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAXNJREFUOE9j+I8D
|
||||
3H/65r9GcN1/6+Su/99//MKl7D8DTAakqLh/9f/zNx6BhRZvPfFfwKEAjEGGgcD6/ef/dy/ahWIY3IDr
|
||||
95+DFVdP2wBW8Pnrj//ZnctQNPgXTfsv4VaCasD2o5eBir+DBUG243Pu6/ef/99+9BKs9vGLd/9PX33w
|
||||
n0E1sPb/8Ut3cfoRl8Ts9Yf/h1fOgoQBzAXoii/feQK2CRuA6QEbAAocGc/y//H18/+///QVIxAPn78N
|
||||
FgM5P7hsxn+dsIb/oDADAXgggpwECkRtoOTpq/fBCmGx0D5/+//lO06BAxCEYQaiGADiNM/ZCtfkktkP
|
||||
Z/sUTIazV+85iz0aYaIZbUvgimEugNEgV6IDuBdgEr9///kfAQxddM0g12EDGAZAYuUHOBnDDAElIFwA
|
||||
hwHfKTOgBJgn0L0wf9NR4rwASpUwzQ5pPXCXKPhU/gclZbyBCMoHBpHNYANEnIvAuXDzoYtwA0FJFx0A
|
||||
AF/7VZm9H2iVAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#endregion
|
||||
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Reactive.Disposables;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Dapplo.CaliburnMicro.Extensions;
|
||||
|
@ -30,7 +29,6 @@ using Greenshot.Addons.ViewModels;
|
|||
|
||||
namespace Greenshot.Addon.Jira.ViewModels
|
||||
{
|
||||
[Export(typeof(IConfigScreen))]
|
||||
public sealed class JiraConfigViewModel : SimpleConfigScreen
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -38,14 +36,22 @@ namespace Greenshot.Addon.Jira.ViewModels
|
|||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
[Import]
|
||||
public IJiraConfiguration JiraConfiguration { get; set; }
|
||||
public IJiraConfiguration JiraConfiguration { get; }
|
||||
|
||||
[Import]
|
||||
public IJiraLanguage JiraLanguage { get; set; }
|
||||
public IJiraLanguage JiraLanguage { get; }
|
||||
|
||||
[Import]
|
||||
public FileConfigPartViewModel FileConfigPartViewModel { get; private set; }
|
||||
public FileConfigPartViewModel FileConfigPartViewModel { get; }
|
||||
|
||||
public JiraConfigViewModel(
|
||||
IJiraConfiguration jiraConfiguration,
|
||||
IJiraLanguage jiraLanguage,
|
||||
FileConfigPartViewModel fileConfigPartViewModel
|
||||
)
|
||||
{
|
||||
JiraConfiguration = jiraConfiguration;
|
||||
JiraLanguage = jiraLanguage;
|
||||
FileConfigPartViewModel = fileConfigPartViewModel;
|
||||
}
|
||||
|
||||
public override void Initialize(IConfig config)
|
||||
{
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
|
@ -33,22 +32,30 @@ using Dapplo.Jira.Entities;
|
|||
|
||||
namespace Greenshot.Addon.Jira.ViewModels
|
||||
{
|
||||
[Export]
|
||||
public sealed class JiraViewModel : Screen
|
||||
{
|
||||
/// <summary>
|
||||
/// Here all disposables are registered, so we can clean the up
|
||||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
public IJiraConfiguration JiraConfiguration { get; }
|
||||
|
||||
[Import]
|
||||
public IJiraConfiguration JiraConfiguration { get; set; }
|
||||
public IJiraLanguage JiraLanguage { get; }
|
||||
|
||||
[Import]
|
||||
public IJiraLanguage JiraLanguage { get; set; }
|
||||
public JiraConnector JiraConnector { get; }
|
||||
|
||||
[Import]
|
||||
public JiraConnector JiraConnector { get; set; }
|
||||
|
||||
public JiraViewModel(
|
||||
IJiraConfiguration jiraConfiguration,
|
||||
IJiraLanguage jiraLanguage,
|
||||
JiraConnector jiraConnector
|
||||
)
|
||||
{
|
||||
JiraConfiguration = jiraConfiguration;
|
||||
JiraLanguage = jiraLanguage;
|
||||
JiraConnector = jiraConnector;
|
||||
}
|
||||
|
||||
public IList<Filter> Filters { get; private set; }
|
||||
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.8.1.0" newVersion="4.8.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,24 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="4.8.1" targetFramework="net452" />
|
||||
<package id="Autofac.Extras.AttributeMetadata" version="4.0.1" targetFramework="net452" />
|
||||
<package id="Autofac.Mef" version="4.0.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net452" />
|
||||
<package id="CommonServiceLocator" version="2.0.3" targetFramework="net452" />
|
||||
<package id="Costura.Fody" version="2.0.0" targetFramework="net452" developmentDependency="true" />
|
||||
<package id="Dapplo.Addons" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Costura.Fody" version="2.0.1" targetFramework="net452" developmentDependency="true" />
|
||||
<package id="Dapplo.Addons" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions.JsonNet" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions.OAuth" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net452" />
|
||||
<package id="Dapplo.Jira" version="0.7.10" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Log" version="1.2.1" targetFramework="net452" />
|
||||
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows" version="0.5.56" targetFramework="net452" />
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
|
@ -54,7 +53,6 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
|
|||
/// <summary>
|
||||
/// Description of Surface.
|
||||
/// </summary>
|
||||
[Export(typeof(ISurface))]
|
||||
public sealed class Surface : Control, ISurface, INotifyPropertyChanged
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
|
|
71
src/Greenshot.Addon.LegacyEditor/EditorAddonModule.cs
Normal file
71
src/Greenshot.Addon.LegacyEditor/EditorAddonModule.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using Autofac;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Greenshot.Addon.LegacyEditor.Drawing;
|
||||
using Greenshot.Addon.LegacyEditor.Forms;
|
||||
using Greenshot.Addon.LegacyEditor.ViewModels;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
|
||||
namespace Greenshot.Addon.LegacyEditor
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class EditorAddonModule : AddonModule
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder
|
||||
.RegisterType<EditorDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<EditorConfigViewModel>()
|
||||
.As<IConfigScreen>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<EditorFactory>()
|
||||
.AsSelf()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<ResizeSettingsForm>()
|
||||
.AsSelf();
|
||||
builder
|
||||
.RegisterType<TornEdgeSettingsForm>()
|
||||
.AsSelf();
|
||||
builder
|
||||
.RegisterType<DropShadowSettingsForm>()
|
||||
.AsSelf();
|
||||
builder
|
||||
.RegisterType<ImageEditorForm>()
|
||||
.AsSelf();
|
||||
builder
|
||||
.RegisterType<Surface>()
|
||||
.As<ISurface>();
|
||||
|
||||
base.Load(builder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using Dapplo.Log;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
using Greenshot.Addons.Interfaces.Forms;
|
||||
|
@ -44,24 +44,31 @@ namespace Greenshot.Addon.LegacyEditor
|
|||
[Destination("Editor", 1)]
|
||||
public class EditorDestination : AbstractDestination
|
||||
{
|
||||
private readonly EditorFactory _editorFactory;
|
||||
private readonly IEditorLanguage _editorLanguage;
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
private static readonly Bitmap greenshotIcon = GreenshotResources.GetGreenshotIcon().ToBitmap();
|
||||
private readonly IImageEditor _editor;
|
||||
|
||||
[Import(AllowRecomposition = true, AllowDefault = true)]
|
||||
private EditorFactory _editorFactory;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor so we can initiate this from MEF
|
||||
/// </summary>
|
||||
[ImportingConstructor]
|
||||
public EditorDestination(IEditorLanguage editorLanguage)
|
||||
public EditorDestination(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
EditorFactory editorFactory,
|
||||
IEditorLanguage editorLanguage) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_editorFactory = editorFactory;
|
||||
_editorLanguage = editorLanguage;
|
||||
}
|
||||
|
||||
public EditorDestination(EditorFactory editorFactory, IEditorLanguage editorLanguage, IImageEditor editor) : this(editorLanguage)
|
||||
public EditorDestination(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
EditorFactory editorFactory,
|
||||
IEditorLanguage editorLanguage,
|
||||
IImageEditor editor) : this(coreConfiguration, greenshotLanguage, editorFactory, editorLanguage)
|
||||
{
|
||||
_editorFactory = editorFactory;
|
||||
_editor = editor;
|
||||
|
@ -85,7 +92,7 @@ namespace Greenshot.Addon.LegacyEditor
|
|||
|
||||
public override IEnumerable<IDestination> DynamicDestinations()
|
||||
{
|
||||
return _editorFactory.Editors.Select(someEditor => new EditorDestination(_editorFactory, _editorLanguage, someEditor));
|
||||
return _editorFactory.Editors.Select(someEditor => new EditorDestination(CoreConfiguration, GreenshotLanguage, _editorFactory, _editorLanguage, someEditor));
|
||||
}
|
||||
|
||||
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
|
||||
|
|
|
@ -21,10 +21,9 @@
|
|||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using Dapplo.Log;
|
||||
using Greenshot.Addon.LegacyEditor.Forms;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
|
@ -35,22 +34,19 @@ namespace Greenshot.Addon.LegacyEditor
|
|||
/// <summary>
|
||||
/// This provides a way to find and create the editors
|
||||
/// </summary>
|
||||
[Export]
|
||||
public class EditorFactory
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
private readonly IEditorConfiguration _editorConfiguration;
|
||||
private readonly ExportFactory<ImageEditorForm> _imageEditorExportFactory;
|
||||
private readonly Func<ImageEditorForm> _imageEditorFactory;
|
||||
private readonly IList<ImageEditorForm> _editorList = new List<ImageEditorForm>();
|
||||
|
||||
[ImportingConstructor]
|
||||
public EditorFactory(
|
||||
IEditorConfiguration editorConfiguration,
|
||||
ExportFactory<ImageEditorForm> imageEditorExportFactory,
|
||||
ExportFactory<ISurface> surfaceExportFactory)
|
||||
Func<ImageEditorForm> imageEditorFactory,
|
||||
Func<ISurface> surfaceExportFactory)
|
||||
{
|
||||
_editorConfiguration = editorConfiguration;
|
||||
_imageEditorExportFactory = imageEditorExportFactory;
|
||||
_imageEditorFactory = imageEditorFactory;
|
||||
// Factory for surface objects
|
||||
ImageOutput.SurfaceFactory = surfaceExportFactory;
|
||||
}
|
||||
|
@ -88,8 +84,7 @@ namespace Greenshot.Addon.LegacyEditor
|
|||
}
|
||||
}
|
||||
|
||||
var editorExport = _imageEditorExportFactory.CreateExport();
|
||||
editorToReturn = editorExport.Value;
|
||||
editorToReturn = _imageEditorFactory();
|
||||
editorToReturn.Surface = surface;
|
||||
_editorList.Add(editorToReturn);
|
||||
if (!string.IsNullOrEmpty(captureDetails?.Filename))
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.IO;
|
||||
|
@ -33,6 +32,7 @@ using System.Linq;
|
|||
using System.Reactive.Disposables;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Autofac.Features.OwnedInstances;
|
||||
using Dapplo.Log;
|
||||
using Dapplo.Windows.Clipboard;
|
||||
using Dapplo.Windows.Common.Extensions;
|
||||
|
@ -46,7 +46,7 @@ using Greenshot.Addon.LegacyEditor.Controls;
|
|||
using Greenshot.Addon.LegacyEditor.Drawing;
|
||||
using Greenshot.Addon.LegacyEditor.Drawing.Fields;
|
||||
using Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Controls;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Extensions;
|
||||
|
@ -63,16 +63,14 @@ namespace Greenshot.Addon.LegacyEditor.Forms
|
|||
/// <summary>
|
||||
/// Description of ImageEditorForm.
|
||||
/// </summary>
|
||||
[Export]
|
||||
public partial class ImageEditorForm : BaseForm, IImageEditor
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
private static readonly List<string> IgnoreDestinations = new List<string> { "Picker", "Editor"};
|
||||
private static readonly string[] SupportedClipboardFormats = { typeof(string).FullName, "Text", typeof(IDrawableContainerList).FullName };
|
||||
private readonly IEditorConfiguration _editorConfiguration;
|
||||
private readonly IEditorLanguage _editorLanguage;
|
||||
|
||||
private static readonly string[] SupportedClipboardFormats = {typeof(string).FullName, "Text", typeof(IDrawableContainerList).FullName};
|
||||
|
||||
// whether part of the editor controls are disabled depending on selected item(s)
|
||||
private bool _controlsDisabledDueToConfirmable;
|
||||
private bool _originalBoldCheckState;
|
||||
|
@ -82,20 +80,29 @@ namespace Greenshot.Addon.LegacyEditor.Forms
|
|||
private BitmapScaleHandler<IDestination> _destinationScaleHandler;
|
||||
private readonly IDisposable _clipboardSubscription;
|
||||
private readonly EditorFactory _editorFactory;
|
||||
private readonly DestinationHolder _destinationHolder;
|
||||
private readonly Func<ResizeEffect, Owned<ResizeSettingsForm>> _resizeSettingsFormFactory;
|
||||
private readonly Func<TornEdgeEffect, Owned<TornEdgeSettingsForm>> _tornEdgeSettingsFormFactory;
|
||||
private readonly Func<DropShadowEffect, Owned<DropShadowSettingsForm>> _dropShadowSettingsFormFactory;
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
[ImportMany(AllowRecomposition = true)]
|
||||
private IEnumerable<Lazy<IDestination, IDestinationMetadata>> _destinations;
|
||||
|
||||
[ImportingConstructor]
|
||||
public ImageEditorForm(
|
||||
IEditorConfiguration editorConfiguration,
|
||||
IEditorLanguage editorLanguage,
|
||||
EditorFactory editorFactory)
|
||||
EditorFactory editorFactory,
|
||||
DestinationHolder destinationHolder,
|
||||
Func<ResizeEffect, Owned<ResizeSettingsForm>> resizeSettingsFormFactory,
|
||||
Func<TornEdgeEffect, Owned<TornEdgeSettingsForm>> tornEdgeSettingsFormFactory,
|
||||
Func<DropShadowEffect, Owned<DropShadowSettingsForm>> dropShadowSettingsFormFactory
|
||||
)
|
||||
{
|
||||
_editorConfiguration = editorConfiguration;
|
||||
_editorLanguage = editorLanguage;
|
||||
_editorFactory = editorFactory;
|
||||
_destinationHolder = destinationHolder;
|
||||
_resizeSettingsFormFactory = resizeSettingsFormFactory;
|
||||
_tornEdgeSettingsFormFactory = tornEdgeSettingsFormFactory;
|
||||
_dropShadowSettingsFormFactory = dropShadowSettingsFormFactory;
|
||||
//
|
||||
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||
//
|
||||
|
@ -381,7 +388,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms
|
|||
await Task.Run(() =>
|
||||
{
|
||||
// Create export buttons
|
||||
foreach (var destination in _destinations
|
||||
foreach (var destination in _destinationHolder.AllDestinations
|
||||
.Where(destination => destination.Metadata.Priority > 2 && !IgnoreDestinations.Contains(destination.Metadata.Designation) && destination.Value.IsActive)
|
||||
.OrderBy(destination => destination.Metadata.Priority).ThenBy(destination => destination.Value.Description)
|
||||
.Select(d => d.Value))
|
||||
|
@ -522,7 +529,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms
|
|||
ClearItems(fileStripMenuItem.DropDownItems);
|
||||
|
||||
// Add the destinations
|
||||
foreach (var destination in _destinations
|
||||
foreach (var destination in _destinationHolder.AllDestinations
|
||||
.Where(destination => !IgnoreDestinations.Contains(destination.Metadata.Designation) && destination.Value.IsActive)
|
||||
.OrderBy(destination => destination.Metadata.Priority).ThenBy(destination => destination.Value.Description)
|
||||
.Select(d => d.Value))
|
||||
|
@ -1082,8 +1089,11 @@ namespace Greenshot.Addon.LegacyEditor.Forms
|
|||
apply = true;
|
||||
break;
|
||||
case MouseButtons.Right:
|
||||
var result = new DropShadowSettingsForm(dropShadowEffect).ShowDialog(this);
|
||||
apply = result == DialogResult.OK;
|
||||
using (var dropShadowSettingsForm = _dropShadowSettingsFormFactory(dropShadowEffect))
|
||||
{
|
||||
var result = dropShadowSettingsForm.Value.ShowDialog(this);
|
||||
apply = result == DialogResult.OK;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -1100,16 +1110,19 @@ namespace Greenshot.Addon.LegacyEditor.Forms
|
|||
/// <summary>
|
||||
/// Open the resize settings from, and resize if ok was pressed
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
/// <param name="sender">object</param>
|
||||
/// <param name="e">EventArgs</param>
|
||||
private void BtnResizeClick(object sender, EventArgs e)
|
||||
{
|
||||
var resizeEffect = new ResizeEffect(_surface.Screenshot.Width, _surface.Screenshot.Height, true);
|
||||
var result = new ResizeSettingsForm(resizeEffect).ShowDialog(this);
|
||||
if (result == DialogResult.OK)
|
||||
using (var resizeSettingsForm = _resizeSettingsFormFactory(resizeEffect))
|
||||
{
|
||||
_surface.ApplyBitmapEffect(resizeEffect);
|
||||
UpdateUndoRedoSurfaceDependencies();
|
||||
var result = resizeSettingsForm.Value.ShowDialog(this);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
_surface.ApplyBitmapEffect(resizeEffect);
|
||||
UpdateUndoRedoSurfaceDependencies();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1128,8 +1141,11 @@ namespace Greenshot.Addon.LegacyEditor.Forms
|
|||
apply = true;
|
||||
break;
|
||||
case MouseButtons.Right:
|
||||
var result = new TornEdgeSettingsForm(tornEdgeEffect).ShowDialog(this);
|
||||
apply = result == DialogResult.OK;
|
||||
using (var ownedForm = _tornEdgeSettingsFormFactory(tornEdgeEffect))
|
||||
{
|
||||
var result = ownedForm.Value.ShowDialog(this);
|
||||
apply = result == DialogResult.OK;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -1242,12 +1258,12 @@ namespace Greenshot.Addon.LegacyEditor.Forms
|
|||
{
|
||||
destinationDesignation = "FileDialog";
|
||||
}
|
||||
_destinations.Find(destinationDesignation)?.ExportCaptureAsync(true, _surface, _surface.CaptureDetails);
|
||||
_destinationHolder.AllDestinations.Find(destinationDesignation)?.ExportCaptureAsync(true, _surface, _surface.CaptureDetails);
|
||||
}
|
||||
|
||||
private void BtnClipboardClick(object sender, EventArgs e)
|
||||
{
|
||||
_destinations.Find("Clipboard")?.ExportCaptureAsync(true, _surface, _surface.CaptureDetails);
|
||||
_destinationHolder.AllDestinations.Find("Clipboard")?.ExportCaptureAsync(true, _surface, _surface.CaptureDetails);
|
||||
}
|
||||
|
||||
private void BtnPrintClick(object sender, EventArgs e)
|
||||
|
@ -1255,7 +1271,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms
|
|||
// The BeginInvoke is a solution for the printdialog not having focus
|
||||
BeginInvoke((MethodInvoker) delegate
|
||||
{
|
||||
_destinations.Find("Printer")?.ExportCaptureAsync(true, _surface, _surface.CaptureDetails);
|
||||
_destinationHolder.AllDestinations.Find("Printer")?.ExportCaptureAsync(true, _surface, _surface.CaptureDetails);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1711,9 +1727,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms
|
|||
// Go through the destinations to check the EditorShortcut Keys
|
||||
// this way the menu entries don't need to be enabled.
|
||||
// This also fixes bugs #3526974 & #3527020
|
||||
foreach (var destination in _destinations.Where(destination => destination.Value.IsActive)
|
||||
.OrderBy(destination => destination.Metadata.Priority).ThenBy(destination => destination.Value.Description)
|
||||
.Select(d => d.Value))
|
||||
foreach (var destination in _destinationHolder.SortedActiveDestinations)
|
||||
{
|
||||
if (destination.EditorShortcutKeys != keys)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,6 @@ using System.ComponentModel;
|
|||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Greenshot.Addons.Controls;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Gfx.Effects;
|
||||
|
||||
#endregion
|
||||
|
@ -41,15 +40,15 @@ namespace Greenshot.Addon.LegacyEditor.Forms
|
|||
public partial class ResizeSettingsForm : BaseForm
|
||||
{
|
||||
private readonly ResizeEffect _effect;
|
||||
private readonly string _valuePercent;
|
||||
private readonly string _valuePercent;
|
||||
private double _newWidth, _newHeight;
|
||||
|
||||
public ResizeSettingsForm(ResizeEffect effect)
|
||||
public ResizeSettingsForm(ResizeEffect effect, IEditorLanguage editorLanguage)
|
||||
{
|
||||
_effect = effect;
|
||||
InitializeComponent();
|
||||
var valuePixel = Language.GetString("editor_resize_pixel");
|
||||
_valuePercent = Language.GetString("editor_resize_percent");
|
||||
InitializeComponent();
|
||||
var valuePixel = editorLanguage.EditorResizePixel;
|
||||
_valuePercent = editorLanguage.EditorResizePercent;
|
||||
combobox_width.Items.Add(valuePixel);
|
||||
combobox_width.Items.Add(_valuePercent);
|
||||
combobox_width.SelectedItem = valuePixel;
|
||||
|
|
|
@ -15,6 +15,15 @@
|
|||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Extras.AttributeMetadata, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Extras.AttributeMetadata.4.0.1\lib\net45\Autofac.Extras.AttributeMetadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Mef, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Mef.4.0.0\lib\net45\Autofac.Integration.Mef.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -27,35 +36,38 @@
|
|||
<Reference Include="CommonServiceLocator, Version=2.0.3.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommonServiceLocator.2.0.3\lib\net45\CommonServiceLocator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.0.5.56\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.1.0.44\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.0.5.56\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.1.0.44\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.0.5.28\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.1.0.42\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.0.5.28\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.1.0.42\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.0.5.28\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.1.0.42\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.0.5.28\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.1.0.42\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.0.5.28\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.1.0.42\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.24\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.42\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.InterfaceImpl, Version=0.2.12.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.InterfaceImpl.0.2.12\lib\net45\Dapplo.InterfaceImpl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.24\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.28\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Log, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Log.1.2.1\lib\net45\Dapplo.Log.dll</HintPath>
|
||||
|
@ -205,6 +217,7 @@
|
|||
<Compile Include="EditorConfigurationExtensions.cs" />
|
||||
<Compile Include="EditorDestination.cs" />
|
||||
<Compile Include="EditorFactory.cs" />
|
||||
<Compile Include="EditorAddonModule.cs" />
|
||||
<Compile Include="Forms\DropShadowSettingsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -253,6 +266,7 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -270,10 +284,9 @@
|
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
"$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
del /q /s "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"\*
|
||||
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"</PostBuildEvent>
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#endregion
|
||||
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Reactive.Disposables;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Dapplo.CaliburnMicro.Extensions;
|
||||
|
@ -29,7 +28,6 @@ using Greenshot.Addons.Core;
|
|||
|
||||
namespace Greenshot.Addon.LegacyEditor.ViewModels
|
||||
{
|
||||
[Export(typeof(IConfigScreen))]
|
||||
public sealed class EditorConfigViewModel : SimpleConfigScreen
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -37,11 +35,17 @@ namespace Greenshot.Addon.LegacyEditor.ViewModels
|
|||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
[Import]
|
||||
public IEditorConfiguration EditorConfiguration { get; set; }
|
||||
public IEditorConfiguration EditorConfiguration { get; }
|
||||
|
||||
[Import]
|
||||
public IEditorLanguage EditorLanguage { get; set; }
|
||||
public IEditorLanguage EditorLanguage { get; }
|
||||
|
||||
public EditorConfigViewModel(
|
||||
IEditorConfiguration editorConfiguration,
|
||||
IEditorLanguage editorLanguage)
|
||||
{
|
||||
EditorConfiguration = editorConfiguration;
|
||||
EditorLanguage = editorLanguage;
|
||||
}
|
||||
|
||||
public override void Initialize(IConfig config)
|
||||
{
|
||||
|
|
11
src/Greenshot.Addon.LegacyEditor/app.config
Normal file
11
src/Greenshot.Addon.LegacyEditor/app.config
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.8.1.0" newVersion="4.8.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,18 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="4.8.1" targetFramework="net452" />
|
||||
<package id="Autofac.Extras.AttributeMetadata" version="4.0.1" targetFramework="net452" />
|
||||
<package id="Autofac.Mef" version="4.0.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net452" />
|
||||
<package id="CommonServiceLocator" version="2.0.3" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Log" version="1.2.1" targetFramework="net452" />
|
||||
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows" version="0.5.56" targetFramework="net452" />
|
||||
|
|
|
@ -37,6 +37,15 @@
|
|||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Extras.AttributeMetadata, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Extras.AttributeMetadata.4.0.1\lib\net45\Autofac.Extras.AttributeMetadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Mef, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Mef.4.0.0\lib\net45\Autofac.Integration.Mef.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -52,29 +61,29 @@
|
|||
<Reference Include="ControlzEx, Version=3.0.2.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.0.5.56\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.1.0.44\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.0.5.56\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.1.0.44\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.0.5.28\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.1.0.42\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.0.5.28\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.1.0.42\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.0.5.28\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.1.0.42\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.0.5.28\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.1.0.42\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.0.5.28\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.1.0.42\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.0.5.28\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.42\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.HttpExtensions, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.0.8.35\lib\net45\Dapplo.HttpExtensions.dll</HintPath>
|
||||
|
@ -82,14 +91,14 @@
|
|||
<Reference Include="Dapplo.HttpExtensions.JsonNet, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.JsonNet.0.8.35\lib\net45\Dapplo.HttpExtensions.JsonNet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.24\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.InterfaceImpl, Version=0.2.12.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.InterfaceImpl.0.2.12\lib\net45\Dapplo.InterfaceImpl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.24\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.28\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Log, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Log.1.2.1\lib\net45\Dapplo.Log.dll</HintPath>
|
||||
|
@ -124,8 +133,8 @@
|
|||
<Reference Include="Dapplo.Windows.User32, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.User32.0.5.56\lib\net45\Dapplo.Windows.User32.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MahApps.Metro, Version=1.6.1.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MahApps.Metro.1.6.1\lib\net45\MahApps.Metro.dll</HintPath>
|
||||
<Reference Include="MahApps.Metro, Version=1.6.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MahApps.Metro.1.6.4\lib\net45\MahApps.Metro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
|
@ -167,6 +176,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="Entities\AddResult.cs" />
|
||||
<Compile Include="Entities\LutimInfo.cs" />
|
||||
<Compile Include="LutimAddonModule.cs" />
|
||||
<Compile Include="ILutimLanguage.cs" />
|
||||
<Compile Include="LutimDestination.cs" />
|
||||
<Compile Include="ILutimConfiguration.cs" />
|
||||
|
@ -232,9 +242,13 @@
|
|||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
|
||||
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
|
||||
|
||||
copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
53
src/Greenshot.Addon.Lutim/LutimAddonModule.cs
Normal file
53
src/Greenshot.Addon.Lutim/LutimAddonModule.cs
Normal file
|
@ -0,0 +1,53 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using Autofac;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Greenshot.Addon.Lutim.ViewModels;
|
||||
using Greenshot.Addons.Components;
|
||||
|
||||
namespace Greenshot.Addon.Lutim
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class LutimAddonModule : AddonModule
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder
|
||||
.RegisterType<LutimDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<LutimConfigViewModel>()
|
||||
.As<IConfigScreen>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<LutimApi>()
|
||||
.AsSelf()
|
||||
.SingleInstance();
|
||||
|
||||
base.Load(builder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
|
@ -37,14 +36,12 @@ namespace Greenshot.Addon.Lutim
|
|||
/// <summary>
|
||||
/// A collection of Lutim API methods
|
||||
/// </summary>
|
||||
[Export]
|
||||
public class LutimApi
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
private readonly ILutimConfiguration _lutimConfiguration;
|
||||
private readonly ICoreConfiguration _coreConfiguration;
|
||||
|
||||
[ImportingConstructor]
|
||||
public LutimApi(ILutimConfiguration lutimConfiguration, ICoreConfiguration coreConfiguration)
|
||||
{
|
||||
_lutimConfiguration = lutimConfiguration;
|
||||
|
|
|
@ -20,26 +20,23 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Dapplo.Addons.Bootstrapper.Resolving;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.Log;
|
||||
using Greenshot.Addon.Lutim.Entities;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Controls;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
using Greenshot.Addons.Interfaces.Plugin;
|
||||
using Greenshot.Gfx;
|
||||
|
||||
namespace Greenshot.Addon.Lutim {
|
||||
/// <summary>
|
||||
/// Description of LutimDestination.
|
||||
/// This is the destination for Lutim
|
||||
/// </summary>
|
||||
[Destination("Lutim")]
|
||||
public class LutimDestination : AbstractDestination
|
||||
|
@ -48,22 +45,28 @@ namespace Greenshot.Addon.Lutim {
|
|||
private readonly ILutimConfiguration _lutimConfiguration;
|
||||
private readonly ILutimLanguage _lutimLanguage;
|
||||
private readonly LutimApi _lutimApi;
|
||||
private readonly IResourceProvider _resourceProvider;
|
||||
|
||||
[ImportingConstructor]
|
||||
public LutimDestination(ILutimConfiguration lutimConfiguration, ILutimLanguage lutimLanguage, LutimApi lutimApi)
|
||||
public LutimDestination(ILutimConfiguration lutimConfiguration,
|
||||
ILutimLanguage lutimLanguage,
|
||||
LutimApi lutimApi,
|
||||
IResourceProvider resourceProvider,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_lutimConfiguration = lutimConfiguration;
|
||||
_lutimLanguage = lutimLanguage;
|
||||
_lutimApi = lutimApi;
|
||||
_resourceProvider = resourceProvider;
|
||||
}
|
||||
|
||||
public override string Description => _lutimLanguage.UploadMenuItem;
|
||||
|
||||
public override Bitmap DisplayIcon {
|
||||
get {
|
||||
// TODO: Optimize this
|
||||
var embeddedResource = GetType().Assembly.FindEmbeddedResources(@".*Lutim\.png").FirstOrDefault();
|
||||
using (var bitmapStream = GetType().Assembly.GetEmbeddedResourceAsStream(embeddedResource))
|
||||
// TODO: Optimize this by caching
|
||||
using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "Lutim.png"))
|
||||
{
|
||||
return BitmapHelper.FromStream(bitmapStream);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#endregion
|
||||
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Reactive.Disposables;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Dapplo.CaliburnMicro.Extensions;
|
||||
|
@ -33,7 +32,6 @@ namespace Greenshot.Addon.Lutim.ViewModels
|
|||
/// <summary>
|
||||
/// The ViewModel for the Lutim configuration
|
||||
/// </summary>
|
||||
[Export(typeof(IConfigScreen))]
|
||||
public sealed class LutimConfigViewModel : SimpleConfigScreen
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -41,14 +39,19 @@ namespace Greenshot.Addon.Lutim.ViewModels
|
|||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
[Import]
|
||||
public ILutimConfiguration LutimConfiguration { get; set; }
|
||||
public ILutimConfiguration LutimConfiguration { get; }
|
||||
public ILutimLanguage LutimLanguage { get; }
|
||||
public FileConfigPartViewModel FileConfigPartViewModel { get; }
|
||||
|
||||
[Import]
|
||||
public ILutimLanguage LutimLanguage { get; set; }
|
||||
|
||||
[Import]
|
||||
public FileConfigPartViewModel FileConfigPartViewModel { get; private set; }
|
||||
public LutimConfigViewModel(
|
||||
ILutimConfiguration lutimConfiguration,
|
||||
ILutimLanguage lutimLanguage,
|
||||
FileConfigPartViewModel fileConfigPartViewModel)
|
||||
{
|
||||
LutimConfiguration = lutimConfiguration;
|
||||
LutimLanguage = lutimLanguage;
|
||||
FileConfigPartViewModel = fileConfigPartViewModel;
|
||||
}
|
||||
|
||||
public override void Initialize(IConfig config)
|
||||
{
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Diagnostics;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Threading;
|
||||
|
@ -37,27 +36,31 @@ using Greenshot.Addons.Core;
|
|||
|
||||
namespace Greenshot.Addon.Lutim.ViewModels
|
||||
{
|
||||
[Export]
|
||||
public sealed class LutimHistoryViewModel : Screen
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
private readonly LutimApi _lutimApi;
|
||||
|
||||
/// <summary>
|
||||
/// Here all disposables are registered, so we can clean the up
|
||||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
[Import]
|
||||
public ILutimConfiguration LutimConfiguration { get; set; }
|
||||
|
||||
[Import]
|
||||
public ILutimLanguage LutimLanguage { get; set; }
|
||||
|
||||
[Import]
|
||||
public IGreenshotLanguage GreenshotLanguage { get; set; }
|
||||
[Import]
|
||||
private LutimApi _lutimApi;
|
||||
|
||||
public LutimHistoryViewModel(
|
||||
ILutimConfiguration lutimConfiguration,
|
||||
ILutimLanguage lutimLanguage,
|
||||
LutimApi lutimApi,
|
||||
IGreenshotLanguage greenshotLanguage)
|
||||
{
|
||||
_lutimApi = lutimApi;
|
||||
LutimConfiguration = lutimConfiguration;
|
||||
LutimLanguage = lutimLanguage;
|
||||
GreenshotLanguage = greenshotLanguage;
|
||||
}
|
||||
/// <summary>
|
||||
/// The list of Lutim items
|
||||
/// </summary>
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.3.0" newVersion="2.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.8.1.0" newVersion="4.8.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,22 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="4.8.1" targetFramework="net452" />
|
||||
<package id="Autofac.Extras.AttributeMetadata" version="4.0.1" targetFramework="net452" />
|
||||
<package id="Autofac.Mef" version="4.0.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net452" />
|
||||
<package id="CommonServiceLocator" version="2.0.3" targetFramework="net452" />
|
||||
<package id="ControlzEx" version="3.0.2.4" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.HttpExtensions.JsonNet" version="0.8.35" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Log" version="1.2.1" targetFramework="net452" />
|
||||
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows" version="0.5.56" targetFramework="net452" />
|
||||
|
@ -28,7 +31,7 @@
|
|||
<package id="Dapplo.Windows.Kernel32" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows.Messages" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows.User32" version="0.5.56" targetFramework="net452" />
|
||||
<package id="MahApps.Metro" version="1.6.1" targetFramework="net452" />
|
||||
<package id="MahApps.Metro" version="1.6.4" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net452" />
|
||||
<package id="System.Reactive.Core" version="3.1.1" targetFramework="net45" />
|
||||
<package id="System.Reactive.Interfaces" version="3.1.1" targetFramework="net45" />
|
||||
|
|
|
@ -37,6 +37,15 @@
|
|||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Extras.AttributeMetadata, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Extras.AttributeMetadata.4.0.1\lib\net45\Autofac.Extras.AttributeMetadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Mef, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Mef.4.0.0\lib\net45\Autofac.Integration.Mef.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -49,38 +58,38 @@
|
|||
<Reference Include="CommonServiceLocator, Version=2.0.3.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommonServiceLocator.2.0.3\lib\net45\CommonServiceLocator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.0.5.56\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.1.0.44\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.0.5.56\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.1.0.44\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.0.5.28\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.1.0.42\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.0.5.28\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.1.0.42\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.0.5.28\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.1.0.42\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.0.5.28\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.1.0.42\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.0.5.28\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.1.0.42\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.0.5.28\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.42\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.24\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.InterfaceImpl, Version=0.2.12.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.InterfaceImpl.0.2.12\lib\net45\Dapplo.InterfaceImpl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.24\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.28\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Log, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Log.1.2.1\lib\net45\Dapplo.Log.dll</HintPath>
|
||||
|
@ -151,7 +160,7 @@
|
|||
<Compile Include="OCRForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="OCRPlugin.cs" />
|
||||
<Compile Include="OcrAddonModule.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SettingsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
@ -187,7 +196,7 @@
|
|||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"</PostBuildEvent>
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
#region Usings
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
using Dapplo.Log;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Core.Enums;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
|
@ -54,8 +54,11 @@ namespace Greenshot.Addon.OCR
|
|||
private readonly IOCRConfiguration _ocrConfiguration;
|
||||
private readonly string _ocrCommand;
|
||||
|
||||
[ImportingConstructor]
|
||||
public OcrDestination(IOCRConfiguration ocrConfiguration)
|
||||
public OcrDestination(
|
||||
IOCRConfiguration ocrConfiguration,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_ocrConfiguration = ocrConfiguration;
|
||||
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
#region Usings
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Windows.Forms;
|
||||
using Dapplo.Log;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
using Greenshot.Addons.Interfaces.Plugin;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Greenshot.Addon.OCR
|
||||
{
|
||||
/// <summary>
|
||||
/// OCR Plugin Greenshot
|
||||
/// </summary>
|
||||
[Export(typeof(IGreenshotPlugin))]
|
||||
public sealed class OcrPlugin : IGreenshotPlugin
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
private static IOCRConfiguration _ocrConfiguration;
|
||||
private ToolStripMenuItem _ocrMenuItem = new ToolStripMenuItem();
|
||||
|
||||
[ImportingConstructor]
|
||||
public OcrPlugin(IOCRConfiguration ocrConfiguration)
|
||||
{
|
||||
_ocrConfiguration = ocrConfiguration;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
public IEnumerable<IDestination> Destinations()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
public IEnumerable<IProcessor> Processors()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of the IGreenshotPlugin.Initialize
|
||||
/// </summary>
|
||||
/// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
|
||||
public bool Initialize()
|
||||
{
|
||||
Log.Debug().WriteLine("Initialize called");
|
||||
if (_ocrConfiguration.Language != null)
|
||||
{
|
||||
_ocrConfiguration.Language = _ocrConfiguration.Language.Replace("miLANG_", "").Replace("_", " ");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of the IGreenshotPlugin.Shutdown
|
||||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
Log.Debug().WriteLine("Shutdown");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of the IPlugin.Configure
|
||||
/// </summary>
|
||||
public void Configure()
|
||||
{
|
||||
// TODO
|
||||
if (false) //!HasModi())
|
||||
{
|
||||
MessageBox.Show("Sorry, is seems that Microsoft Office Document Imaging (MODI) is not installed, therefor the OCR Plugin cannot work.");
|
||||
return;
|
||||
}
|
||||
var settingsForm = new SettingsForm(Enum.GetNames(typeof(ModiLanguage)), _ocrConfiguration);
|
||||
var result = settingsForm.ShowDialog();
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
// "Re"set hotkeys
|
||||
//IniConfig.Save();
|
||||
}
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (_ocrMenuItem != null)
|
||||
{
|
||||
_ocrMenuItem.Dispose();
|
||||
_ocrMenuItem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
71
src/Greenshot.Addon.OCR/OcrAddonModule.cs
Normal file
71
src/Greenshot.Addon.OCR/OcrAddonModule.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Autofac;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.Addons.Bootstrapper.Resolving;
|
||||
using Greenshot.Addons.Components;
|
||||
|
||||
namespace Greenshot.Addon.OCR
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class OcrAddonModule : AddonModule
|
||||
{
|
||||
private bool HasModi()
|
||||
{
|
||||
var ocrCommand = Path.Combine(FileTools.NormalizeDirectory("."), "greenshotocrcommand.exe");
|
||||
try
|
||||
{
|
||||
using (var process = Process.Start(ocrCommand, "-c"))
|
||||
{
|
||||
if (process != null)
|
||||
{
|
||||
process.WaitForExit();
|
||||
return process.ExitCode == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
if (HasModi())
|
||||
{
|
||||
builder
|
||||
.RegisterType<OcrDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
}
|
||||
base.Load(builder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,10 @@
|
|||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.3.0" newVersion="2.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.8.1.0" newVersion="4.8.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,19 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="4.8.1" targetFramework="net452" />
|
||||
<package id="Autofac.Extras.AttributeMetadata" version="4.0.1" targetFramework="net452" />
|
||||
<package id="Autofac.Mef" version="4.0.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net452" />
|
||||
<package id="CommonServiceLocator" version="2.0.3" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Log" version="1.2.1" targetFramework="net452" />
|
||||
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows" version="0.5.56" targetFramework="net452" />
|
||||
|
|
|
@ -28,7 +28,8 @@ using System.Drawing;
|
|||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Greenshot.Addon.Office.OfficeExport;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
using Greenshot.Addons.Interfaces.Plugin;
|
||||
|
@ -40,7 +41,7 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
/// <summary>
|
||||
/// Description of PowerpointDestination.
|
||||
/// </summary>
|
||||
[Destination("Excel", 5)]
|
||||
[Destination("Excel", DestinationOrder.Excel)]
|
||||
public class ExcelDestination : AbstractDestination
|
||||
{
|
||||
private const int IconApplication = 0;
|
||||
|
@ -48,8 +49,11 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
private readonly string _exePath;
|
||||
private readonly string _workbookName;
|
||||
|
||||
public ExcelDestination()
|
||||
{
|
||||
public ExcelDestination(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_exePath = PluginUtils.GetExePath("EXCEL.EXE");
|
||||
if (_exePath != null && !File.Exists(_exePath))
|
||||
{
|
||||
|
@ -57,8 +61,11 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
}
|
||||
|
||||
public ExcelDestination(string workbookName) : this()
|
||||
{
|
||||
protected ExcelDestination(string workbookName,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : this(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_workbookName = workbookName;
|
||||
}
|
||||
|
||||
|
@ -77,7 +84,7 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
{
|
||||
foreach (var workbookName in ExcelExporter.GetWorkbooks())
|
||||
{
|
||||
yield return new ExcelDestination(workbookName);
|
||||
yield return new ExcelDestination(workbookName, CoreConfiguration, GreenshotLanguage);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ using System.Runtime.InteropServices;
|
|||
using Dapplo.Log;
|
||||
using Greenshot.Addon.Office.OfficeExport;
|
||||
using Greenshot.Addon.Office.OfficeInterop;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
|
||||
|
@ -40,7 +41,7 @@ using Greenshot.Addons.Interfaces;
|
|||
|
||||
namespace Greenshot.Addon.Office.Destinations
|
||||
{
|
||||
[Destination("OneNote", 4)]
|
||||
[Destination("OneNote", DestinationOrder.OneNote)]
|
||||
public class OneNoteDestination : AbstractDestination
|
||||
{
|
||||
private const int IconApplication = 0;
|
||||
|
@ -48,8 +49,11 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
private readonly string _exePath;
|
||||
private readonly OneNotePage _page;
|
||||
|
||||
public OneNoteDestination()
|
||||
{
|
||||
public OneNoteDestination(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_exePath = PluginUtils.GetExePath("ONENOTE.EXE");
|
||||
if (_exePath != null && !File.Exists(_exePath))
|
||||
{
|
||||
|
@ -57,7 +61,10 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
}
|
||||
|
||||
public OneNoteDestination(OneNotePage page) : this()
|
||||
protected OneNoteDestination(OneNotePage page,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : this(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_page = page;
|
||||
}
|
||||
|
@ -87,7 +94,7 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
{
|
||||
try
|
||||
{
|
||||
return OneNoteExporter.GetPages().Where(currentPage => currentPage.IsCurrentlyViewed).Select(currentPage => new OneNoteDestination(currentPage));
|
||||
return OneNoteExporter.GetPages().Where(currentPage => currentPage.IsCurrentlyViewed).Select(currentPage => new OneNoteDestination(currentPage, CoreConfiguration, GreenshotLanguage));
|
||||
}
|
||||
catch (COMException cEx)
|
||||
{
|
||||
|
|
|
@ -28,11 +28,11 @@ using System.Drawing;
|
|||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using Dapplo.Ini;
|
||||
using Dapplo.Log;
|
||||
using Greenshot.Addon.Office.OfficeExport;
|
||||
using Greenshot.Addon.Office.OfficeInterop;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
using Greenshot.Addons.Interfaces.Plugin;
|
||||
|
@ -44,24 +44,29 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
/// <summary>
|
||||
/// Description of OutlookDestination.
|
||||
/// </summary>
|
||||
[Destination("Outlook", 3)]
|
||||
[Destination("Outlook", DestinationOrder.Outlook)]
|
||||
public class OutlookDestination : AbstractDestination
|
||||
{
|
||||
private const int IconApplication = 0;
|
||||
private const int IconApplication = 0;
|
||||
private const int IconMeeting = 2;
|
||||
private const string MapiClient = "Microsoft Outlook";
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
|
||||
private readonly IOfficeConfiguration _officeConfiguration;
|
||||
private static readonly Bitmap MailIcon = GreenshotResources.GetBitmap("Email.Image");
|
||||
private static readonly IOfficeConfiguration OfficeConfig = IniConfig.Current.Get<IOfficeConfiguration>();
|
||||
private readonly string _exePath;
|
||||
private readonly bool _isActiveFlag;
|
||||
private readonly string _outlookInspectorCaption;
|
||||
private readonly OlObjectClass _outlookInspectorType;
|
||||
|
||||
public OutlookDestination()
|
||||
{
|
||||
if (EmailConfigHelper.HasOutlook())
|
||||
public OutlookDestination(
|
||||
IOfficeConfiguration officeConfiguration,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_officeConfiguration = officeConfiguration;
|
||||
if (EmailConfigHelper.HasOutlook())
|
||||
{
|
||||
_isActiveFlag = true;
|
||||
}
|
||||
|
@ -76,7 +81,13 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
}
|
||||
|
||||
public OutlookDestination(string outlookInspectorCaption, OlObjectClass outlookInspectorType) : this()
|
||||
protected OutlookDestination(
|
||||
string outlookInspectorCaption,
|
||||
OlObjectClass outlookInspectorType,
|
||||
IOfficeConfiguration officeConfiguration,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : this(officeConfiguration, coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_outlookInspectorCaption = outlookInspectorCaption;
|
||||
_outlookInspectorType = outlookInspectorType;
|
||||
|
@ -113,7 +124,7 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
foreach (var inspectorCaption in inspectorCaptions.Keys)
|
||||
{
|
||||
yield return new OutlookDestination(inspectorCaption, inspectorCaptions[inspectorCaption]);
|
||||
yield return new OutlookDestination(inspectorCaption, inspectorCaptions[inspectorCaption], _officeConfiguration, CoreConfiguration, GreenshotLanguage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,11 +177,11 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
{
|
||||
var destinations = new List<IDestination>
|
||||
{
|
||||
new OutlookDestination()
|
||||
new OutlookDestination(_officeConfiguration, CoreConfiguration, GreenshotLanguage)
|
||||
};
|
||||
foreach (var inspectorCaption in inspectorCaptions.Keys)
|
||||
{
|
||||
destinations.Add(new OutlookDestination(inspectorCaption, inspectorCaptions[inspectorCaption]));
|
||||
destinations.Add(new OutlookDestination(inspectorCaption, inspectorCaptions[inspectorCaption], _officeConfiguration, CoreConfiguration, GreenshotLanguage));
|
||||
}
|
||||
// Return the ExportInformation from the picker without processing, as this indirectly comes from us self
|
||||
return ShowPickerMenu(false, surface, captureDetails, destinations);
|
||||
|
@ -178,9 +189,9 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
else
|
||||
{
|
||||
exportInformation.ExportMade = OutlookEmailExporter.ExportToOutlook(OfficeConfig.OutlookEmailFormat, tmpFile,
|
||||
FilenameHelper.FillPattern(OfficeConfig.EmailSubjectPattern, captureDetails, false), attachmentName, OfficeConfig.EmailTo, OfficeConfig.EmailCC,
|
||||
OfficeConfig.EmailBCC, null);
|
||||
exportInformation.ExportMade = OutlookEmailExporter.ExportToOutlook(_officeConfiguration.OutlookEmailFormat, tmpFile,
|
||||
FilenameHelper.FillPattern(_officeConfiguration.EmailSubjectPattern, captureDetails, false), attachmentName, _officeConfiguration.EmailTo, _officeConfiguration.EmailCC,
|
||||
_officeConfiguration.EmailBCC, null);
|
||||
}
|
||||
}
|
||||
ProcessExport(exportInformation, surface);
|
||||
|
|
|
@ -29,7 +29,8 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Greenshot.Addon.Office.OfficeExport;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
using Greenshot.Addons.Interfaces.Plugin;
|
||||
|
@ -41,7 +42,7 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
/// <summary>
|
||||
/// Description of PowerpointDestination.
|
||||
/// </summary>
|
||||
[Destination("Powerpoint", 4)]
|
||||
[Destination("Powerpoint", DestinationOrder.Powerpoint)]
|
||||
public class PowerpointDestination : AbstractDestination
|
||||
{
|
||||
private const int IconApplication = 0;
|
||||
|
@ -51,8 +52,11 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
private readonly string _presentationName;
|
||||
|
||||
|
||||
public PowerpointDestination()
|
||||
{
|
||||
public PowerpointDestination(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_exePath = PluginUtils.GetExePath("POWERPNT.EXE");
|
||||
if (_exePath != null && !File.Exists(_exePath))
|
||||
{
|
||||
|
@ -60,7 +64,9 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
}
|
||||
|
||||
public PowerpointDestination(string presentationName) : this()
|
||||
public PowerpointDestination(string presentationName,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage) : this(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_presentationName = presentationName;
|
||||
}
|
||||
|
@ -93,7 +99,7 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
|
||||
public override IEnumerable<IDestination> DynamicDestinations()
|
||||
{
|
||||
return PowerpointExporter.GetPowerpointPresentations().Select(presentationName => new PowerpointDestination(presentationName));
|
||||
return PowerpointExporter.GetPowerpointPresentations().Select(presentationName => new PowerpointDestination(presentationName, CoreConfiguration, GreenshotLanguage));
|
||||
}
|
||||
|
||||
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
|
||||
|
@ -117,10 +123,13 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
var presentations = PowerpointExporter.GetPowerpointPresentations();
|
||||
if (presentations != null && presentations.Count > 0)
|
||||
{
|
||||
var destinations = new List<IDestination> {new PowerpointDestination()};
|
||||
var destinations = new List<IDestination>
|
||||
{
|
||||
new PowerpointDestination(CoreConfiguration, GreenshotLanguage)
|
||||
};
|
||||
foreach (var presentation in presentations)
|
||||
{
|
||||
destinations.Add(new PowerpointDestination(presentation));
|
||||
destinations.Add(new PowerpointDestination(presentation, CoreConfiguration, GreenshotLanguage));
|
||||
}
|
||||
// Return the ExportInformation from the picker without processing, as this indirectly comes from us self
|
||||
return ShowPickerMenu(false, surface, captureDetails, destinations);
|
||||
|
|
|
@ -31,7 +31,8 @@ using System.Linq;
|
|||
using System.Text.RegularExpressions;
|
||||
using Dapplo.Log;
|
||||
using Greenshot.Addon.Office.OfficeExport;
|
||||
using Greenshot.Addons.Addons;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Components;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
using Greenshot.Addons.Interfaces.Plugin;
|
||||
|
@ -43,7 +44,7 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
/// <summary>
|
||||
/// Description of EmailDestination.
|
||||
/// </summary>
|
||||
[Destination("Word", 4)]
|
||||
[Destination("Word", DestinationOrder.Word)]
|
||||
public class WordDestination : AbstractDestination
|
||||
{
|
||||
private const int IconApplication = 0;
|
||||
|
@ -52,8 +53,11 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
private readonly string _exePath;
|
||||
private readonly string _documentCaption;
|
||||
|
||||
public WordDestination()
|
||||
{
|
||||
public WordDestination(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage
|
||||
) : base(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_exePath = PluginUtils.GetExePath("WINWORD.EXE");
|
||||
if (_exePath != null && !File.Exists(_exePath))
|
||||
{
|
||||
|
@ -61,7 +65,9 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
}
|
||||
|
||||
public WordDestination(string wordCaption) : this()
|
||||
protected WordDestination(string wordCaption,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage) : this(coreConfiguration, greenshotLanguage)
|
||||
{
|
||||
_documentCaption = wordCaption;
|
||||
}
|
||||
|
@ -79,7 +85,7 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
|
||||
public override IEnumerable<IDestination> DynamicDestinations()
|
||||
{
|
||||
return WordExporter.GetWordDocuments().Select(wordCaption => new WordDestination(wordCaption));
|
||||
return WordExporter.GetWordDocuments().Select(wordCaption => new WordDestination(wordCaption, CoreConfiguration, GreenshotLanguage));
|
||||
}
|
||||
|
||||
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
|
||||
|
@ -121,11 +127,11 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
{
|
||||
var destinations = new List<IDestination>
|
||||
{
|
||||
new WordDestination()
|
||||
new WordDestination(CoreConfiguration, GreenshotLanguage)
|
||||
};
|
||||
foreach (var document in documents)
|
||||
{
|
||||
destinations.Add(new WordDestination(document));
|
||||
destinations.Add(new WordDestination(document, CoreConfiguration, GreenshotLanguage));
|
||||
}
|
||||
// Return the ExportInformation from the picker without processing, as this indirectly comes from us self
|
||||
return ShowPickerMenu(false, surface, captureDetails, destinations);
|
||||
|
|
|
@ -20,6 +20,15 @@
|
|||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Extras.AttributeMetadata, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Extras.AttributeMetadata.4.0.1\lib\net45\Autofac.Extras.AttributeMetadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Mef, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Mef.4.0.0\lib\net45\Autofac.Integration.Mef.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -32,41 +41,41 @@
|
|||
<Reference Include="CommonServiceLocator, Version=2.0.3.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommonServiceLocator.2.0.3\lib\net45\CommonServiceLocator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Costura, Version=2.0.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Costura.Fody.2.0.0\lib\net452\Costura.dll</HintPath>
|
||||
<Reference Include="Costura, Version=2.0.1.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Costura.Fody.2.0.1\lib\net452\Costura.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.0.5.56\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.1.0.44\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.0.5.56\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.1.0.44\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.0.5.28\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.1.0.42\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.0.5.28\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.1.0.42\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.0.5.28\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.1.0.42\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.0.5.28\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.1.0.42\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.0.5.28\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.1.0.42\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.0.5.28\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.42\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.24\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.InterfaceImpl, Version=0.2.12.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.InterfaceImpl.0.2.12\lib\net45\Dapplo.InterfaceImpl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.24\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.28\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Log, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Log.1.2.1\lib\net45\Dapplo.Log.dll</HintPath>
|
||||
|
@ -202,6 +211,7 @@
|
|||
<Compile Include="OfficeInterop\SpecialLocation.cs" />
|
||||
<Compile Include="OfficeInterop\WdUnits.cs" />
|
||||
<Compile Include="OfficeInterop\XMLSchema.cs" />
|
||||
<Compile Include="OfficeAddonModule.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="OfficeExport\ExcelExporter.cs" />
|
||||
<Compile Include="OfficeExport\OneNoteExporter.cs" />
|
||||
|
@ -242,7 +252,7 @@
|
|||
<PropertyGroup>
|
||||
<PostBuildEvent>mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"</PostBuildEvent>
|
||||
|
@ -251,9 +261,9 @@ copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuratio
|
|||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Costura.Fody.2.0.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.2.0.0\build\Costura.Fody.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Fody.3.0.3\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.3.0.3\build\Fody.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Costura.Fody.2.0.0\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.2.0.0\build\Costura.Fody.targets')" />
|
||||
<Import Project="..\packages\Fody.3.0.3\build\Fody.targets" Condition="Exists('..\packages\Fody.3.0.3\build\Fody.targets')" />
|
||||
<Import Project="..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets')" />
|
||||
</Project>
|
70
src/Greenshot.Addon.Office/OfficeAddonModule.cs
Normal file
70
src/Greenshot.Addon.Office/OfficeAddonModule.cs
Normal file
|
@ -0,0 +1,70 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using Autofac;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Greenshot.Addon.Office.Destinations;
|
||||
using Greenshot.Addon.Office.ViewModels;
|
||||
using Greenshot.Addons.Components;
|
||||
|
||||
namespace Greenshot.Addon.Office
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class OfficeAddonModule : AddonModule
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder
|
||||
.RegisterType<ExcelDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
|
||||
builder
|
||||
.RegisterType<WordDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
|
||||
builder
|
||||
.RegisterType<PowerpointDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
|
||||
builder
|
||||
.RegisterType<OneNoteDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
|
||||
builder
|
||||
.RegisterType<OutlookDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<OfficeConfigViewModel>()
|
||||
.As<IConfigScreen>()
|
||||
.SingleInstance();
|
||||
|
||||
base.Load(builder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,7 +22,6 @@
|
|||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Reactive.Disposables;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Dapplo.CaliburnMicro.Extensions;
|
||||
|
@ -33,7 +32,6 @@ using Greenshot.Addons.Extensions;
|
|||
|
||||
namespace Greenshot.Addon.Office.ViewModels
|
||||
{
|
||||
[Export(typeof(IConfigScreen))]
|
||||
public sealed class OfficeConfigViewModel : SimpleConfigScreen
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -41,14 +39,19 @@ namespace Greenshot.Addon.Office.ViewModels
|
|||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
[Import]
|
||||
public IOfficeConfiguration OfficeConfiguration { get; set; }
|
||||
public IOfficeConfiguration OfficeConfiguration { get; }
|
||||
public IOfficeLanguage OfficeLanguage { get; }
|
||||
public IGreenshotLanguage GreenshotLanguage { get; }
|
||||
|
||||
[Import]
|
||||
public IOfficeLanguage OfficeLanguage { get; set; }
|
||||
|
||||
[Import]
|
||||
public IGreenshotLanguage GreenshotLanguage { get; set; }
|
||||
public OfficeConfigViewModel(
|
||||
IOfficeConfiguration officeConfiguration,
|
||||
IOfficeLanguage officeLanguage,
|
||||
IGreenshotLanguage greenshotLanguage)
|
||||
{
|
||||
OfficeConfiguration = officeConfiguration;
|
||||
OfficeLanguage = officeLanguage;
|
||||
GreenshotLanguage = greenshotLanguage;
|
||||
}
|
||||
|
||||
public override void Initialize(IConfig config)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.3.0" newVersion="2.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.8.1.0" newVersion="4.8.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,20 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="4.8.1" targetFramework="net452" />
|
||||
<package id="Autofac.Extras.AttributeMetadata" version="4.0.1" targetFramework="net452" />
|
||||
<package id="Autofac.Mef" version="4.0.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net452" />
|
||||
<package id="CommonServiceLocator" version="2.0.3" targetFramework="net452" />
|
||||
<package id="Costura.Fody" version="2.0.0" targetFramework="net452" developmentDependency="true" />
|
||||
<package id="Dapplo.Addons" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="0.5.56" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Costura.Fody" version="2.0.1" targetFramework="net452" developmentDependency="true" />
|
||||
<package id="Dapplo.Addons" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.Addons.Bootstrapper" version="1.0.44" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Configuration" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Dapp" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Menu" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Security" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.42" targetFramework="net452" />
|
||||
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.24" targetFramework="net452" />
|
||||
<package id="Dapplo.Language" version="0.5.28" targetFramework="net452" />
|
||||
<package id="Dapplo.Log" version="1.2.1" targetFramework="net452" />
|
||||
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net452" />
|
||||
<package id="Dapplo.Windows" version="0.5.56" targetFramework="net452" />
|
||||
|
|
|
@ -33,6 +33,15 @@
|
|||
<Project>{5B924697-4DCD-4F98-85F1-105CB84B7341}</Project>
|
||||
<Name>Greenshot.Addons</Name>
|
||||
</ProjectReference>
|
||||
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Extras.AttributeMetadata, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Extras.AttributeMetadata.4.0.1\lib\net45\Autofac.Extras.AttributeMetadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Mef, Version=4.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Mef.4.0.0\lib\net45\Autofac.Integration.Mef.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -48,29 +57,29 @@
|
|||
<Reference Include="ControlzEx, Version=3.0.2.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.0.5.56\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.1.0.44\lib\net45\Dapplo.Addons.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.0.5.56\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
<Reference Include="Dapplo.Addons.Bootstrapper, Version=1.0.44.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Addons.Bootstrapper.1.0.44\lib\net45\Dapplo.Addons.Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.0.5.28\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.1.0.42\lib\net45\Dapplo.CaliburnMicro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.0.5.28\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Configuration, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Configuration.1.0.42\lib\net45\Dapplo.CaliburnMicro.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.0.5.28\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Dapp, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Dapp.1.0.42\lib\net45\Dapplo.CaliburnMicro.Dapp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.0.5.28\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Menu, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Menu.1.0.42\lib\net45\Dapplo.CaliburnMicro.Menu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.0.5.28\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Security, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Security.1.0.42\lib\net45\Dapplo.CaliburnMicro.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.0.5.28\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.42.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.42\lib\net45\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.HttpExtensions, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.0.8.35\lib\net45\Dapplo.HttpExtensions.dll</HintPath>
|
||||
|
@ -81,14 +90,14 @@
|
|||
<Reference Include="Dapplo.HttpExtensions.OAuth, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.OAuth.0.8.35\lib\net45\Dapplo.HttpExtensions.OAuth.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.24\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.InterfaceImpl, Version=0.2.12.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.InterfaceImpl.0.2.12\lib\net45\Dapplo.InterfaceImpl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.24\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
<Reference Include="Dapplo.Language, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Language.0.5.28\lib\net45\Dapplo.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Log, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Log.1.2.1\lib\net45\Dapplo.Log.dll</HintPath>
|
||||
|
@ -123,8 +132,8 @@
|
|||
<Reference Include="Dapplo.Windows.User32, Version=0.5.56.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.User32.0.5.56\lib\net45\Dapplo.Windows.User32.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MahApps.Metro, Version=1.6.1.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MahApps.Metro.1.6.1\lib\net45\MahApps.Metro.dll</HintPath>
|
||||
<Reference Include="MahApps.Metro, Version=1.6.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MahApps.Metro.1.6.4\lib\net45\MahApps.Metro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
|
@ -141,9 +150,6 @@
|
|||
<HintPath>..\packages\System.Reactive.Linq.3.1.1\lib\net45\System.Reactive.Linq.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="PresentationCore" />
|
||||
|
@ -158,6 +164,9 @@
|
|||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
@ -169,10 +178,12 @@
|
|||
<Compile Include="Entities\OneDriveUploadResponse.cs" />
|
||||
<Compile Include="IOneDriveConfiguration.cs" />
|
||||
<Compile Include="IOneDriveLanguage.cs" />
|
||||
<Compile Include="OneDriveAddonModule.cs" />
|
||||
<Compile Include="OneDriveDestination.cs" />
|
||||
<Compile Include="OneDriveLinkType.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ViewModels\OneDriveConfigViewModel.cs" />
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Languages\language_onedriveplugin-en-US.xml" />
|
||||
<EmbeddedResource Include="onedrive.png" />
|
||||
|
@ -186,7 +197,7 @@
|
|||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"
|
||||
|
|
|
@ -29,7 +29,6 @@ using Dapplo.HttpExtensions.OAuth;
|
|||
using Dapplo.Ini;
|
||||
using Dapplo.InterfaceImpl.Extensions;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Addons.Core.Enums;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
49
src/Greenshot.Addon.OneDrive/OneDriveAddonModule.cs
Normal file
49
src/Greenshot.Addon.OneDrive/OneDriveAddonModule.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using Autofac;
|
||||
using Dapplo.Addons;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Greenshot.Addon.OneDrive.ViewModels;
|
||||
using Greenshot.Addons.Components;
|
||||
|
||||
namespace Greenshot.Addon.OneDrive
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class OneDriveAddonModule : AddonModule
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder
|
||||
.RegisterType<OneDriveDestination>()
|
||||
.As<IDestination>()
|
||||
.SingleInstance();
|
||||
builder
|
||||
.RegisterType<OneDriveConfigViewModel>()
|
||||
.As<IConfigScreen>()
|
||||
.SingleInstance();
|
||||
|
||||
base.Load(builder);
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue