Skip to content

Commit

Permalink
Adds a green arrow new to the current DefaultDevice in the TrayList.
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoine Aflalo committed Aug 20, 2015
1 parent 65a2baf commit fa0610b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
10 changes: 10 additions & 0 deletions SoundSwitch/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions SoundSwitch/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="GreenCheck" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\GreenCheck.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Help" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\help.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Expand Down
Binary file added SoundSwitch/Resources/GreenCheck.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SoundSwitch/SoundSwitch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
<Content Include="Resources\arrow_switch.ico" />
<Content Include="Resources\arrow_switch.png" />
<Content Include="Resources\explanation.png" />
<None Include="Resources\GreenCheck.png" />
<Content Include="Resources\help.png" />
<Content Include="Resources\setting_tools.png" />
</ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion SoundSwitch/Util/ToolStripDeviceItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
using System;
using System.Windows.Forms;
using AudioEndPointControllerWrapper;
using SoundSwitch.Properties;

namespace SoundSwitch.Util
{
internal class ToolStripDeviceItem : ToolStripMenuItem
{
public ToolStripDeviceItem(EventHandler onClick, AudioDeviceWrapper audioDevice)
: base(audioDevice.FriendlyName, null, onClick)
: base(audioDevice.FriendlyName, audioDevice.IsDefault ? Resources.GreenCheck : null, onClick)
{
AudioDevice = audioDevice;
}
Expand Down
9 changes: 8 additions & 1 deletion SoundSwitch/Util/TrayIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ private void SetEventHandlers()
{
_main.ErrorTriggered += (sender, exception) => ShowError(exception.Exception.Message);
_main.AudioDeviceChanged +=
(sender, audioDeviceWrapper) => ShowAudioChanged(audioDeviceWrapper.AudioDevice.FriendlyName);
(sender, audioDeviceWrapper) =>
{
ShowAudioChanged(audioDeviceWrapper.AudioDevice.FriendlyName);
foreach (ToolStripDeviceItem item in _selectionMenu.Items)
{
item.Image = item.AudioDevice.FriendlyName == audioDeviceWrapper.AudioDevice.FriendlyName ? Resources.GreenCheck : null;
}
};
_main.SelectedDeviceChanged += (sender, changed) =>
{
UpdateAvailableDeviceList();
Expand Down

0 comments on commit fa0610b

Please sign in to comment.