C# 클래스 BackgroundTasks.BackgroundAudioTask

Impletements IBackgroundTask to provide an entry point for app code to be run in background. Also takes care of handling UVC and communication channel with foreground
상속: IBackgroundTask
파일 보기 프로젝트 열기: justijndepover/Soundcloudplus

공개 메소드들

메소드 설명
GetMusicFile ( string id ) : Uri
Run ( IBackgroundTaskInstance taskInstance ) : void

The Run method is the entry point of a background task.

비공개 메소드들

메소드 설명
BackgroundMediaPlayer_MessageReceivedFromForeground ( object sender, MediaPlayerDataReceivedEventArgs e ) : void

Raised when a message is recieved from the foreground app

CreatePlaybackList ( IEnumerable songs ) : void

Create a playback list from the list of songs received from the foreground app.

Current_CurrentStateChanged ( MediaPlayer sender, object args ) : void
GetCurrentTrackId ( ) : string
GetTrackId ( MediaPlaybackItem item ) : string
OnCanceled ( IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason ) : void

Handles background task cancellation. Task cancellation happens due to: 1. Another Media app comes into foreground and starts playing music 2. Resource pressure. Your task is consuming more CPU and memory than allowed. In either case, save state so that if foreground app resumes it can know where to start.

PlaybackList_CurrentItemChanged ( MediaPlaybackList sender, CurrentMediaPlaybackItemChangedEventArgs args ) : void

Raised when playlist changes to a new track

SkipToNext ( ) : void

Skip track and update UVC via SMTC

SkipToPrevious ( ) : void

Skip track and update UVC via SMTC

StartPlayback ( ) : void

Start playlist and change UVC state

TaskCompleted ( BackgroundTaskRegistration sender, BackgroundTaskCompletedEventArgs args ) : void

Indicate that the background task is completed.

UpdateToastMessage ( string message ) : void
UpdateUVCOnNewTrack ( MediaPlaybackItem item ) : void

Update Universal Volume Control (UVC) using SystemMediaTransPortControl APIs

smtc_ButtonPressed ( SystemMediaTransportControls sender, SystemMediaTransportControlsButtonPressedEventArgs args ) : void

This function controls the button events from UVC. This code if not run in background process, will not be able to handle button pressed events when app is suspended.

smtc_PropertyChanged ( SystemMediaTransportControls sender, SystemMediaTransportControlsPropertyChangedEventArgs args ) : void

Fires when any SystemMediaTransportControl property is changed by system or user

메소드 상세

GetMusicFile() 공개 메소드

public GetMusicFile ( string id ) : Uri
id string
리턴 Uri

Run() 공개 메소드

The Run method is the entry point of a background task.
public Run ( IBackgroundTaskInstance taskInstance ) : void
taskInstance IBackgroundTaskInstance
리턴 void