C# Class SpotiFire.SessionExtensions

Mostrar archivo Open project: Alxandr/SpotiFire

Public Methods

Method Description
GetAwaiter ( this album ) : TaskAwaiter
GetAwaiter ( this artist ) : TaskAwaiter
GetAwaiter ( this playlist ) : TaskAwaiter
GetAwaiter ( this track ) : TaskAwaiter
Play ( this session, Track track ) : System.Threading.Tasks.Task

A Session extension method that plays a single track and notifies it's completion.

This single extension-method takes care of unloading (in case there are any other tracks playing), loading, and starting playback of a single track. Then, when the track is complete, it signals the task. This enables for easy programming of behaviour such as playing through an entire playlist, or simply playing random songs non-stop. Queueing is also easily implemented with this method. However, this method is not meant to be used in combinations with the ability to change what track you are currently listening to. If your application (one way or another) allows the user (or some AI) to select a new song, whilst there is one playing, you SHOULD not use this method, as it can have un-wanted sideeffects (in the magnitude of your application crashing and dying horribly).

The inner workings of this method is implemented using the Session.EndOfTrack event. Every time you call this method an event-handler is attatched to the Session.EndOfTrack event. This means that if you call this method again (before the song is finished), it will attatch a second event-handler, and then a third, and so forth. This can probably be resolved (one way or another), but for now, this functionality is not supported.

Save ( this image, string location ) : void
Search ( this session, string query, int trackOffset, int trackCount, int albumOffset, int albumCount, int artistOffset, int artistCount, int playlistOffset, int playlistCount, SearchType type ) : Search
SearchAlbums ( this session, string query, int albumOffset, int albumCount ) : Search
SearchArtists ( this session, string query, int artistOffset, int artistCount ) : Search
SearchPlaylist ( this session, string query, int playlistOffset, int playlistCount ) : Search
SearchTracks ( this session, string query, int trackOffset, int trackCount ) : Search

Private Methods

Method Description
Load ( this loadable ) : Task
OnTimerTick ( object state ) : void
SessionExtensions ( ) : System

Method Details

GetAwaiter() public static method

public static GetAwaiter ( this album ) : TaskAwaiter
album this
return TaskAwaiter

GetAwaiter() public static method

public static GetAwaiter ( this artist ) : TaskAwaiter
artist this
return TaskAwaiter

GetAwaiter() public static method

public static GetAwaiter ( this playlist ) : TaskAwaiter
playlist this
return TaskAwaiter

GetAwaiter() public static method

public static GetAwaiter ( this track ) : TaskAwaiter
track this
return TaskAwaiter

Play() public static method

A Session extension method that plays a single track and notifies it's completion.

This single extension-method takes care of unloading (in case there are any other tracks playing), loading, and starting playback of a single track. Then, when the track is complete, it signals the task. This enables for easy programming of behaviour such as playing through an entire playlist, or simply playing random songs non-stop. Queueing is also easily implemented with this method. However, this method is not meant to be used in combinations with the ability to change what track you are currently listening to. If your application (one way or another) allows the user (or some AI) to select a new song, whilst there is one playing, you SHOULD not use this method, as it can have un-wanted sideeffects (in the magnitude of your application crashing and dying horribly).

The inner workings of this method is implemented using the Session.EndOfTrack event. Every time you call this method an event-handler is attatched to the Session.EndOfTrack event. This means that if you call this method again (before the song is finished), it will attatch a second event-handler, and then a third, and so forth. This can probably be resolved (one way or another), but for now, this functionality is not supported.

public static Play ( this session, Track track ) : System.Threading.Tasks.Task
session this The session to act on.
track Track The track.
return System.Threading.Tasks.Task

Save() public static method

public static Save ( this image, string location ) : void
image this
location string
return void

Search() public static method

public static Search ( this session, string query, int trackOffset, int trackCount, int albumOffset, int albumCount, int artistOffset, int artistCount, int playlistOffset, int playlistCount, SearchType type ) : Search
session this
query string
trackOffset int
trackCount int
albumOffset int
albumCount int
artistOffset int
artistCount int
playlistOffset int
playlistCount int
type SearchType
return Search

SearchAlbums() public static method

public static SearchAlbums ( this session, string query, int albumOffset, int albumCount ) : Search
session this
query string
albumOffset int
albumCount int
return Search

SearchArtists() public static method

public static SearchArtists ( this session, string query, int artistOffset, int artistCount ) : Search
session this
query string
artistOffset int
artistCount int
return Search

SearchPlaylist() public static method

public static SearchPlaylist ( this session, string query, int playlistOffset, int playlistCount ) : Search
session this
query string
playlistOffset int
playlistCount int
return Search

SearchTracks() public static method

public static SearchTracks ( this session, string query, int trackOffset, int trackCount ) : Search
session this
query string
trackOffset int
trackCount int
return Search