private void FormSwitcher_Deactivate(object sender, EventArgs e) { Hide(); timer1.Enabled = false; VolBar.UnregisterDevice(); RenderType = EDataFlow.eRender; RefreshDevices(false); VolBar.RegisterDevice(RenderType); }
private void HotKeyPressed() { if (Visible) { return; // Let's not make it complicated here... } VolBar.UnregisterDevice(); RenderType = EDataFlow.eRender; RefreshDevices(false); if (EndPoints.DeviceNames.Count == 0) { return; } CurrentDevice = CurrentDevice == EndPoints.DeviceNames.Count - 1 ? 0 : CurrentDevice + 1; EndPoints.SetDefaultDevice(CurrentDevice); if (!Program.stfu) { notifyIcon.ShowBalloonTip(0, "Audio device changed", EndPoints.DeviceNames[CurrentDevice], ToolTipIcon.Info); } }
private void listDevices_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { listDevices.BeginUpdate(); if (!e.IsSelected) { listDevices.LargeImageList.Images[CurrentDevice].Dispose(); listDevices.LargeImageList.Images[CurrentDevice] = DeviceIcons.NormalIcons.Images[CurrentDevice]; } else if (CurrentDevice != e.ItemIndex) { CurrentDevice = e.ItemIndex; EndPoints.SetDefaultDevice(CurrentDevice); VolBar.UnregisterDevice(); VolBar.RegisterDevice(RenderType); listDevices.LargeImageList.Images[CurrentDevice].Dispose(); listDevices.LargeImageList.Images[CurrentDevice] = DeviceIcons.DefaultIcons.Images[CurrentDevice]; } listDevices.EndUpdate(); }
private void notifyIcon1_MouseDown(object sender, MouseEventArgs e) { if (ModifierKeys == Keys.Shift) { Close(); Application.Exit(); return; } VolBar.UnregisterDevice(); RenderType = ModifierKeys.HasFlag(Keys.Control) ? EDataFlow.eCapture : EDataFlow.eRender; if (ModifierKeys.HasFlag(Keys.Alt)) { RefreshDevices(false); VolBar.RegisterDevice(RenderType); VolBar.ChangeMute(); VolBar.UnregisterDevice(); if (RenderType == EDataFlow.eCapture && !Program.stfu) { var mutetxt = String.Format("Device {0}muted", VolBar.Mute ? "" : "un"); notifyIcon.ShowBalloonTip(0, mutetxt, EndPoints.DeviceNames[CurrentDevice], ToolTipIcon.Info); } RenderType = EDataFlow.eRender; RefreshDevices(false); VolBar.RegisterDevice(RenderType); return; } RefreshDevices(true); if (e.Button == MouseButtons.Left) { SetSizes(); } }