Skip to content

Commit bb4baa6

Browse files
committed
feat(Mute): plug the service to the notification
1 parent 280428d commit bb4baa6

File tree

8 files changed

+15
-12
lines changed

8 files changed

+15
-12
lines changed

SoundSwitch/Framework/Audio/Microphone/MicrophoneMuteToggler.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ namespace SoundSwitch.Framework.Audio.Microphone
88
public class MicrophoneMuteToggler
99
{
1010
private readonly AudioSwitcher _switcher;
11+
private readonly NotificationManager.NotificationManager _notificationManager;
1112

12-
public MicrophoneMuteToggler(AudioSwitcher switcher)
13+
public MicrophoneMuteToggler(AudioSwitcher switcher, NotificationManager.NotificationManager notificationManager)
1314
{
1415
_switcher = switcher;
16+
_notificationManager = notificationManager;
1517
}
1618

1719
/// <summary>
@@ -33,6 +35,7 @@ public MicrophoneMuteToggler(AudioSwitcher switcher)
3335
{
3436
var newMuteState = !microphone.AudioEndpointVolume.Mute;
3537
device.AudioEndpointVolume.Mute = newMuteState;
38+
_notificationManager.NotifyMuteChanged(device.FriendlyName, newMuteState);
3639
return newMuteState;
3740
}
3841
catch (Exception e)

SoundSwitch/Framework/NotificationManager/Notification/INotification.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@ public interface INotification : IEnumImpl<NotificationTypeEnum>
6666
/// <summary>
6767
/// Notify about the mute state having changed
6868
/// </summary>
69-
void NotifyMuteChanged(string microphoneName, bool newState);
69+
void NotifyMuteChanged(string microphoneName, bool newMuteState);
7070
}
7171
}

SoundSwitch/Framework/NotificationManager/Notification/NotificationBanner.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ public void NotifyProfileChanged(Profile.Profile profile, uint? processId)
6262
_bannerManager.ShowNotification(bannerData);
6363
}
6464

65-
public void NotifyMuteChanged(string microphoneName, bool newState)
65+
public void NotifyMuteChanged(string microphoneName, bool newMuteState)
6666
{
67-
var title = newState ? string.Format(SettingsStrings.notification_microphone_muted, microphoneName) : string.Format(SettingsStrings.notification_microphone_unmuted, microphoneName);
67+
var title = newMuteState ? string.Format(SettingsStrings.notification_microphone_muted, microphoneName) : string.Format(SettingsStrings.notification_microphone_unmuted, microphoneName);
6868

69-
var icon = newState ? Resources.microphone_muted : Resources.microphone_unmuted;
69+
var icon = newMuteState ? Resources.microphone_muted : Resources.microphone_unmuted;
7070

7171
var bannerData = new BannerData
7272
{

SoundSwitch/Framework/NotificationManager/Notification/NotificationCustom.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public void NotifyProfileChanged(Profile.Profile profile, uint? processId)
8282
}
8383
}
8484

85-
public void NotifyMuteChanged(string microphoneName, bool newState)
85+
public void NotifyMuteChanged(string microphoneName, bool newMuteState)
8686
{
8787

8888
}

SoundSwitch/Framework/NotificationManager/Notification/NotificationNone.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void NotifyProfileChanged(Profile.Profile profile, uint? processId)
5050
{
5151
}
5252

53-
public void NotifyMuteChanged(string microphoneName, bool newState)
53+
public void NotifyMuteChanged(string microphoneName, bool newMuteState)
5454
{
5555

5656
}

SoundSwitch/Framework/NotificationManager/Notification/NotificationSound.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public void NotifyProfileChanged(Profile.Profile profile, uint? processId)
8282
}
8383
}
8484

85-
public void NotifyMuteChanged(string microphoneName, bool newState)
85+
public void NotifyMuteChanged(string microphoneName, bool newMuteState)
8686
{
8787

8888
}

SoundSwitch/Framework/NotificationManager/Notification/NotificationWindows.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ public void NotifyProfileChanged(Profile.Profile profile, uint? processId)
7171
Configuration.Icon.ShowBalloonTip(1000, title, text, ToolTipIcon.Info);
7272
}
7373

74-
public void NotifyMuteChanged(string microphoneName, bool newState)
74+
public void NotifyMuteChanged(string microphoneName, bool newMuteState)
7575
{
76-
var title = newState ? string.Format(SettingsStrings.notification_microphone_muted, microphoneName) : string.Format(SettingsStrings.notification_microphone_unmuted, microphoneName);
76+
var title = newMuteState ? string.Format(SettingsStrings.notification_microphone_muted, microphoneName) : string.Format(SettingsStrings.notification_microphone_unmuted, microphoneName);
7777
Configuration.Icon.ShowBalloonTip(1000, title, "", ToolTipIcon.Info);
7878
}
7979
}

SoundSwitch/Framework/NotificationManager/NotificationManager.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ public void NotifyProfileChanged(Profile.Profile profile, uint? processId)
101101
_notification.NotifyProfileChanged(profile, processId);
102102
}
103103

104-
public void NotifyMuteChanged(string microphoneName, bool newState)
104+
public void NotifyMuteChanged(string microphoneName, bool newMuteState)
105105
{
106-
_notification.NotifyMuteChanged(microphoneName, newState);
106+
_notification.NotifyMuteChanged(microphoneName, newMuteState);
107107
}
108108

109109
~NotificationManager()

0 commit comments

Comments
 (0)