fixed #263: Task completed and error sound

This commit is contained in:
Jaex 2014-09-11 11:23:36 +03:00
parent 3197832868
commit a06ba651ca
10 changed files with 61 additions and 48 deletions

View file

@ -905,7 +905,7 @@ private void InitializeComponent()
this.lblDragAndDropTip.BackColor = System.Drawing.Color.White;
this.lblDragAndDropTip.Dock = System.Windows.Forms.DockStyle.Bottom;
this.lblDragAndDropTip.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
this.lblDragAndDropTip.ForeColor = System.Drawing.Color.DarkGray;
this.lblDragAndDropTip.ForeColor = System.Drawing.Color.Silver;
this.lblDragAndDropTip.Location = new System.Drawing.Point(0, 280);
this.lblDragAndDropTip.Name = "lblDragAndDropTip";
this.lblDragAndDropTip.Padding = new System.Windows.Forms.Padding(10, 0, 10, 0);

View file

@ -135,7 +135,7 @@ private void InitControls()
il.Images.Add(Resources.navigation_000_button);
lvUploads.SmallImageList = il;
pbLogo.LoadImage(ColorMatrixManager.Alpha(0.5f).Apply(ShareXResources.Logo));
pbLogo.LoadImage(ColorMatrixManager.Alpha(0.3f).Apply(ShareXResources.Logo));
TaskManager.ListViewControl = lvUploads;
uim = new UploadInfoManager(lvUploads);

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -389,6 +389,15 @@ public class Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
public static System.IO.UnmanagedMemoryStream ErrorSound {
get {
return ResourceManager.GetStream("ErrorSound", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -819,6 +828,15 @@ public class Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
public static System.IO.UnmanagedMemoryStream TaskCompletedSound {
get {
return ResourceManager.GetStream("TaskCompletedSound", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View file

@ -301,9 +301,6 @@
<data name="drive" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\drive.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="CameraSound" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Camera.wav;System.IO.MemoryStream, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="drive_globe" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\drive-globe.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -370,4 +367,13 @@
<data name="film" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\film.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="CameraSound" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\CameraSound.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="ErrorSound" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ErrorSound.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="TaskCompletedSound" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\TaskCompletedSound.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

Binary file not shown.

Binary file not shown.

View file

@ -398,9 +398,6 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="Resources\Camera.wav" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\application-task.png" />
<None Include="Resources\steam.ico" />
@ -491,6 +488,9 @@
<None Include="Resources\layout-select-content.png" />
<None Include="Resources\bin.png" />
<None Include="Resources\film.png" />
<None Include="Resources\TaskCompletedSound.wav" />
<None Include="Resources\ErrorSound.wav" />
<None Include="Resources\CameraSound.wav" />
<Content Include="ShareX_Icon.ico" />
<None Include="Resources\globe--pencil.png" />
<None Include="Resources\camcorder--pencil.png" />

View file

@ -190,42 +190,6 @@ public static string GetImageFilename(TaskSettings taskSettings, Image image)
return filename;
}
public static void ShowResultNotifications(string notificationText, TaskSettings taskSettings, string filePath)
{
if (!taskSettings.AdvancedSettings.DisableNotifications)
{
if (!string.IsNullOrEmpty(notificationText))
{
switch (taskSettings.GeneralSettings.PopUpNotification)
{
case PopUpNotificationType.BalloonTip:
if (Program.MainForm.niTray.Visible)
{
Program.MainForm.niTray.Tag = notificationText;
Program.MainForm.niTray.ShowBalloonTip(5000, "ShareX - Task completed", notificationText, ToolTipIcon.Info);
}
break;
case PopUpNotificationType.ToastNotification:
NotificationFormConfig toastConfig = new NotificationFormConfig()
{
Action = taskSettings.AdvancedSettings.ToastWindowClickAction,
FilePath = filePath,
Text = "ShareX - Task completed\r\n" + notificationText,
URL = notificationText
};
NotificationForm.Show((int)(taskSettings.AdvancedSettings.ToastWindowDuration * 1000), taskSettings.AdvancedSettings.ToastWindowPlacement,
taskSettings.AdvancedSettings.ToastWindowSize, toastConfig);
break;
}
}
if (taskSettings.GeneralSettings.PlaySoundAfterUpload)
{
SystemSounds.Exclamation.Play();
}
}
}
public static bool ShowAfterCaptureForm(TaskSettings taskSettings, Image img = null)
{
if (taskSettings.GeneralSettings.ShowAfterCaptureTasksForm)

View file

@ -25,6 +25,7 @@
using HelpersLib;
using HistoryLib;
using ShareX.Properties;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
@ -263,7 +264,7 @@ private static void task_UploadCompleted(UploadTask task)
if (task.Info.TaskSettings.GeneralSettings.PlaySoundAfterUpload)
{
SystemSounds.Asterisk.Play();
Helpers.PlaySoundAsync(Resources.ErrorSound);
}
}
else
@ -300,7 +301,7 @@ private static void task_UploadCompleted(UploadTask task)
{
if (task.Info.TaskSettings.GeneralSettings.PlaySoundAfterUpload)
{
SystemSounds.Exclamation.Play();
Helpers.PlaySoundAsync(Resources.TaskCompletedSound);
}
if (!string.IsNullOrEmpty(info.TaskSettings.AdvancedSettings.BalloonTipContentFormat))
@ -308,7 +309,31 @@ private static void task_UploadCompleted(UploadTask task)
result = new UploadInfoParser().Parse(info, info.TaskSettings.AdvancedSettings.BalloonTipContentFormat);
}
TaskHelpers.ShowResultNotifications(result, info.TaskSettings, info.FilePath);
if (!string.IsNullOrEmpty(result))
{
switch (info.TaskSettings.GeneralSettings.PopUpNotification)
{
case PopUpNotificationType.BalloonTip:
if (Program.MainForm.niTray.Visible)
{
Program.MainForm.niTray.Tag = result;
Program.MainForm.niTray.ShowBalloonTip(5000, "ShareX - Task completed", result, ToolTipIcon.Info);
}
break;
case PopUpNotificationType.ToastNotification:
NotificationFormConfig toastConfig = new NotificationFormConfig()
{
Action = info.TaskSettings.AdvancedSettings.ToastWindowClickAction,
FilePath = info.FilePath,
Text = "ShareX - Task completed\r\n" + result,
URL = result
};
NotificationForm.Show((int)(info.TaskSettings.AdvancedSettings.ToastWindowDuration * 1000),
info.TaskSettings.AdvancedSettings.ToastWindowPlacement,
info.TaskSettings.AdvancedSettings.ToastWindowSize, toastConfig);
break;
}
}
if (info.TaskSettings.GeneralSettings.ShowAfterUploadForm)
{