/// <summary> /// Create a popupwindow with NotifyModes settings /// </summary> private void Display(TUR update, NotifyModes mode) { if (update == TUR.Nothing) { return; } int popT = ConfigMgnr.I.NotificationScreenTime; if (update == TUR.Update) { switch (mode) { case NotifyModes.AllBells: CreateWindow(tdh.CurrentStreams, popT); PlaySound(); break; case NotifyModes.NoSound: CreateWindow(tdh.CurrentStreams, popT); break; default: break; } } else { switch (mode) { case NotifyModes.AllBells: case NotifyModes.OnlyFavorites: CreateWindow(tdh.CurrentStreams, tdh.CurrentFavorites.Poptime); PlaySound(tdh.CurrentFavorites.Soundfile); break; case NotifyModes.OnlyDisplayFavorites: case NotifyModes.NoSound: CreateWindow(tdh.CurrentStreams, tdh.CurrentFavorites.Poptime); break; default: break; } } }
public void StartStreaminfoUpdater() { if (updater != null && updater.IsAlive) { updater.Abort(); } updater = new Thread(new ThreadStart(async() => { while (true) { var m = (NotifyModes)ConfigMgnr.I.Mode; if (m != NotifyModes.NoAlerts) { TUR result = await tdh.Update(); Display(result, m); } Thread.Sleep(ConfigMgnr.I.UpdateFrequency * 1000); } })); updater.IsBackground = true; updater.Start(); }