mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-28 11:10:23 +12:00
Adding ToastForm for use after task to show image preview
This commit is contained in:
parent
dbd3216290
commit
b78fd0ac41
|
@ -191,6 +191,26 @@ public static bool IsValid(this Rectangle rect)
|
|||
return rect.Width > 0 && rect.Height > 0;
|
||||
}
|
||||
|
||||
public static Size Offset(this Size size, int offset)
|
||||
{
|
||||
return new Size(size.Width + offset, size.Height + offset);
|
||||
}
|
||||
|
||||
public static Rectangle RectangleOffset(this Rectangle rect, int offset)
|
||||
{
|
||||
return new Rectangle(rect.X - offset, rect.Y - offset, rect.Width + offset * 2, rect.Height + offset * 2);
|
||||
}
|
||||
|
||||
public static Rectangle LocationOffset(this Rectangle rect, int offset)
|
||||
{
|
||||
return new Rectangle(rect.X + offset, rect.Y + offset, rect.Width, rect.Height);
|
||||
}
|
||||
|
||||
public static Rectangle LocationOffset(this Rectangle rect, int x, int y)
|
||||
{
|
||||
return new Rectangle(rect.X + x, rect.Y + y, rect.Width, rect.Height);
|
||||
}
|
||||
|
||||
public static Rectangle SizeOffset(this Rectangle rect, int offset)
|
||||
{
|
||||
return rect.SizeOffset(offset, offset);
|
||||
|
|
|
@ -69,31 +69,26 @@ namespace HelpersLib
|
|||
{
|
||||
public static class ImageHelpers
|
||||
{
|
||||
public static Image ResizeImage(Image img, int width, int height)
|
||||
{
|
||||
return ResizeImage(img, 0, 0, width, height);
|
||||
}
|
||||
|
||||
public static Image ResizeImage(Image img, Size size)
|
||||
{
|
||||
return ResizeImage(img, 0, 0, size.Width, size.Height);
|
||||
return ResizeImage(img, size.Width, size.Height);
|
||||
}
|
||||
|
||||
public static Image ResizeImage(Image img, int x, int y, int width, int height)
|
||||
public static Image ResizeImage(Image img, int width, int height)
|
||||
{
|
||||
if (width < 1 || height < 1 || (img.Width == width && img.Height == height))
|
||||
{
|
||||
return img;
|
||||
}
|
||||
|
||||
Bitmap bmp = new Bitmap(x + width, y + height, img.PixelFormat);
|
||||
Bitmap bmp = new Bitmap(width, height, img.PixelFormat);
|
||||
bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
|
||||
|
||||
using (Graphics g = Graphics.FromImage(bmp))
|
||||
using (img)
|
||||
{
|
||||
g.SetHighQuality();
|
||||
g.DrawImage(img, x, y, width, height);
|
||||
g.DrawImage(img, 0, 0, width, height);
|
||||
}
|
||||
|
||||
return bmp;
|
||||
|
@ -111,17 +106,17 @@ public static Image ResizeImageByPercentage(Image img, float percentageWidth, fl
|
|||
return ResizeImage(img, width, height);
|
||||
}
|
||||
|
||||
public static Image ResizeImage(Image img, Size size, bool allowEnlarge, bool centerImage)
|
||||
{
|
||||
return ResizeImage(img, size.Width, size.Height, allowEnlarge, centerImage);
|
||||
}
|
||||
|
||||
public static Image ResizeImage(Image img, int width, int height, bool allowEnlarge, bool centerImage)
|
||||
{
|
||||
return ResizeImage(img, 0, 0, width, height, allowEnlarge, centerImage);
|
||||
return ResizeImage(img, width, height, allowEnlarge, centerImage, Color.Transparent);
|
||||
}
|
||||
|
||||
public static Image ResizeImage(Image img, Rectangle rect, bool allowEnlarge, bool centerImage)
|
||||
{
|
||||
return ResizeImage(img, rect.X, rect.Y, rect.Width, rect.Height, allowEnlarge, centerImage);
|
||||
}
|
||||
|
||||
public static Image ResizeImage(Image img, int x, int y, int width, int height, bool allowEnlarge, bool centerImage)
|
||||
public static Image ResizeImage(Image img, int width, int height, bool allowEnlarge, bool centerImage, Color backColor)
|
||||
{
|
||||
double ratio;
|
||||
int newWidth, newHeight;
|
||||
|
@ -141,8 +136,8 @@ public static Image ResizeImage(Image img, int x, int y, int width, int height,
|
|||
newHeight = (int)(img.Height * ratio);
|
||||
}
|
||||
|
||||
int newX = x;
|
||||
int newY = y;
|
||||
int newX = 0;
|
||||
int newY = 0;
|
||||
|
||||
if (centerImage)
|
||||
{
|
||||
|
@ -150,7 +145,18 @@ public static Image ResizeImage(Image img, int x, int y, int width, int height,
|
|||
newY += (int)((height - (img.Height * ratio)) / 2);
|
||||
}
|
||||
|
||||
return ResizeImage(img, newX, newY, newWidth, newHeight);
|
||||
Bitmap bmp = new Bitmap(width, height, img.PixelFormat);
|
||||
bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
|
||||
|
||||
using (Graphics g = Graphics.FromImage(bmp))
|
||||
using (img)
|
||||
{
|
||||
g.Clear(backColor);
|
||||
g.SetHighQuality();
|
||||
g.DrawImage(img, newX, newY, newWidth, newHeight);
|
||||
}
|
||||
|
||||
return bmp;
|
||||
}
|
||||
|
||||
public static Image CropImage(Image img, Rectangle rect)
|
||||
|
|
|
@ -27,6 +27,20 @@
|
|||
|
||||
namespace HelpersLib
|
||||
{
|
||||
[Flags]
|
||||
public enum AnimateWindowFlags
|
||||
{
|
||||
AW_HOR_POSITIVE = 0x00000001,
|
||||
AW_HOR_NEGATIVE = 0x00000002,
|
||||
AW_VER_POSITIVE = 0x00000004,
|
||||
AW_VER_NEGATIVE = 0x00000008,
|
||||
AW_CENTER = 0x00000010,
|
||||
AW_HIDE = 0x00010000,
|
||||
AW_ACTIVATE = 0x00020000,
|
||||
AW_SLIDE = 0x00040000,
|
||||
AW_BLEND = 0x00080000
|
||||
}
|
||||
|
||||
public enum HRESULT : long
|
||||
{
|
||||
S_FALSE = 1,
|
||||
|
|
|
@ -69,6 +69,9 @@ public static partial class NativeMethods
|
|||
|
||||
#region user32.dll
|
||||
|
||||
[DllImport("user32")]
|
||||
public static extern bool AnimateWindow(IntPtr hwnd, int time, AnimateWindowFlags flags);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool BringWindowToTop(IntPtr hWnd);
|
||||
|
||||
|
|
|
@ -74,10 +74,14 @@ public static Image CaptureWindowTransparent(IntPtr handle)
|
|||
form.BackColor = Color.White;
|
||||
form.FormBorderStyle = FormBorderStyle.None;
|
||||
form.ShowInTaskbar = false;
|
||||
form.StartPosition = FormStartPosition.Manual;
|
||||
form.Location = new Point(rect.X, rect.Y);
|
||||
form.Size = new Size(rect.Width, rect.Height);
|
||||
|
||||
NativeMethods.ShowWindow(form.Handle, (int)WindowShowStyle.ShowNormalNoActivate);
|
||||
NativeMethods.ShowWindow(form.Handle, (int)WindowShowStyle.ShowNoActivate);
|
||||
|
||||
if (!NativeMethods.SetWindowPos(form.Handle, handle, rect.X, rect.Y, rect.Width, rect.Height, SetWindowPosFlags.SWP_NOACTIVATE))
|
||||
if (!NativeMethods.SetWindowPos(form.Handle, handle, 0, 0, 0, 0,
|
||||
SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOACTIVATE))
|
||||
{
|
||||
form.Close();
|
||||
DebugHelper.WriteLine("Transparent capture failed. Reason: SetWindowPos fail.");
|
||||
|
|
|
@ -70,6 +70,7 @@ private void MainForm_HandleCreated(object sender, EventArgs e)
|
|||
private void AfterShownJobs()
|
||||
{
|
||||
this.ShowActivate();
|
||||
ToastForm.ShowAsync("test", ShareXResources.Logo);
|
||||
}
|
||||
|
||||
private void InitControls()
|
||||
|
|
|
@ -208,11 +208,6 @@ private void DoCaptureWork(ScreenCaptureDelegate capture, CaptureType captureTyp
|
|||
Screenshot.AutoHideTaskbar = taskSettings.CaptureSettings.CaptureAutoHideTaskbar;
|
||||
|
||||
img = capture();
|
||||
|
||||
if (img != null && taskSettings.GeneralSettings.PlaySoundAfterCapture)
|
||||
{
|
||||
Helpers.PlaySoundAsync(Resources.CameraSound);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -233,6 +228,11 @@ private void AfterCapture(Image img, CaptureType captureType, TaskSettings taskS
|
|||
{
|
||||
if (img != null)
|
||||
{
|
||||
if (taskSettings.GeneralSettings.PlaySoundAfterCapture)
|
||||
{
|
||||
Helpers.PlaySoundAsync(Resources.CameraSound);
|
||||
}
|
||||
|
||||
if (taskSettings.ImageSettings.ImageEffectOnlyRegionCapture && !IsRegionCapture(captureType))
|
||||
{
|
||||
taskSettings.AfterCaptureJob = taskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AddImageEffects);
|
||||
|
|
4
ShareX/Forms/TaskSettingsForm.Designer.cs
generated
4
ShareX/Forms/TaskSettingsForm.Designer.cs
generated
|
@ -469,7 +469,7 @@ private void InitializeComponent()
|
|||
// chkShowAfterUploadForm
|
||||
//
|
||||
this.chkShowAfterUploadForm.AutoSize = true;
|
||||
this.chkShowAfterUploadForm.Location = new System.Drawing.Point(8, 80);
|
||||
this.chkShowAfterUploadForm.Location = new System.Drawing.Point(8, 104);
|
||||
this.chkShowAfterUploadForm.Name = "chkShowAfterUploadForm";
|
||||
this.chkShowAfterUploadForm.Size = new System.Drawing.Size(271, 17);
|
||||
this.chkShowAfterUploadForm.TabIndex = 18;
|
||||
|
@ -491,7 +491,7 @@ private void InitializeComponent()
|
|||
// cbTrayBalloonTipAfterUpload
|
||||
//
|
||||
this.cbTrayBalloonTipAfterUpload.AutoSize = true;
|
||||
this.cbTrayBalloonTipAfterUpload.Location = new System.Drawing.Point(8, 104);
|
||||
this.cbTrayBalloonTipAfterUpload.Location = new System.Drawing.Point(8, 80);
|
||||
this.cbTrayBalloonTipAfterUpload.Name = "cbTrayBalloonTipAfterUpload";
|
||||
this.cbTrayBalloonTipAfterUpload.Size = new System.Drawing.Size(233, 17);
|
||||
this.cbTrayBalloonTipAfterUpload.TabIndex = 16;
|
||||
|
|
58
ShareX/Forms/ToastForm.Designer.cs
generated
Normal file
58
ShareX/Forms/ToastForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,58 @@
|
|||
namespace ShareX
|
||||
{
|
||||
partial class ToastForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.tDuration = new System.Windows.Forms.Timer(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tDuration
|
||||
//
|
||||
this.tDuration.Tick += new System.EventHandler(this.tDuration_Tick);
|
||||
//
|
||||
// ToastForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(300, 150);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "ToastForm";
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
this.Text = "ToastForm";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Timer tDuration;
|
||||
|
||||
}
|
||||
}
|
87
ShareX/Forms/ToastForm.cs
Normal file
87
ShareX/Forms/ToastForm.cs
Normal file
|
@ -0,0 +1,87 @@
|
|||
#region License Information (GPL v3)
|
||||
|
||||
/*
|
||||
ShareX - A program that allows you to take screenshots and share any file type
|
||||
Copyright (C) 2008-2013 ShareX Developers
|
||||
|
||||
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 2
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using HelpersLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ShareX
|
||||
{
|
||||
public partial class ToastForm : Form
|
||||
{
|
||||
public string ToastText { get; private set; }
|
||||
public Image ToastImage { get; private set; }
|
||||
|
||||
public ToastForm(int duration, string text, Image image)
|
||||
{
|
||||
InitializeComponent();
|
||||
ToastText = text;
|
||||
image = ImageHelpers.ResizeImage(image, ClientRectangle.Size.Offset(-2), true, true);
|
||||
image = ImageHelpers.DrawCheckers(image);
|
||||
ToastImage = image;
|
||||
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
|
||||
Location = new Point(Screen.PrimaryScreen.WorkingArea.Right - Width, Screen.PrimaryScreen.WorkingArea.Bottom - Height);
|
||||
NativeMethods.AnimateWindow(Handle, 1000, AnimateWindowFlags.AW_BLEND);
|
||||
tDuration.Interval = duration;
|
||||
tDuration.Start();
|
||||
}
|
||||
|
||||
private void tDuration_Tick(object sender, EventArgs e)
|
||||
{
|
||||
tDuration.Stop();
|
||||
NativeMethods.AnimateWindow(Handle, 1000, AnimateWindowFlags.AW_HIDE | AnimateWindowFlags.AW_BLEND);
|
||||
Close();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Graphics g = e.Graphics;
|
||||
g.DrawImage(ToastImage, 1, 1, ToastImage.Width, ToastImage.Height);
|
||||
g.DrawRectangleProper(Pens.Black, e.ClipRectangle);
|
||||
}
|
||||
|
||||
public static void ShowAsync(string text, Image image)
|
||||
{
|
||||
Image cloneImage = (Image)image.Clone();
|
||||
|
||||
Thread thread = new Thread(() =>
|
||||
{
|
||||
using (ToastForm toastForm = new ToastForm(5000, text, cloneImage))
|
||||
{
|
||||
toastForm.ShowDialog();
|
||||
}
|
||||
});
|
||||
|
||||
thread.Start();
|
||||
}
|
||||
}
|
||||
}
|
123
ShareX/Forms/ToastForm.resx
Normal file
123
ShareX/Forms/ToastForm.resx
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?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>
|
||||
<metadata name="tDuration.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -140,6 +140,12 @@
|
|||
<Compile Include="Forms\SettingsForm.Designer.cs">
|
||||
<DependentUpon>SettingsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ToastForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ToastForm.Designer.cs">
|
||||
<DependentUpon>ToastForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\UploadTestForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -238,6 +244,9 @@
|
|||
<EmbeddedResource Include="Forms\MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\ToastForm.resx">
|
||||
<DependentUpon>ToastForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\UploadTestForm.resx">
|
||||
<DependentUpon>UploadTestForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -302,14 +302,13 @@ private static void task_UploadCompleted(UploadTask task)
|
|||
|
||||
if (!info.TaskSettings.AdvancedSettings.DisableNotifications)
|
||||
{
|
||||
string balloonTipText = result;
|
||||
|
||||
if (info.TaskSettings.GeneralSettings.ShowAfterUploadForm)
|
||||
if (task.Info.TaskSettings.GeneralSettings.PlaySoundAfterUpload)
|
||||
{
|
||||
AfterUploadForm dlg = new AfterUploadForm(info);
|
||||
NativeMethods.ShowWindow(dlg.Handle, (int)WindowShowStyle.ShowNoActivate);
|
||||
SystemSounds.Exclamation.Play();
|
||||
}
|
||||
|
||||
string balloonTipText = result;
|
||||
|
||||
if (!string.IsNullOrEmpty(info.TaskSettings.AdvancedSettings.BalloonTipContentFormat))
|
||||
{
|
||||
balloonTipText = new UploadInfoParser().Parse(info, info.TaskSettings.AdvancedSettings.BalloonTipContentFormat);
|
||||
|
@ -321,9 +320,10 @@ private static void task_UploadCompleted(UploadTask task)
|
|||
Program.MainForm.niTray.ShowBalloonTip(5000, "ShareX - Task completed", balloonTipText, ToolTipIcon.Info);
|
||||
}
|
||||
|
||||
if (task.Info.TaskSettings.GeneralSettings.PlaySoundAfterUpload)
|
||||
if (info.TaskSettings.GeneralSettings.ShowAfterUploadForm)
|
||||
{
|
||||
SystemSounds.Exclamation.Play();
|
||||
AfterUploadForm dlg = new AfterUploadForm(info);
|
||||
NativeMethods.ShowWindow(dlg.Handle, (int)WindowShowStyle.ShowNoActivate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue