public void _mic_RefreshMicList(object sender, EventArgs e) { _mic.Dispose(); _mic = new mpAudioController(); _mic.OnVolumeNotification += _mic_OnVolumeNotification; IsMuted = _isMuted; // reassert the muted state on the new set of mics }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); MainWindow = new MainWindow(); MainWindow.Closing += MainWindow_Closing; _notifyIcon = new System.Windows.Forms.NotifyIcon(); _notifyIcon.DoubleClick += (s, args) => ShowMainWindow(); _notifyIcon.Icon = MutePuckApp.Properties.Resources.puck_gray; _notifyIcon.Visible = true; CreateContextMenu(); _mic = new mpAudioController(); _deviceEvents = new DeviceEvents(); _mic.OnVolumeNotification += _mic_OnVolumeNotification; _deviceEvents.DevicesChanged += _mic_RefreshMicList; _deviceEvents.OnDeviceArrived += usb_OnDeviceArrived; _deviceEvents.OnDeviceRemoved += usb_OnDeviceRemoved; _mmDevices = _mic.GetDevices(); string test = ""; foreach (MMDevice m in _mmDevices) { test += m.FriendlyName + "\n"; } //HID USB Stuff m_usb = new HIDDevice(); //m_cmds = new List<Command>(); m_connList = new List <HIDInfoSet>(); m_usb.OnDeviceRemoved += usb_OnDeviceRemoved; m_usb.OnDeviceArrived += usb_OnDeviceArrived; m_usb.OnDataRecieved += usb_OnDataReceived; ScanConnection(); Connect(); }