Skip to content

Commit

Permalink
Merge pull request #902 from xenolightning/Win10
Browse files Browse the repository at this point in the history
Windows 10 support
  • Loading branch information
xenolightning committed Apr 29, 2015
2 parents d21e7ca + e2368cc commit 9e255d5
Show file tree
Hide file tree
Showing 10 changed files with 907 additions and 848 deletions.
120 changes: 67 additions & 53 deletions FortyOne.AudioSwitcher/AudioSwitcher.Designer.cs

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

32 changes: 27 additions & 5 deletions FortyOne.AudioSwitcher/AudioSwitcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using FortyOne.AudioSwitcher.Helpers;
using FortyOne.AudioSwitcher.HotKeyData;
using FortyOne.AudioSwitcher.Properties;
using Microsoft.Win32;
using Timer = System.Windows.Forms.Timer;

namespace FortyOne.AudioSwitcher
Expand Down Expand Up @@ -590,12 +589,24 @@ private void btnDeleteHotKey_Click(object sender, EventArgs e)
}
}

private void btnClearAllHotKeys_Click(object sender, EventArgs e)
{
HotKeyManager.ClearAll();
RefreshGrid();

MessageBox.Show("Hotkeys Cleared!");
}

private void RefreshGrid()
{
if (InvokeRequired)
{
Invoke(new Action(RefreshGrid));
else
dataGridView1.Refresh();
return;
}

hotKeyBindingSource.ResetBindings(false);
dataGridView1.Refresh();
}

#endregion
Expand Down Expand Up @@ -938,12 +949,23 @@ private void RefreshNotifyIconItems()
RefreshTrayIcon();
}

[DllImport("user32.dll", CharSet = CharSet.Auto)]
extern static bool DestroyIcon(IntPtr handle);

private void RefreshTrayIcon()
{
if (Program.Settings.ShowDPDeviceIconInTray && AudioDeviceManager.Controller.DefaultPlaybackDevice != null)
{
var imageKey = ICON_MAP[AudioDeviceManager.Controller.DefaultPlaybackDevice.Icon];
notifyIcon1.Icon = Icon.FromHandle(((Bitmap)imageList1.Images[imageList1.Images.IndexOfKey(imageKey + ".png")]).GetHicon());
var image = (Bitmap)imageList1.Images[imageList1.Images.IndexOfKey(imageKey + ".png")];
var iconHandle = image.GetHicon();
var icon = Icon.FromHandle(iconHandle);

notifyIcon1.Icon = icon;

//Clean up the old icon, because WinForms creates a copy of the icon for use
icon.Dispose();
DestroyIcon(iconHandle);
}
else
{
Expand Down Expand Up @@ -1224,7 +1246,7 @@ public string AssemblyTitle

public string AssemblyVersion
{
get { return Assembly.GetExecutingAssembly().GetName().Version.ToString(); }
get { return FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion; }
}

public string AssemblyDescription
Expand Down
Loading

0 comments on commit 9e255d5

Please sign in to comment.