private SongRequestSkipResult SkipSongInternal(bool shouldSkipAll) { // Page can be loaded to quickly, need that UI will be available. var waiter = CreateWebDriverWaiterForButton(); if (!SkipSongButton.Enabled) { _logger.Info("No songs in playlist available to skip."); return(SongRequestSkipResult.Fail(_settings.NoSongRequestsToSkipMessage)); } // Skip all songs from waiting queue. if (shouldSkipAll) { if (RemoveQueueSongButton.Enabled) { TryToSkipAllSongs(waiter); } else { _logger.Info("No songs in queue available to remove."); } } // Skip current song. waiter.Until(_ => { SkipSongButton.Click(); return(true); }); _logger.Info("Current song was skipped."); return(SongRequestSkipResult.Success()); }
public SongRequestSkipResult Skip(bool shouldSkipAll) { _logger.Info($"Trying to skip song requests (all: {shouldSkipAll.ToString()})."); try { return(SkipSongInternal(shouldSkipAll)); } catch (Exception ex) { _logger.Exception(ex, "Failed to skip song."); return(SongRequestSkipResult.Fail(ex.Message)); } }