Change icon for error, Add option to disable message
This commit is contained in:
parent
610f82311d
commit
ce880f40ce
|
@ -37,6 +37,10 @@ namespace VitaliiGanzha.VsDingExtension
|
||||||
[Description("Show tray notifications for enabled events")]
|
[Description("Show tray notifications for enabled events")]
|
||||||
public bool ShowTrayNotifications { get; set; }
|
public bool ShowTrayNotifications { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Tray notifications message")]
|
||||||
|
[Description("Show message how to disable tray notifications")]
|
||||||
|
public bool ShowTrayDisableMessage { get; set; }
|
||||||
|
|
||||||
public OptionsDialog()
|
public OptionsDialog()
|
||||||
{
|
{
|
||||||
IsBeepOnBreakpointHit = true;
|
IsBeepOnBreakpointHit = true;
|
||||||
|
@ -45,6 +49,7 @@ namespace VitaliiGanzha.VsDingExtension
|
||||||
IsBeepOnTestFailed = false;
|
IsBeepOnTestFailed = false;
|
||||||
ShowTrayNotifications = true;
|
ShowTrayNotifications = true;
|
||||||
IsBeepOnlyWhenVisualStudioIsInBackground = false;
|
IsBeepOnlyWhenVisualStudioIsInBackground = false;
|
||||||
|
ShowTrayDisableMessage = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleEventSafe(SoundPlayer soundPlayer, string messageText)
|
private void HandleEventSafe(SoundPlayer soundPlayer, string messageText)
|
||||||
|
{
|
||||||
|
HandleEventSafe(soundPlayer, messageText, ToolTipIcon.Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleEventSafe(SoundPlayer soundPlayer, string messageText, ToolTipIcon icon)
|
||||||
{
|
{
|
||||||
if (!ShouldPerformNotificationAction())
|
if (!ShouldPerformNotificationAction())
|
||||||
{
|
{
|
||||||
|
@ -109,25 +114,33 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaySoundSafe(soundPlayer);
|
PlaySoundSafe(soundPlayer);
|
||||||
ShowNotifyMessage(messageText);
|
ShowNotifyMessage(messageText, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowNotifyMessage(string messageText)
|
private void ShowNotifyMessage(string messageText)
|
||||||
|
{
|
||||||
|
ShowNotifyMessage(messageText, ToolTipIcon.Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowNotifyMessage(string messageText, ToolTipIcon icon)
|
||||||
{
|
{
|
||||||
if (!_options.ShowTrayNotifications)
|
if (!_options.ShowTrayNotifications)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Options.ShowTrayDisableMessage)
|
||||||
|
{
|
||||||
string autoAppendMessage = System.Environment.NewLine + "You can disable this notification in:" + System.Environment.NewLine + "Tools->Options->Ding->Show tray notifications";
|
string autoAppendMessage = System.Environment.NewLine + "You can disable this notification in:" + System.Environment.NewLine + "Tools->Options->Ding->Show tray notifications";
|
||||||
messageText = string.Format("{0}{1}", messageText, autoAppendMessage);
|
messageText = string.Format("{0}{1}", messageText, autoAppendMessage);
|
||||||
|
}
|
||||||
|
|
||||||
System.Threading.Tasks.Task.Run(async () =>
|
System.Threading.Tasks.Task.Run(async () =>
|
||||||
{
|
{
|
||||||
var tray = new NotifyIcon
|
var tray = new NotifyIcon
|
||||||
{
|
{
|
||||||
Icon = SystemIcons.Application,
|
Icon = SystemIcons.Application,
|
||||||
BalloonTipIcon = ToolTipIcon.Info,
|
BalloonTipIcon = icon,
|
||||||
BalloonTipText = messageText,
|
BalloonTipText = messageText,
|
||||||
BalloonTipTitle = "Visual Studio Ding extension",
|
BalloonTipTitle = "Visual Studio Ding extension",
|
||||||
Visible = true
|
Visible = true
|
||||||
|
@ -171,7 +184,7 @@
|
||||||
var testOperation = ((TestRunRequest)operationStateChangedEventArgs.Operation);
|
var testOperation = ((TestRunRequest)operationStateChangedEventArgs.Operation);
|
||||||
if (testOperation.DominantTestState == TestState.Failed)
|
if (testOperation.DominantTestState == TestState.Failed)
|
||||||
{
|
{
|
||||||
HandleEventSafe(testCompleteSoundPlayer, "Test execution failed!");
|
HandleEventSafe(testCompleteSoundPlayer, "Test execution failed!", ToolTipIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
|
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
|
||||||
<Metadata>
|
<Metadata>
|
||||||
<Identity Id="26ba08d0-0d25-4479-8684-3054dd122876" Version="1.5" Language="en-US" Publisher="Vitalii Ganzha" />
|
<Identity Id="26ba08d0-0d25-4479-8684-3054dd122876" Version="1.6" Language="en-US" Publisher="Vitalii Ganzha" />
|
||||||
<DisplayName>Visual Studio Ding extension</DisplayName>
|
<DisplayName>Visual Studio Ding extension</DisplayName>
|
||||||
<Description xml:space="preserve">This small extension will play notification sounds when following events occur:
|
<Description xml:space="preserve">This small extension will play notification sounds when following events occur:
|
||||||
- Build Complete
|
- Build Complete
|
||||||
|
|
Loading…
Reference in New Issue