Skip to main content

Application and page reference

Source namespace: WebRadioFM.

App : Application​

Global Silverlight entry point and owner of shared application objects.

Static properties​

PropertyTypeAccessDescription
LastFmLastFMServicepublic get, private setProcess-wide Last.fm client; constructed before frame initialization
RootFramePhoneApplicationFramepublic get, private setRoot navigation frame

Constructor​

App() initializes resources, upgrades settings, creates/loads Last.fm state, applies theme, creates frame/language, and enables debug-only diagnostics.

Lifecycle and navigation handlers​

MemberDescription
Application_LaunchingConnected lifecycle hook; empty
Application_ActivatedConnected lifecycle hook; empty
Application_DeactivatedConnected lifecycle hook; empty
Application_ClosingConnected lifecycle hook; empty
RootFrame_NavigationFailedBreaks only with debugger attached
Application_UnhandledExceptionBreaks only with debugger attached
InitializePhoneApplicationIdempotently creates/configures root frame
CompleteInitializePhoneApplicationAssigns frame to RootVisual after first navigation
CheckForResetNavigationSchedules back-stack clearing after reset
ClearBackStackAfterResetRemoves all back entries after qualifying navigation
InitializeLanguageApplies RESX language and flow direction; rethrows errors

MainPage : PhoneApplicationPage​

Owns local player state and scrobble orchestration.

Private state​

FieldTypePurpose
_playerAudioPlayerServicePlaylist and transport
_progressTimerDispatcherTimerOne-second progress/scrobble polling
_currentScrobbledTrackTrackReference marker preventing duplicates
_playStartTimeDateTimeWall-clock start for Unix scrobble timestamp
_scrobblePendingboolIn-flight/blocked guard
_isLovedboolOptimistic heart state for active track

Constructor and loading​

MemberDescription
MainPage()Initializes controls/timer/player events, loads songs, sets status
LoadPlaylist()Loads library, binds list/count, or shows empty-library message

Player UI handlers​

MemberTriggerBehavior
PlaylistSelectionChangedList selectionPlays selected index and clears selection
PlayPause_ClickApp barStarts index 0 or toggles pause/resume
Next_ClickApp barCalls PlayNext()
Previous_ClickApp barCalls PlayPrevious()
Shuffle_ClickApp barToggles shuffle and icon
TrackInfo_ClickMenuDisplays original metadata/duration
LoveButton_ClickHeartOptimistically toggles and calls love/unlove
Settings_ClickMenuNavigates to Settings
Stats_ClickMenuNavigates to Stats

Playback/scrobble methods​

MemberDescription
ProgressTimerTickPublishes progress, updates slider/time, calls CheckScrobble while playing
OnTrackChanged(Track)Transforms/displays metadata; resets play state; auto-loves; starts timer; sends Now Playing/info
OnPlayStateChanged(bool)Updates play/pause icon; starts timer when playing
SendNowPlaying(Track)Applies edits and calls UpdateNowPlayingAsync if all switches permit
CheckScrobble()Evaluates auth, duplicate, duration, timing, transforms, block rules, and submission
UpdateLoveButton()Chooses accent/subtle brush from optimistic love state
UpdateScrobbleStatus()Maps authentication/settings to base label
OnNavigatedToCalls base and refreshes status

SettingsPage : PhoneApplicationPage​

Maps settings controls to SettingsManager and Last.fm auth methods.

State and setup​

MemberDescription
_currentTokenToken returned during current page lifetime; required by Authorize
SettingsPage()Initializes controls, binds theme names, loads settings
LoadSettings()Copies service/settings/rules into controls and status
SaveApiCredentials()Trims text fields and calls LastFMService.Configure
UpdateAuthStatus()Sets connected text and logout enabled state

Authentication handlers​

MemberDescription
GetToken_ClickValidates credentials, configures service, calls GetTokenAsync, populates token/buttons
Authorize_ClickOpens auth URL with WebBrowserTask; requires _currentToken
Connect_ClickValidates token, calls GetSessionAsync, updates status/migration
Logout_ClickClears session and auth controls

Immediate-setting handlers​

MemberSaved property
ScrobbleEnabledChangedScrobblerEnabled
NowPlayingChangedNowPlayingEnabled
LoveOnStartupChangedLoveOnStartup
DelaySecsChangedinteger ScrobbleDelaySecs plus label
DelayPercentChangedinteger ScrobbleDelayPercent plus label
MinDurationChangedinteger MinTrackDuration plus label
FetchAlbumArtChangedFetchAlbumArt
ThemeSelectionChangedThemeName, then applies theme
DarkModeChangedThemeIsDark, then applies theme

Value-changed events can run during control initialization. Setters save values each time they run.

Multiline-setting handlers​

MemberParsing
SaveBlocked_ClickTrim non-empty lines into List<string>
SaveEdits_ClickParse field:pattern:replacement, discard empty patterns
SaveRegex_ClickSame parser; regex validity is not checked here

Stats_Click navigates to Stats. OnNavigatedTo reloads settings/status and enables auth/connect when token text remains.

StatsPage : PhoneApplicationPage​

State​

_artistsPeriod and _tracksPeriod both default to "7day" and retain last button selection.

Members​

MemberDescription
StatsPage()Initializes and starts all three loads
LoadRecentTracks()Clears if unauthenticated; otherwise requests 20 for session username
LoadTopArtists(string)Stores period and requests 20
LoadTopTracks(string)Stores period and requests 20
Refresh_ClickReloads all with current periods
PeriodArtists_ClickReads Button.Tag as period
PeriodTracks_ClickReads Button.Tag as period
OnNavigatedToReloads recent tracks only

Every Stats error callback is empty.

LocalizedStrings​

Resource bridge with one property:

PropertyTypeDescription
LocalizedResourcesAppResourcesReturns a static generated resource accessor instance