void Run() { try { NotifyIconContext.ToolTip("Starting controller"); using (var ctrl = new CoreAudioController()) { audio = ctrl; //NotifyIconContext.Info(1000, "Active", "Forcing all capture levels to " + Level + "%"); NotifyIconContext.Level(ConfigManager.Target); while (true) { UpdateLevel(reportFix: true); Thread.Sleep(1000); } } } catch (ThreadAbortException) { //Silent exit } catch (Exception ex) { NotifyIconContext.Error(60000, ex.GetType().Name, ex.Message); Thread.Sleep(60000); Application.Exit(); } }
void RegisterHotKey(ModifierKeys mod, Keys key) { currentId++; if (!RegisterHotKey(Handle, currentId, (uint)mod, (uint)key)) { NotifyIconContext.Error(10000, "HotKey Error", "Failed to register hotkey " + mod + " + " + key); } }