Skip to content

Commit

Permalink
Open in CPL now selects the correct ab, and also resembles a windows …
Browse files Browse the repository at this point in the history
…shortcut icon.
  • Loading branch information
xenolightning committed Jan 12, 2016
1 parent 779851c commit 49bb748
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 52 deletions.
60 changes: 30 additions & 30 deletions FortyOne.AudioSwitcher/AudioSwitcher.Designer.cs

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

34 changes: 32 additions & 2 deletions FortyOne.AudioSwitcher/AudioSwitcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Reflection;
Expand Down Expand Up @@ -227,6 +228,23 @@ private void AudioSwitcher_HandleCreated(object sender, EventArgs e)

private void Form_Load()
{
var icon = Icon.ExtractAssociatedIcon(Environment.ExpandEnvironmentVariables("%windir%\\system32\\control.exe"));

if (icon != null)
{
using (var i = new Bitmap(25, 25))
using (var g = Graphics.FromImage(i))
{
g.DrawImage(new Bitmap(icon.ToBitmap(), 25, 25), new Rectangle(0, 0, 25, 25));
g.FillRectangle(Brushes.Black, new Rectangle(0, 13, 12, 12));
g.DrawImage(Resources.shortcut, new Rectangle(1, 14, 10, 10));
openControlPanelPlayback.Image = i.Clone() as Image;
openControlPanelRecording.Image = i.Clone() as Image;
}

icon.Dispose();
}

var dev = AudioDeviceManager.Controller.GetDevice(Program.Settings.StartupPlaybackDeviceID);

if (dev != null)
Expand Down Expand Up @@ -1371,11 +1389,23 @@ private void twitterLink_LinkClicked(object sender, LinkLabelLinkClickedEventArg
Process.Start("https://www.twitter.com/xenolightning");
}

private void btnOpenControlPanel_Click(object sender, EventArgs e)
private void openControlPanelPlayback_Click(object sender, EventArgs e)
{
try
{
Process.Start(new ProcessStartInfo("control.exe", "mmsys.cpl,,0"));
}
catch
{
//Ignored, something went wrong when trying to open CPL
}
}

private void openControlPanelRecording_Click(object sender, EventArgs e)
{
try
{
Process.Start(new ProcessStartInfo("mmsys.cpl", "sounds"));
Process.Start(new ProcessStartInfo("control.exe", "mmsys.cpl,,1"));
}
catch
{
Expand Down
3 changes: 0 additions & 3 deletions FortyOne.AudioSwitcher/AudioSwitcher.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1028,9 +1028,6 @@
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1249, 17</value>
</metadata>
<metadata name="hotKeyBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>545, 17</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAA0AMDAQAAEABABoBgAA1gAAACAgEAABAAQA6AIAAD4HAAAYGBAAAQAEAOgBAAAmCgAAEBAQAAEA
Expand Down
6 changes: 3 additions & 3 deletions FortyOne.AudioSwitcher/FortyOne.AudioSwitcher.GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@
<PropertyGroup />
<ItemGroup>
<Reference Include="AudioSwitcher.AudioApi, Version=3.0.0.209, Culture=neutral, PublicKeyToken=fda5729e2db3a64f, processorArchitecture=MSIL">
<HintPath>..\packages\AudioSwitcher.AudioApi.3.0.0-beta7\lib\net40\AudioSwitcher.AudioApi.dll</HintPath>
<HintPath>..\packages\AudioSwitcher.AudioApi.3.0.0-beta8\lib\net40\AudioSwitcher.AudioApi.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="AudioSwitcher.AudioApi.CoreAudio, Version=3.0.0.209, Culture=neutral, PublicKeyToken=fda5729e2db3a64f, processorArchitecture=MSIL">
<HintPath>..\packages\AudioSwitcher.AudioApi.CoreAudio.3.0.0-beta7\lib\net40\AudioSwitcher.AudioApi.CoreAudio.dll</HintPath>
<HintPath>..\packages\AudioSwitcher.AudioApi.CoreAudio.3.0.0-beta8\lib\net40\AudioSwitcher.AudioApi.CoreAudio.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="fastjson, Version=2.1.0.0, Culture=neutral, PublicKeyToken=6b75a806b86095cd, processorArchitecture=MSIL">
Expand Down Expand Up @@ -202,7 +202,7 @@
<Content Include="Icons\c.png" />
<Content Include="Icons\e.png" />
<Content Include="Icons\f.png" />
<Content Include="Resources\external-link.png" />
<Content Include="Resources\shortcut.png" />
<None Include="Icons\github.png" />
<None Include="Icons\twitter.png" />
<Content Include="Resources\112_Plus_Green_16x16_72.png" />
Expand Down
20 changes: 10 additions & 10 deletions FortyOne.AudioSwitcher/Properties/Resources.Designer.cs

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

4 changes: 2 additions & 2 deletions FortyOne.AudioSwitcher/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
<data name="c" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\c.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="external-link" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\external-link.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="shortcut" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\shortcut.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file removed FortyOne.AudioSwitcher/Resources/external-link.png
Binary file not shown.
Binary file added FortyOne.AudioSwitcher/Resources/shortcut.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions FortyOne.AudioSwitcher/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AudioSwitcher.AudioApi" version="3.0.0-beta7" targetFramework="net40-client" />
<package id="AudioSwitcher.AudioApi.CoreAudio" version="3.0.0-beta7" targetFramework="net40-client" />
<package id="AudioSwitcher.AudioApi" version="3.0.0-beta8" targetFramework="net40-client" />
<package id="AudioSwitcher.AudioApi.CoreAudio" version="3.0.0-beta8" targetFramework="net40-client" />
<package id="fastJSON" version="2.1.14.0" targetFramework="net40-Client" />
<package id="ilmerge" version="2.14.1208" targetFramework="net40-Client" />
<package id="LibZ.Bootstrap" version="1.2.0.0" targetFramework="net40-client" />
Expand Down

0 comments on commit 49bb748

Please sign in to comment.