Added a way to set the output directory. Changed the dotnet core SDK version for the builds, so they should run.

This commit is contained in:
Robin 2019-01-08 00:20:06 +01:00
commit 1e30f849dc
5 changed files with 35 additions and 7 deletions

View file

@ -15,7 +15,7 @@ steps:
- task: DotNetCoreInstaller@0 - task: DotNetCoreInstaller@0
displayName: 'Use .NET Core sdk 3.0' displayName: 'Use .NET Core sdk 3.0'
inputs: inputs:
version: '3.0.100-preview-009996' version: '3.0.100-preview-009812'
- task: NuGetToolInstaller@0 - task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.9.2' displayName: 'Use NuGet 4.9.2'

View file

@ -24,6 +24,7 @@
#if !NETCOREAPP3_0 #if !NETCOREAPP3_0
using System; using System;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces;
using Microsoft.Toolkit.Forms.UI.XamlHost; using Microsoft.Toolkit.Forms.UI.XamlHost;
@ -41,7 +42,6 @@ namespace Greenshot.Addon.Win10
{ {
// TODO: Fix the code below, when the following is solved: https://github.com/windows-toolkit/Microsoft.Toolkit.Win32/issues/16#issuecomment-451337186 // TODO: Fix the code below, when the following is solved: https://github.com/windows-toolkit/Microsoft.Toolkit.Win32/issues/16#issuecomment-451337186
return; return;
// InkCanvas // InkCanvas
inkCanvasHost = new WindowsXamlHost(); inkCanvasHost = new WindowsXamlHost();
inkCanvasHost.InitialTypeName = "Windows.UI.Xaml.Controls.InkCanvas"; inkCanvasHost.InitialTypeName = "Windows.UI.Xaml.Controls.InkCanvas";
@ -57,6 +57,8 @@ namespace Greenshot.Addon.Win10
inkToolbarHost.Dock = DockStyle.Top; inkToolbarHost.Dock = DockStyle.Top;
inkCanvasHost.Dock = DockStyle.Fill; inkCanvasHost.Dock = DockStyle.Fill;
inkCanvasHost.BackColor = Color.Transparent;
// Add to Window // Add to Window
target.Controls.Add(inkToolbarHost); target.Controls.Add(inkToolbarHost);
target.Controls.Add(inkCanvasHost); target.Controls.Add(inkCanvasHost);

View file

@ -97,6 +97,26 @@ namespace Greenshot.Addons.ViewModels
} }
} }
/// <summary>
/// This opens the directory selection dialog
/// </summary>
public void SelectOutputPath()
{
using (var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog())
{
// Get the storage location and replace the environment variables
folderBrowserDialog.SelectedPath = FilenameHelper.FillVariables(CoreConfiguration.OutputFilePath, false);
if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
// Only change if there is a change, otherwise we might overwrite the environment variables
if (folderBrowserDialog.SelectedPath != null && !folderBrowserDialog.SelectedPath.Equals(FilenameHelper.FillVariables(CoreConfiguration.OutputFilePath, false)))
{
CoreConfiguration.OutputFilePath = folderBrowserDialog.SelectedPath;
}
}
}
}
/// <summary> /// <summary>
/// Specifies if the global settings can be modified, which is the case when there are is no DestinationFileConfiguration /// Specifies if the global settings can be modified, which is the case when there are is no DestinationFileConfiguration
/// </summary> /// </summary>

View file

@ -23,6 +23,12 @@
</DockPanel> </DockPanel>
<CheckBox Content="{Binding GreenshotLanguage.SettingsReducecolors}" IsChecked="{Binding FileConfiguration.OutputFileReduceColors}"/> <CheckBox Content="{Binding GreenshotLanguage.SettingsReducecolors}" IsChecked="{Binding FileConfiguration.OutputFileReduceColors}"/>
<DockPanel LastChildFill="True">
<Label Content="{Binding GreenshotLanguage.SettingsOutput}" Width="100" />
<Button Content="..." Name="SelectOutputPath" />
<TextBox Text="{Binding FileConfiguration.OutputFilePath}"/>
</DockPanel>
<DockPanel LastChildFill="True"> <DockPanel LastChildFill="True">
<Label Content="{Binding GreenshotLanguage.SettingsFilenamepattern}" Width="100" /> <Label Content="{Binding GreenshotLanguage.SettingsFilenamepattern}" Width="100" />
<TextBox Text="{Binding FileConfiguration.OutputFileFilenamePattern}"/> <TextBox Text="{Binding FileConfiguration.OutputFileFilenamePattern}"/>

View file

@ -350,8 +350,8 @@ namespace Greenshot.Forms
/// <summary> /// <summary>
/// The mousedown handler of the capture form /// The mousedown handler of the capture form
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender">object</param>
/// <param name="e"></param> /// <param name="e">MouseEventArgs</param>
private void OnMouseDown(object sender, MouseEventArgs e) private void OnMouseDown(object sender, MouseEventArgs e)
{ {
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left)
@ -451,8 +451,8 @@ namespace Greenshot.Forms
/// <summary> /// <summary>
/// The mouse move handler of the capture form /// The mouse move handler of the capture form
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender">object</param>
/// <param name="e"></param> /// <param name="e">MouseEventArgs</param>
private void OnMouseMove(object sender, MouseEventArgs e) private void OnMouseMove(object sender, MouseEventArgs e)
{ {
var cursorLocation = User32Api.GetCursorLocation(); var cursorLocation = User32Api.GetCursorLocation();
@ -465,7 +465,7 @@ namespace Greenshot.Forms
/// Helper method to simplify check /// Helper method to simplify check
/// </summary> /// </summary>
/// <param name="animator"></param> /// <param name="animator"></param>
/// <returns></returns> /// <returns>bool</returns>
private bool IsAnimating(IAnimator animator) private bool IsAnimating(IAnimator animator)
{ {
return animator != null && animator.HasNext; return animator != null && animator.HasNext;