taskbar notifications only when VS is in background

This commit is contained in:
Vitalii Ganzha 2015-06-12 14:33:43 -07:00
parent de8f212389
commit 392272ff66
1 changed files with 12 additions and 10 deletions

View File

@ -102,6 +102,11 @@
private void HandleEventSafe(SoundPlayer soundPlayer, string messageText) private void HandleEventSafe(SoundPlayer soundPlayer, string messageText)
{ {
if (!ShouldPerformNotificationAction())
{
return;
}
PlaySoundSafe(soundPlayer); PlaySoundSafe(soundPlayer);
ShowNotifyMessage(messageText); ShowNotifyMessage(messageText);
} }
@ -137,20 +142,17 @@
private void PlaySoundSafe(SoundPlayer soundPlayer) private void PlaySoundSafe(SoundPlayer soundPlayer)
{ {
if (ShouldPlaySound()) try
{ {
try soundPlayer.Play();
{ }
soundPlayer.Play(); catch (Exception ex)
} {
catch (Exception ex) ActivityLog.LogError(GetType().FullName, ex.Message);
{
ActivityLog.LogError(GetType().FullName, ex.Message);
}
} }
} }
private bool ShouldPlaySound() private bool ShouldPerformNotificationAction()
{ {
if (!Options.IsBeepOnlyWhenVisualStudioIsInBackground) if (!Options.IsBeepOnlyWhenVisualStudioIsInBackground)
{ {