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
displayName: 'Use .NET Core sdk 3.0'
inputs:
version: '3.0.100-preview-009996'
version: '3.0.100-preview-009812'
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.9.2'

View file

@ -24,6 +24,7 @@
#if !NETCOREAPP3_0
using System;
using System.Drawing;
using System.Windows.Forms;
using Greenshot.Addons.Interfaces;
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
return;
// InkCanvas
inkCanvasHost = new WindowsXamlHost();
inkCanvasHost.InitialTypeName = "Windows.UI.Xaml.Controls.InkCanvas";
@ -57,6 +57,8 @@ namespace Greenshot.Addon.Win10
inkToolbarHost.Dock = DockStyle.Top;
inkCanvasHost.Dock = DockStyle.Fill;
inkCanvasHost.BackColor = Color.Transparent;
// Add to Window
target.Controls.Add(inkToolbarHost);
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>
/// Specifies if the global settings can be modified, which is the case when there are is no DestinationFileConfiguration
/// </summary>

View file

@ -23,6 +23,12 @@
</DockPanel>
<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">
<Label Content="{Binding GreenshotLanguage.SettingsFilenamepattern}" Width="100" />
<TextBox Text="{Binding FileConfiguration.OutputFileFilenamePattern}"/>

View file

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