<?xml version="1.0" encoding="utf-16"?>
<UIX xmlns="http://schemas.microsoft.com/2007/uix" xmlns:iris="assembly://UIX/Microsoft.Iris" xmlns:animations="res://ZuneShellResources!Animations.uix" xmlns:style="res://UIXControls!Style.uix" xmlns:zuneUI="assembly://ZuneShell/ZuneUI" xmlns:styles="res://ZuneShellResources!Styles.uix" xmlns:button="res://UIXControls!Button.uix" xmlns:contentList="res://UIXControls!ContentList.uix" xmlns:spreadSheet="res://UIXControls!SpreadSheet.uix" xmlns:system="assembly://System.Private.CoreLib/System" xmlns:zuneDBApi="assembly://ZuneDBApi/" xmlns:label="res://UIXControls!Label.uix" xmlns:util="assembly://ZuneDBApi/Microsoft.Zune.Util" xmlns:schema1="res://ZuneShellResources!SocialData.schema.xml" xmlns:schema2="res://ZuneMarketplaceResources!MarketplaceData.schema.xml" xmlns:wizard="res://ZuneShellResources!Wizard.uix" xmlns:service="assembly://ZuneDBApi/Microsoft.Zune.Service" xmlns:collections="assembly://System.Private.CoreLib/System.Collections" xmlns:pageStack="res://ZuneShellResources!PageStack.uix" xmlns:spreadSheetCells="res://ZuneShellResources!SpreadSheetCells.uix" xmlns:tracksPanelColumns="res://ZuneShellResources!TracksPanelColumns.uix" xmlns:contextMenu="res://UIXControls!ContextMenu.uix" xmlns:socialComposer="res://ZuneShellResources!SocialComposer.uix" xmlns:mixManager="res://ZuneShellResources!MixManager.uix" xmlns:checkbox="res://UIXControls!Checkbox.uix" xmlns:wizardControls="res://ZuneShellResources!WizardControls.uix" xmlns:signInDialog="res://ZuneShellResources!SignInDialog.uix" xmlns:moreInfoActions="res://ZuneShellResources!MoreInfoActions.uix" xmlns:nowPlayingLand="res://ZuneShellResources!NowPlayingLand.uix" xmlns:nowPlayingMusicBackground="res://ZuneShellResources!NowPlayingMusicBackground.uix" xmlns:libraryDialogs="res://ZuneShellResources!LibraryDialogs.uix" xmlns:playlistDialog="res://ZuneShellResources!PlaylistDialog.uix" xmlns:popup="res://UIXControls!Popup.uix" xmlns:miniMode="res://ZuneShellResources!MiniMode.uix" xmlns:nonClientControls="res://UIXControls!NonClientControls.uix" xmlns:configuration="assembly://ZuneDBApi/Microsoft.Zune.Configuration" xmlns:util1="assembly://ZuneShell/Microsoft.Zune.Util" xmlns:imageSelector="res://ZuneMarketplaceResources!ImageSelector.uix" xmlns:shell="assembly://ZuneShell/Microsoft.Zune.Shell" xmlns:utility="res://ZuneShellResources!Utility.uix" xmlns:frame="res://ZuneShellResources!Frame.uix" xmlns:libraryContextMenu="res://ZuneShellResources!LibraryContextMenu.uix">
  <Class Name="NowPlayingPersistentState" Shared="true">
    <Properties>
      <Boolean Name="ShowZunePassTracks" Boolean="true" />
    </Properties>
    <Locals>
      <zuneUI:TransportControls Name="TransportControls" TransportControls="{zuneUI:TransportControls.Instance}" />
      <zuneUI:SignIn Name="SignIn" SignIn="{zuneUI:SignIn.Instance}" />
    </Locals>
    <Scripts>
      <Script><![CDATA[
[DeclareTrigger(TransportControls.CurrentPlaylist), DeclareTrigger(SignIn.SignedInWithSubscription)]
bool playMarketplaceTracks = true;
if (this.IsQuickMix())
{
    if (#SignIn.SignedInWithSubscription #)
    {
        playMarketplaceTracks = ShowZunePassTracks;
    }
    else
    {
        playMarketplaceTracks = false;
    }

    if (!ShowZunePassTracks)
    {
        if (!TransportControls.CurrentTrack.IsInVisibleCollection)
        {
            TransportControls.Forward.Invoke();
        }
    }
}

TransportControls.DontPlayMarketplaceTracks = !playMarketplaceTracks;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TransportControls.CurrentPlaylist)]
if (this.IsQuickMix() && TransportControls.Instance.QuickMixType == zuneDBApi:EQuickMixType.eQuickMixTypeRadio)
{
    ShowZunePassTracks = true;
}
]]></Script>
    </Scripts>
    <Methods><![CDATA[
bool IsQuickMix()
{
    return TransportControls.Instance.QuickMixSession != null;
}
]]></Methods>
  </Class>
  <UI Name="NowPlayingLand" Base="pageStack:PageBase">
    <Properties>
      <zuneUI:PlaybackPage Name="Page" PlaybackPage="$Required" />
    </Properties>
    <Locals>
      <Window Name="Window" />
      <zuneUI:TransportControls Name="TransportControls" TransportControls="{zuneUI:TransportControls.Instance}" />
      <SelectionManager Name="SelectionManager" />
      <contentList:NavigateIntoIndexRequest Name="NavigateIntoArgs" />
      <nowPlayingLand:NowPlayingListModel Name="NowPlayingListModel" Page="{Page}" />
      <iris:Command Name="SaveAsPlaylist" Description="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_NOW_PLAYING_SAVEASPLAYLIST)}" />
      <iris:BooleanChoice Name="ShowMPContent" Description="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_NOWPLAYING_FILTER_ZUNEPASS)}" Value="true" />
      <iris:Command Name="Play" Description="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_PLAY_MENUITEM)}" />
      <zuneUI:MenuItemCommand Name="Remove" Description="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_NOW_PLAYING_REMOVE)}" />
      <zuneUI:MenuItemCommand Name="AddToPlaylist" Description="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_MENUITEM_ADD_TO_DIALOG)}" />
      <zuneUI:MenuItemCommand Name="AddToBurnList" Description="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_MENUITEM_ADD_TO_BURNLIST)}" />
      <zuneUI:MenuItemCommand Name="Properties" Description="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_LIBRARY_PROPERTIES_MENU_ITEM)}" />
      <zuneUI:RateCommand Name="Rate" />
      <zuneUI:MenuItemCommand Name="FindInCollection" Description="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_FIND_IN_COLLECTION)}" />
      <zuneUI:FeatureMenuItemCommand Name="TellAFriend" Features="eSocial" Description="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_TELL_A_FRIEND_MENUITEM)}" />
      <zuneUI:FeatureMenuItemCommand Name="AddToFavorites" Features="eSocial" Description="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_ADD_TO_FAVORITES_MENUITEM)}" />
      <moreInfoActions:TrackMoreInfoActions Name="MoreInfoActions" />
      <socialComposer:MessageComposer Name="MessageComposer" MessageComposer="{null}" />
      <socialComposer:AddToFavoritesComposer Name="AddToFavoritesComposer" AddToFavoritesComposer="{null}" />
      <libraryContextMenu:LibraryContextMenu Name="ContextMenu">
        <Options>
          <iris:Command Command="{Play}" />
          <contextMenu:MenuDivider />
          <zuneUI:MenuItemCommand MenuItemCommand="{AddToPlaylist}" />
          <zuneUI:MenuItemCommand MenuItemCommand="{AddToBurnList}" />
          <zuneUI:FeatureMenuItemCommand FeatureMenuItemCommand="{AddToFavorites}" />
          <contextMenu:MenuDivider />
          <zuneUI:RateCommand RateCommand="{Rate}" />
          <zuneUI:MenuItemCommand MenuItemCommand="{Remove}" />
          <contextMenu:MenuDivider />
          <zuneUI:MenuItemCommand MenuItemCommand="{Properties}" />
          <contextMenu:MenuDivider />
          <zuneUI:MenuItemCommand MenuItemCommand="{FindInCollection}" />
          <zuneUI:MenuItemCommand MenuItemCommand="{MoreInfoActions.PrimaryMenuCommand}" />
          <zuneUI:FeatureMenuItemCommand FeatureMenuItemCommand="{TellAFriend}" />
        </Options>
      </libraryContextMenu:LibraryContextMenu>
      <libraryDialogs:PropertiesDialog Name="PropertiesDialog" PropertiesDialog="{null}" />
      <nonClientControls:WindowState Name="WndState" />
      <Boolean Name="AllowMusicControls" />
      <Boolean Name="PlayingMusic" />
      <Inset Name="TracksListMarginsForMusic" Inset="0, 0, 0, -10" />
      <Inset Name="TracksListMarginsForNonMusic" Inset="0" />
      <Inset Name="TrackListTriangleMarginsWithShuffle" Inset="0, 0, 179, 0" />
      <Inset Name="TrackListTriangleMarginsWithoutShuffle" Inset="0, 0, 153, 0" />
      <playlistDialog:CreatePlaylistDialog Name="SaveAsPlaylistDialog" CreatePlaylistDialog="{null}" />
      <playlistDialog:AddToPlaylistDialog Name="AddToPlaylistDialog" AddToPlaylistDialog="{null}" />
      <zuneUI:PlaybackTrack Name="CurrentTrack" PlaybackTrack="{null}" />
      <Image Name="RadioIcon" Image="res://ZuneShellResources!NowPlaying.RadioIcon.png" />
      <Boolean Name="TracksListNeedsDisposing" Boolean="false" />
      <Boolean Name="ForceInitialShow" Boolean="false" />
      <Timer Name="InitialShowTimer" Interval="23000" AutoRepeat="false" Enabled="false" />
      <zuneUI:SignIn Name="SignIn" SignIn="{zuneUI:SignIn.Instance}" />
      <mixManager:CurrentlyPlayingTrackMixAvailability Name="CurrentlyPlayingTrackMixAvailability" />
      <miniMode:MiniMode Name="MiniMode" />
    </Locals>
    <Input>
      <KeyHandler Key="Delete" DisallowedModifiers="Ctrl, Shift, Alt" HandlerStage="Bubbled" Command="{Remove}" />
      <KeyHandler Name="ZoomShortcutHandler" Key="Z" RequiredModifiers="Ctrl" DisallowedModifiers="Shift, Alt, Windows" HandlerStage="Direct" Handle="true" />
      <KeyHandler Name="RightKeyHandler" Key="Right" HandlerStage="Direct, Bubbled" Repeat="true" />
      <KeyHandler Name="LeftKeyHandler" Key="Left" HandlerStage="Direct, Bubbled" Repeat="true" />
      <KeyHandler Name="EnterKeyHandler" Key="Enter" HandlerStage="Direct, Bubbled" />
      <MouseWheelHandler Name="WheelHandler" HandlerStage="Bubbled" />
      <ClickHandler Name="LeftClickHandler" ClickType="LeftMouse" HandlerStage="Bubbled" />
    </Input>
    <Scripts>
      <Script><![CDATA[
shell:ZuneApplication.PageLoadComplete();
UI.CreateInterestOnFocus = false;
ShowMPContent.Value = nowPlayingLand:NowPlayingPersistentState.ShowZunePassTracks;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(zuneUI:TransportControls.Instance.CurrentTrack)]
CurrentTrack = #zuneUI:TransportControls.Instance.CurrentTrack #;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TransportControls.Playing), DeclareTrigger(TransportControls.PlayingVideo), DeclareTrigger(Page.SlideShowState.Play), DeclareTrigger(MiniMode.InCompactMode), DeclareTrigger(MiniMode.InPopupMode), DeclareTrigger(Window.WindowState)]
object playingVideo = #TransportControls.Playing # && #TransportControls.PlayingVideo #;
object playingSlideShow = Page is zuneUI:SlideshowLand && ((zuneUI:SlideshowLand)Page).SlideShowState.Play;
object minimode = #MiniMode.InCompactMode # || #MiniMode.InPopupMode #;
object windowVisible = #Window.WindowState # == WindowState.Normal || Window.WindowState == WindowState.Maximized;
Window.PreventInterruption = playingVideo || playingSlideShow && !minimode && windowVisible;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TransportControls.PlayingVideo)]
if (#TransportControls.PlayingVideo #)
{
    shell:ViewTimeLogger.Instance.ViewChanged(util:SQMDataId.NowPlayingVideoViewTime);
}
else
{
    shell:ViewTimeLogger.Instance.ViewChanged(util:SQMDataId.NowPlayingMusicViewTime);
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TransportControls.PlayingVideo)]
bool playingVideo = #TransportControls.PlayingVideo #;
if (Page.TransportControlStyle != zuneUI:TransportControlStyle.Photo)
{
    if (playingVideo)
    {
        Page.TransportControlStyle = zuneUI:TransportControlStyle.Video;
    }
    else
    {
        Page.TransportControlStyle = zuneUI:TransportControlStyle.Music;
    }
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(Page.ActiveTransportControlStyle)]
AllowMusicControls = #Page.ActiveTransportControlStyle # == zuneUI:TransportControlStyle.Music;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TransportControls.CurrentPlaylist)]
if (TracksList.Content != null && TracksListNeedsDisposing)
{
    UI.DisposeOwnedObject(TracksList.Content);
    TracksListNeedsDisposing = false;
}

TracksList.Content = null;
ShowMPContentCheckBox.Visible = (this.IsQuickMix() && util:FeatureEnablement.IsFeatureEnabled(zuneDBApi:Features.eSubscription)) && (TransportControls.Instance.QuickMixType != zuneDBApi:EQuickMixType.eQuickMixTypeRadio);
Remove.Available = !this.IsQuickMix();
TracksList.CanReorder = !this.IsQuickMix();
TracksList.CanDrag = !this.IsQuickMix();
if (!this.IsQuickMix())
{
    TracksList.Content = #TransportControls.CurrentPlaylist #;
    ShowMPContentCheckBox.Visible = false;
    TransportControls.DontPlayMarketplaceTracks = false;
}
else
{
    ForceInitialShow = true;
    InitialShowTimer.Enabled = true;
    TracksList.Content = new iris:ArrayListDataSet();
    TracksListNeedsDisposing = true;
    if (TransportControls.CurrentPlaylist != null)
    {
        foreach (zuneUI:PlaybackTrack track in TransportControls.CurrentPlaylist)
        {
            if (ShowMPContent.Value || track.IsInVisibleCollection)
            {
                TracksList.Content.Add(track);
            }
        }
    }
}

PlayingMusic = false;
if (!List.IsNullOrEmpty(TracksList.Content))
{
    PlayingMusic = ((zuneUI:PlaybackTrack)TracksList.Content[0]).IsMusic;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(ShowMPContent.Value)]
nowPlayingLand:NowPlayingPersistentState.ShowZunePassTracks = #ShowMPContent.Value #;
]]></Script>
      <Script><![CDATA[
SaveAsPlaylistButton.Visible = PlayingMusic;
AddToPlaylist.Hidden = !PlayingMusic;
AddToBurnList.Hidden = !PlayingMusic;
if (PlayingMusic)
{
    TracksList.Margins = TracksListMarginsForMusic;
}
else
{
    TracksList.Margins = TracksListMarginsForNonMusic;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TransportControls.CurrentTrackIndex)]
if (!UI.KeyFocus || UI.KeyFocus && nonClientControls:WindowState.KeysActive)
{
    NavigateIntoArgs.Index = #TransportControls.CurrentTrackIndex #;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(WndState.InputActive), DeclareTrigger(Page.OverlayUI), DeclareTrigger(TransportControls.ShowNowPlayingList.Value)]
TracksListInnerContainer.Visible = #TransportControls.ShowNowPlayingList #.Value # && Page is zuneUI:SlideshowLand && Page is zuneUI:SlideshowLand || Page.TransportControlStyle == zuneUI:TransportControlStyle.Music;
TrackListBackground.Visible = TracksListInnerContainer.Visible;
if (TrackListBackground.Visible)
{
    NavigateIntoArgs.Index = TransportControls.CurrentTrackIndex;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TracksListInnerContainer.Visible), DeclareTrigger(HeadingLabel.Content), DeclareTrigger(Page.TransportControlStyle)]
HeadingPanel.Visible = #TracksListInnerContainer.Visible # && !string.IsNullOrEmpty(#HeadingLabel.Content #);
if (HeadingPanel.Visible)
{
    TrackListTriangle.Visible = #Page.TransportControlStyle # == zuneUI:TransportControlStyle.Music;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TransportControls.HasPlaylist), DeclareTrigger(TransportControls.PlaylistSupportsShuffle)]
if (!#TransportControls.HasPlaylist # || #TransportControls.PlaylistSupportsShuffle #)
{
    TrackListTriangle.Margins = TrackListTriangleMarginsWithShuffle;
}
else
{
    TrackListTriangle.Margins = TrackListTriangleMarginsWithoutShuffle;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TransportControls.CurrentPlaylist)]
HeadingLabel.Content = TransportControls.Instance.QuickMixTitle;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(SaveAsPlaylistButton.Visible), DeclareTrigger(ShowMPContentCheckBox.Visible)]
ActionContainer.Visible = #SaveAsPlaylistButton.Visible # || #ShowMPContentCheckBox.Visible #;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(CurrentlyPlayingTrackMixAvailability.Available)]
zuneUI:PlaybackTrack track = zuneUI:TransportControls.Instance.CurrentTrack;
if ((Page.ShowMixOnEntry && track != null) && (Page.InitialPlaybackID == track.PlaybackID) && #CurrentlyPlayingTrackMixAvailability.Available #)
{
    CurrentlyPlayingTrackMixAvailability.UpdateMixSeed.Invoke();
    zuneUI:ZuneShell.DefaultInstance.CurrentPage.OverlayUI = mixManager:MixLayerManager.MixUI;
}
]]></Script>
      <Script><![CDATA[
[FinalEvaluate]
Window.PreventInterruption = false;
]]></Script>
      <Script><![CDATA[
[FinalEvaluate]
shell:ViewTimeLogger.Instance.ViewChanged(util:SQMDataId.Invalid);
]]></Script>
      <Script><![CDATA[
[FinalEvaluate]
Page.ShowMixOnEntry = false;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(ZoomShortcutHandler.Invoked)]
TransportControls.ZoomScaleFactor = TransportControls.ZoomScaleFactor + 1 % 4;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(InitialShowTimer.Tick)]
ForceInitialShow = false;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(Play.Invoked)]
if (SelectionManager.Count > 0)
{
    if (SelectionManager.Count == 1)
    {
        TransportControls.StartPlayingAt(((zuneUI:PlaybackTrack)SelectionManager.SelectedItem));
    }
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(AddToPlaylist.Invoked)]
if (SelectionManager.Count != 0)
{
    if (AddToPlaylistDialog == null)
    {
        // Unsupported instruction: INIT 649
        ;
        AddToPlaylistDialog = new playlistDialog:AddToPlaylistDialog();
    }

    AddToPlaylistDialog.DragItems = SelectionManager.SelectedItems;
    AddToPlaylistDialog.Show();
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(AddToBurnList.Invoked)]
zuneUI:CDAccess.Instance.AddToBurnList(SelectionManager.SelectedItems);
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(LeftKeyHandler.Invoked), DeclareTrigger(WheelHandler.UpInvoked)]
if (Page is zuneUI:SlideshowLand)
{
    ((zuneUI:SlideshowLand)Page).MoveToPreviousSlide();
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(LeftClickHandler.Invoked), DeclareTrigger(EnterKeyHandler.Invoked), DeclareTrigger(RightKeyHandler.Invoked), DeclareTrigger(WheelHandler.DownInvoked)]
if (Page is zuneUI:SlideshowLand)
{
    ((zuneUI:SlideshowLand)Page).MoveToNextSlide();
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(ContextMenu.IsOpening)]
if (#ContextMenu.IsOpening #)
{
    int selectionCount = SelectionManager.Count;
    Remove.Hidden = selectionCount == 0 || this.IsQuickMix();
    object selectedOne = selectionCount == 1;
    Play.Available = selectedOne;
    zuneUI:PlaybackTrack track = (zuneUI:PlaybackTrack)SelectionManager.SelectedItem;
    object selectedOneLibraryItem = selectedOne && track is zuneUI:LibraryPlaybackTrack;
    object selectedOneLibraryTrack = new bool ();
    bool isInCollection = false;
    bool isInHiddenCollection = false;
    if (selectedOneLibraryItem)
    {
        zuneUI:LibraryPlaybackTrack libraryTrack = (zuneUI:LibraryPlaybackTrack)track;
        selectedOneLibraryTrack = libraryTrack.MediaType == zuneUI:MediaType.Track;
        isInCollection = selectedOneLibraryTrack && libraryTrack.IsInCollection;
        if (!zuneUI:GuidHelper.IsEmpty(track.ZuneMediaId))
        {
            isInHiddenCollection = shell:ZuneApplication.Service.InHiddenCollection(track.ZuneMediaId, service:EContentType.MusicTrack);
        }
    }

    Properties.Hidden = !selectedOneLibraryTrack;
    Rate.Hidden = !track != null && track.CanRate;
    FindInCollection.Hidden = !isInCollection || isInHiddenCollection;
    MoreInfoActions.ZuneMediaId = zuneUI:GuidHelper.Empty;
    TellAFriend.Hidden = true;
    if ((PlayingMusic && selectedOne) && (track != null) && !zuneUI:GuidHelper.IsEmpty(track.ZuneMediaId))
    {
        if (track.MediaType == zuneUI:MediaType.Track)
        {
            MoreInfoActions.ZuneMediaId = track.ZuneMediaId;
            TellAFriend.Hidden = !zuneUI:Attachment.CanCreateAttachment(track);
        }
    }

    AddToBurnList.Available = !zuneUI:CDAccess.Instance.IsBurning;
    bool canAddToFavorites = false;
    if (PlayingMusic)
    {
        foreach (zuneUI:PlaybackTrack playbackTrack in SelectionManager.SelectedItems)
        {
            canAddToFavorites = canAddToFavorites || !zuneUI:GuidHelper.IsEmpty(playbackTrack.ZuneMediaId);
        }
    }

    AddToFavorites.Hidden = !canAddToFavorites;
}
else
{
    Play.Available = true;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(Remove.Invoked)]
if (!this.IsQuickMix())
{
    TransportControls.RemoveFromNowPlaying(SelectionManager.SelectedIndices);
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(Properties.Invoked)]
if (PropertiesDialog == null)
{
    // Unsupported instruction: INIT 636
    ;
    PropertiesDialog = new libraryDialogs:PropertiesDialog();
}

if (SelectionManager.SelectedItem is zuneUI:LibraryPlaybackTrack)
{
    zuneUI:LibraryPlaybackTrack track = (zuneUI:LibraryPlaybackTrack)SelectionManager.SelectedItem;
    PropertiesDialog.LibraryId = track.MediaId;
    PropertiesDialog.ItemType = track.MediaType;
    PropertiesDialog.Show();
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(Rate.Rating)]
foreach (zuneUI:PlaybackTrack track in SelectionManager.SelectedItems)
{
    track.UserRating = #Rate.Rating #;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(SaveAsPlaylist.Invoked)]
if (SaveAsPlaylistDialog == null)
{
    // Unsupported instruction: INIT 652
    ;
    SaveAsPlaylistDialog = new playlistDialog:CreatePlaylistDialog();
    SaveAsPlaylistDialog.BaseDefaultPlaylistName = zuneUI:Shell.LoadString(zuneUI:StringId.IDS_NEW_NOWPLAYING_PLAYLIST_NAME);
}

if (TransportControls.Instance.QuickMixSession != null)
{
    if (TransportControls.Instance.QuickMixType != zuneDBApi:EQuickMixType.eQuickMixTypeRadio)
    {
        if (TransportControls.DontPlayMarketplaceTracks)
        {
        }
        else
        {
        }

        object mixType = zuneDBApi:EQuickMixType.eQuickMixTypeMixed;
        TransportControls.Instance.QuickMixSession.SetQuickMixType(mixType);
    }

    SaveAsPlaylistDialog.QuickMixSession = TransportControls.Instance.QuickMixSession;
}
else
{
    SaveAsPlaylistDialog.DragItems = TracksList.Content;
}

SaveAsPlaylistDialog.Show();
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(FindInCollection.Invoked)]
if (SelectionManager.SelectedItem is zuneUI:LibraryPlaybackTrack)
{
    zuneUI:LibraryPlaybackTrack track = (zuneUI:LibraryPlaybackTrack)SelectionManager.SelectedItem;
    track.FindInCollection();
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TransportControls.PlaybackStopped)]
if (Page.ExitOnPlaybackStopped)
{
    if (zuneUI:ZuneShell.DefaultInstance.CanNavigateBack)
    {
        zuneUI:ZuneShell.DefaultInstance.NavigateBack();
    }
    else
    {
        zuneUI:Shell.NavigateToHomePage();
    }
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TellAFriend.Invoked)]
Null attachment = null;
if (SelectionManager.SelectedItem is zuneUI:PlaybackTrack)
{
    zuneUI:PlaybackTrack track = (zuneUI:PlaybackTrack)SelectionManager.SelectedItem;
    attachment = zuneUI:Attachment.CreateAttachment(track.ZuneMediaId, track.MediaType);
}

if (attachment != null)
{
    if (MessageComposer == null)
    {
        // Unsupported instruction: INIT 490
        ;
        MessageComposer = new socialComposer:MessageComposer();
    }

    MessageComposer.Attachment = attachment;
    MessageComposer.Show();
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(AddToFavorites.Invoked)]
if (PlayingMusic)
{
    object favorites = new List();
    foreach (zuneUI:PlaybackTrack track in SelectionManager.SelectedItems)
    {
        if (!zuneUI:GuidHelper.IsEmpty(track.ZuneMediaId))
        {
            favorites.Add(track.ZuneMediaId);
        }
    }

    if (AddToFavoritesComposer == null)
    {
        // Unsupported instruction: INIT 1509
        ;
        AddToFavoritesComposer = new socialComposer:AddToFavoritesComposer();
    }

    AddToFavoritesComposer.MediaType = zuneUI:MediaType.Track;
    AddToFavoritesComposer.ServiceMediaIds = favorites;
    AddToFavoritesComposer.Send.Invoke();
}
]]></Script>
      <Script><![CDATA[
if (CurrentTrack != null && !CurrentTrack.IsMusic)
{
    zuneUI:ZuneShell.DefaultInstance.CurrentPage.OverlayUI = null;
}
]]></Script>
    </Scripts>
    <Methods><![CDATA[
bool IsQuickMix()
{
    return nowPlayingLand:NowPlayingPersistentState.IsQuickMix();
}
]]></Methods>
    <Content>
      <Panel Background="0, 0, 0, 0" Layout="Form">
        <Animations>
          <Animation Animation="{animations:Animations.NowPlayingPageFadeIn}" />
          <Animation Animation="{animations:Animations.NowPlayingPageFadeOut}" />
        </Animations>
        <Children>
          <Panel Name="HeadingPanel" MaximumSize="0, 60" MinimumSize="0, 60">
            <LayoutInput>
              <FormLayoutInput Left="TrackListBackground,0" Right="TrackListBackground,1" Bottom="TracksListPanel,0,-3" />
            </LayoutInput>
            <Animations>
              <Animation Animation="{animations:Animations.NowPlayingTrackListShow}" />
              <Animation Animation="{animations:Animations.NowPlayingFadeOut}" />
            </Animations>
            <Children>
              <Panel Layout="HorizontalFlow">
                <Children>
                  <Graphic Content="{RadioIcon}" SizingPolicy="SizeToContent" StretchingPolicy="Uniform" Margins="5" Alignment="Unspecified, Center" />
                  <label:Label Name="HeadingLabel" Style="{styles:SharedStyles.NowPlayingHeadingStyle}" Alignment="Unspecified, Center" />
                </Children>
              </Panel>
              <Panel Layout="Form" Background="255, 0, 0, 0" Alpha="0.8" />
            </Children>
          </Panel>
          <Panel Name="TracksListPanel" Margins="4, 20, 4, 20" MinimumSize="310, 0" MaximumSize="310, 600" Alignment="Unspecified, Far">
            <LayoutInput>
              <FormLayoutInput Right="Parent,1,20" Top="Parent,0,150" Bottom="Parent,1,22" />
            </LayoutInput>
            <Animations>
              <Animation Animation="{animations:Animations.NowPlayingTrackListShow}" />
              <Animation Animation="{animations:Animations.NowPlayingFadeOut}" />
            </Animations>
            <Children>
              <Panel Name="TracksListInnerContainer">
                <Layout>
                  <DockLayout DefaultLayoutInput="Bottom" />
                </Layout>
                <Animations>
                  <Animation Animation="{animations:Animations.NowPlayingFadeIn}" />
                </Animations>
                <Children>
                  <Panel Name="ActionContainer" Layout="VerticalFlow" MinimumSize="0, 39" Margins="0, 12, 0, -5">
                    <Children>
                      <button:ActionButton Name="SaveAsPlaylistButton" Model="{SaveAsPlaylist}" Alignment="Near, Far" Margins="5, 0, 0, 0" FocusOrder="1" />
                      <checkbox:CheckBox Name="ShowMPContentCheckBox" Model="{ShowMPContent}" Alignment="Near, Far" Margins="5, 0, 0, 0" LabelFont="{styles:Styles.ZegoeCaps8}" />
                    </Children>
                  </Panel>
                  <nowPlayingLand:NowPlayingSpreadSheet Name="TracksList" ListModel="{NowPlayingListModel}" SelectionManager="{SelectionManager}" NavigateIntoArgs="{NavigateIntoArgs}" ColumnData="{nowPlayingLand:Columns.DefaultViewColumnData}" ShowHeaders="false" ContextMenu="{ContextMenu}" ExecuteCommand="{Play}" FocusOrder="0" LayoutInput="Client" Alignment="Fill" />
                </Children>
              </Panel>
            </Children>
          </Panel>
          <Panel Name="TrackListBackground" Alpha="0.8" Layout="Dock">
            <LayoutInput>
              <FormLayoutInput Left="TracksListPanel,0" Right="TracksListPanel,1" Top="TracksListPanel,0" Bottom="TracksListPanel,1" />
            </LayoutInput>
            <Animations>
              <Animation Animation="{animations:Animations.NowPlayingTrackListShow}" />
              <Animation Animation="{animations:Animations.NowPlayingFadeOut}" />
            </Animations>
            <Children>
              <Graphic Name="TrackListTriangle" SizingPolicy="SizeToContent" StretchingPolicy="Uniform" Content="{styles:Styles.NowPlayingTriangle}" LayoutInput="Bottom" Alignment="Far, Unspecified" Margins="{TrackListTriangleMarginsWithShuffle}" />
              <Panel Background="255, 0, 0, 0" LayoutInput="Client" />
            </Children>
          </Panel>
        </Children>
      </Panel>
    </Content>
  </UI>
  <UI Name="NowPlayingBackground" Base="pageStack:PageBase">
    <Properties>
      <zuneUI:PlaybackPage Name="Page" PlaybackPage="$Required" />
    </Properties>
    <Locals>
      <Window Name="Window" />
      <zuneUI:TransportControls Name="TransportControls" TransportControls="{zuneUI:TransportControls.Instance}" />
      <nonClientControls:WindowState Name="WindowState" />
      <iris:Command Name="ZoomScale0" Description="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_VIDEO_ZOOM_FULL)}" />
      <iris:Command Name="ZoomScale1" Description="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_VIDEO_ZOOM_NONE)}" />
      <iris:Command Name="ZoomScale2" Description="{string.Format(zuneUI:Shell.LoadString(zuneUI:StringId.IDS_VIDEO_ZOOM_X), 2)}" />
      <iris:Command Name="ZoomScale3" Description="{string.Format(zuneUI:Shell.LoadString(zuneUI:StringId.IDS_VIDEO_ZOOM_X), 3)}" />
      <libraryContextMenu:LibraryContextMenu Name="ZoomScaleContextMenu">
        <Options>
          <iris:Command Command="{ZoomScale1}" />
          <iris:Command Command="{ZoomScale2}" />
          <iris:Command Command="{ZoomScale3}" />
          <iris:Command Command="{ZoomScale0}" />
        </Options>
      </libraryContextMenu:LibraryContextMenu>
      <popup:PopupManager Name="PopupManager" />
      <miniMode:MiniMode Name="MiniMode" />
      <Boolean Name="IsShowingDebugInfo" Boolean="false" />
    </Locals>
    <Input>
      <KeyHandler Name="DebugInfoHotKey" Key="F4" DisallowedModifiers="Ctrl, Shift, Alt" HandlerStage="Direct" />
      <ClickHandler Name="RightClick" ClickType="RightMouse" HandlerStage="Direct" />
      <ClickHandler Name="ZoomModeHandler" ClickType="LeftMouse" HandlerStage="Direct" ClickCount="Double" Handle="true" />
    </Input>
    <Scripts>
      <Script><![CDATA[
[DeclareTrigger(TransportControls.PlayingVideo), DeclareTrigger(TransportControls.VideoStream), DeclareTrigger(Window.ClientSize), DeclareTrigger(TransportControls.ZoomScaleFactor)]
bool playingVideo = #TransportControls.PlayingVideo #;
bool scalingVideo = false;
int maxVideoSizeX = 0;
int maxVideoSizeY = 0;
Video.Visible = playingVideo;
if (playingVideo)
{
    iris:VideoStream stream = #TransportControls.VideoStream #;
    Video.VideoStream = stream;
    if (iris:Application.RenderingType == iris:RenderingType.GDI)
    {
        VideoConstraint.Margins = styles:Styles.VideoMarginsGDIMode;
        GDIVideoBackground.Visible = true;
    }
    else
    {
        VideoConstraint.Margins = new Inset();
        GDIVideoBackground.Visible = false;
    }

    if ((((!MiniMode.InCompactMode && !MiniMode.InPopupMode) && (stream.ContentAspectHeight != 0)) && (stream.ContentAspectWidth != 0)) && (stream.ContentHeight != 0))
    {
        object naturalWidth = stream.ContentHeight * stream.ContentAspectWidth / stream.ContentAspectHeight;
        object naturalHeight = stream.ContentHeight;
        int wndWidth = #Window.ClientSize #.Width;
        int wndHeight = Window.ClientSize.Height;
        if (wndWidth != 0 && wndHeight != 0)
        {
            object scaleX = (float)(wndWidth) / (float)(naturalWidth);
            object scaleY = (float)(wndHeight) / (float)(naturalHeight);
            int scale = system:Math.Min(scaleX, scaleY);
            maxVideoSizeX = #TransportControls.ZoomScaleFactor # * naturalWidth;
            maxVideoSizeY = TransportControls.ZoomScaleFactor * naturalHeight;
            if (maxVideoSizeY + 50 > wndHeight || maxVideoSizeX + 50 > wndWidth)
            {
                TransportControls.ZoomScaleFactor = 0;
                maxVideoSizeY = 0;
                maxVideoSizeX = 0;
            }
            else
            {
                scalingVideo = true;
            }
        }
    }
}
else
{
    Video.VideoStream = null;
    GDIVideoBackground.Visible = false;
}

VideoConstraint.MaximumSize = new Size(maxVideoSizeX, maxVideoSizeY);
LeftVideoBackground.Visible = scalingVideo;
TopVideoBackground.Visible = scalingVideo;
RightVideoBackground.Visible = scalingVideo;
BottomVideoBackground.Visible = scalingVideo;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TransportControls.PlayingVideo)]
if (!#TransportControls.PlayingVideo #)
{
    MusicBackground.RequestSource(typeof(nowPlayingMusicBackground:NowPlayingMusicBackground), "Page", Page);
}
else
{
    MusicBackground.RequestSource(null);
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(PopupManager.IsModal)]
Page.AutoHideToolbars = !#PopupManager.IsModal #;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(Page.OverlayUI), DeclareTrigger(WindowState.InputActive)]
Fade.Visible = #Page.OverlayUI # == null && #WindowState.InputActive #;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(RightClick.Invoked)]
if (TransportControls.PlayingVideo && iris:Application.RenderingType != iris:RenderingType.GDI)
{
    ZoomScaleContextMenu.LayoutInput = new PopupLayoutInput();
    ZoomScaleContextMenu.LayoutInput.Placement = MouseOrigin;
    ZoomScaleContextMenu.Show();
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(ZoomScale0.Invoked)]
TransportControls.ZoomScaleFactor = 0;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(ZoomScale1.Invoked)]
TransportControls.ZoomScaleFactor = 1;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(ZoomScale2.Invoked)]
TransportControls.ZoomScaleFactor = 2;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(ZoomScale3.Invoked)]
TransportControls.ZoomScaleFactor = 3;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(ZoomModeHandler.Invoked)]
TransportControls.ZoomScaleFactor = TransportControls.ZoomScaleFactor + 1 % 4;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(DebugInfoHotKey.Invoked)]
if (zuneUI:Shell.PreRelease)
{
    IsShowingDebugInfo = !IsShowingDebugInfo;
    this.ShowDebugInfo();
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TransportControls.BandwidthUpdateInfo)]
if (zuneUI:Shell.PreRelease)
{
    this.ShowDebugInfo();
}
]]></Script>
    </Scripts>
    <Methods><![CDATA[
void ShowDebugInfo()
{
    DebugInfoText.Visible = IsShowingDebugInfo;
    if (IsShowingDebugInfo && TransportControls.BandwidthUpdateInfo != null)
    {
        DebugInfoText.Content = "ID = " + TransportControls.BandwidthUpdateInfo.Id.ToString("X") + ", Bitrate = " + TransportControls.BandwidthUpdateInfo.Bitrate.ToString() + ", RecentAvgBandwidth = " + TransportControls.BandwidthUpdateInfo.RecentAverageBandwidth.ToString() + ", TotalAverageBandwidth = " + TransportControls.BandwidthUpdateInfo.TotalAverageBandwidth.ToString() + ", LatestBandwidth = " + TransportControls.BandwidthUpdateInfo.LatestBandwidth.ToString() + ", Buffering = " + TransportControls.BandwidthUpdateInfo.Buffering.ToString() + ", DroppedFrames = " + TransportControls.BandwidthUpdateInfo.DroppedFrames.ToString() + ", Quality = " + TransportControls.BandwidthUpdateInfo.Quality.ToString() + ", TestPosition = " + TransportControls.BandwidthUpdateInfo.TestPosition.ToString() + ", TestLength = " + TransportControls.BandwidthUpdateInfo.TestLength.ToString();
    }
}
]]></Methods>
    <Content>
      <Panel Layout="Form">
        <Animations>
          <Animation Animation="{animations:Animations.NowPlayingPageFadeIn}" />
          <Animation Animation="{animations:Animations.NowPlayingPageFadeOut}" />
        </Animations>
        <Children>
          <frame:ApplicationBorders>
            <LayoutInput>
              <FormLayoutInput Left="Parent,0" Right="Parent,1" Top="Parent,0" Bottom="Parent,1" />
            </LayoutInput>
          </frame:ApplicationBorders>
          <Panel Name="DebugInfoPanel" Visible="true">
            <LayoutInput>
              <FormLayoutInput Left="Parent,0.1" Right="Parent,0.9" Top="Parent,0.02" />
            </LayoutInput>
            <Children>
              <label:Label Name="DebugInfoText" Style="{styles:SharedStyles.NowPlayingDebugInfoStyle}" WordWrap="true" Visible="false" />
            </Children>
          </Panel>
          <Graphic Name="Fade" Content="{styles:Styles.NowPlayingFade}" SizingPolicy="SizeToConstraint">
            <LayoutInput>
              <FormLayoutInput Left="Parent,0" Right="Parent,1" Top="Parent,1,-160" Bottom="Parent,1" />
            </LayoutInput>
            <Animations>
              <Animation Animation="{animations:Animations.NowPlayingFadeIn}" />
              <Animation Animation="{animations:Animations.NowPlayingFadeOut}" />
            </Animations>
          </Graphic>
          <Panel Name="VideoConstraint" Alignment="Center">
            <Children>
              <Video Name="Video" LetterboxColor="255, 16, 16, 16" Visible="false" Layout="Form" />
            </Children>
          </Panel>
          <Panel Name="GDIVideoBackground" Background="255, 0, 0, 0" Visible="false">
            <LayoutInput>
              <FormLayoutInput Left="Parent,0" Right="Parent,1" Top="Parent,0" Bottom="Parent,1" />
            </LayoutInput>
          </Panel>
          <Panel Name="LeftVideoBackground" Background="255, 16, 16, 16" Visible="false">
            <LayoutInput>
              <FormLayoutInput Left="Parent,0" Right="VideoConstraint,0" Top="VideoConstraint,0" Bottom="VideoConstraint,1" />
            </LayoutInput>
          </Panel>
          <Panel Name="TopVideoBackground" Background="255, 16, 16, 16" Visible="false">
            <LayoutInput>
              <FormLayoutInput Left="Parent,0" Right="Parent,1" Top="Parent,0" Bottom="VideoConstraint,0" />
            </LayoutInput>
          </Panel>
          <Panel Name="RightVideoBackground" Background="255, 16, 16, 16" Visible="false">
            <LayoutInput>
              <FormLayoutInput Left="VideoConstraint,1" Right="Parent,1" Top="VideoConstraint,0" Bottom="VideoConstraint,1" />
            </LayoutInput>
          </Panel>
          <Panel Name="BottomVideoBackground" Background="255, 16, 16, 16" Visible="false">
            <LayoutInput>
              <FormLayoutInput Left="Parent,0" Right="Parent,1" Top="VideoConstraint,1" Bottom="Parent,1" />
            </LayoutInput>
          </Panel>
          <Host Name="MusicBackground" />
        </Children>
      </Panel>
    </Content>
  </UI>
  <Class Name="NowPlayingListModel" Base="spreadSheet:SpreadSheetListModel">
    <Properties>
      <zuneUI:PlaybackPage Name="Page" PlaybackPage="$Required" />
      <Type Name="RowModelType" Type="{typeof(nowPlayingLand:NowPlayingRowModel)}" />
    </Properties>
  </Class>
  <UI Name="NowPlayingSpreadSheet" Base="spreadSheet:SpreadSheet">
    <Properties>
      <Boolean Name="CanReorder" Boolean="true" />
      <Size Name="LayoutSpacing" Size="0, 5" />
      <Size Name="RowSize" Size="0, 50" />
      <Inset Name="RowPadding" Inset="6, 1, 0, 3" />
      <Boolean Name="AllowHorizontalScrolling" Boolean="false" />
      <Type Name="ScrollBarType" Type="{typeof(wizard:ScrollBar)}" />
      <style:StyleSet Name="RowBackgroundStyle" StyleSet="{styles:SharedStyles.NowPlayingRowBackgroundStyle}" />
    </Properties>
    <Scripts>
      <Script><![CDATA[
[DeclareTrigger(UI.MouseFocus)]
nonClientControls:WindowState.PageInputActivity = #UI.MouseFocus #;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(Target.Dropped)]
object value = DropHelper.Value;
if (!value is SelectionManager)
{
}
else
{
    SelectionManager selectionManager = (SelectionManager)value;
    object insertAt = InsertIndex.Value;
    zuneUI:TransportControls.Instance.ReorderNowPlaying(selectionManager.SelectedIndices, insertAt);
}
]]></Script>
    </Scripts>
  </UI>
  <Class Name="Columns" Shared="true">
    <Properties>
      <spreadSheet:ColumnData Name="DefaultViewColumnData" SaveKeyPrefix="NowPlaying">
        <Columns>
          <spreadSheet:ColumnInfo CellType="{typeof(nowPlayingLand:StatusCell)}" Resizable="false" CellPadding="0, 0, 0, 2">
            <LayoutInput>
              <StackLayoutInput Priority="High" />
            </LayoutInput>
            <ColumnSize>
              <SharedSize Size="17, 0" />
            </ColumnSize>
          </spreadSheet:ColumnInfo>
          <spreadSheet:ColumnInfo Header="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_SONG_COLUMN_HEADER)}" CellType="{typeof(nowPlayingLand:SongCell)}" Resizable="false" CellPadding="5, 0, 5, 0" Fill="true">
            <LayoutInput>
              <StackLayoutInput Priority="Low" />
            </LayoutInput>
          </spreadSheet:ColumnInfo>
          <spreadSheet:ColumnInfo CellType="{typeof(nowPlayingLand:RatingCell)}" Resizable="false" CellPadding="4, 9, 1, 0" LayoutInput="Right">
            <ColumnSize>
              <SharedSize Size="30, 0" />
            </ColumnSize>
          </spreadSheet:ColumnInfo>
          <spreadSheet:ColumnInfo CellType="{typeof(nowPlayingLand:MoreInfoCell)}" Resizable="false" CellPadding="1, 9, 4, 0" LayoutInput="Right">
            <ColumnSize>
              <SharedSize Size="30, 0" />
            </ColumnSize>
          </spreadSheet:ColumnInfo>
          <spreadSheet:ColumnInfo CellType="{typeof(nowPlayingLand:DownloadCell)}" Resizable="false" CellPadding="1, 9, 4, 0" LayoutInput="Right">
            <ColumnSize>
              <SharedSize Size="30, 0" />
            </ColumnSize>
          </spreadSheet:ColumnInfo>
        </Columns>
      </spreadSheet:ColumnData>
    </Properties>
  </Class>
  <Class Name="NowPlayingRowModel" Base="spreadSheetCells:SpreadSheetTrackRowModel">
    <Properties>
      <iris:Choice Name="ButtonState">
        <Options>
          <String String="Hidden" />
          <String String="Buttons" />
          <String String="Upsell" />
          <String String="SignIn" />
        </Options>
      </iris:Choice>
      <Boolean Name="ForceNonMarketplace" Boolean="false" />
    </Properties>
  </Class>
  <UI Name="StatusCell" Base="spreadSheetCells:MediaStatusCell">
    <Properties>
      <nowPlayingLand:NowPlayingRowModel Name="RowModel" NowPlayingRowModel="$Required" />
      <zuneUI:PlaybackTrack Name="Model" PlaybackTrack="$Required" />
    </Properties>
    <Scripts>
      <Script><![CDATA[
[DeclareTrigger(zuneUI:TransportControls.Instance.ErrorCount)]
ErrorCode = zuneUI:TransportControls.Instance.GetLibraryErrorCode(Model);
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(RowModel.IsNowPlaying)]
IsNowPlaying = #RowModel.IsNowPlaying #;
]]></Script>
    </Scripts>
  </UI>
  <UI Name="SongCell" Base="spreadSheet:Cell">
    <Properties>
      <style:StatefulCompositeStyle Name="Style" StatefulCompositeStyle="$Required" />
      <zuneUI:PlaybackTrack Name="Model" PlaybackTrack="$Required" />
      <nowPlayingLand:NowPlayingRowModel Name="RowModel" NowPlayingRowModel="$Required" />
      <style:Style Name="TrackStyle" Style="{styles:SharedStyles.NowPlayingTrackStyle}" />
      <style:Style Name="ArtistStyle" Style="{styles:SharedStyles.NowPlayingArtistStyle}" />
      <iris:Command Name="SignInModel" Description="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_LOGON_BUTTON)}" />
    </Properties>
    <Locals>
      <style:StatefulCompositeStyle Name="TrackStatefulStyle" Base="{styles:SharedStyles.NowPlayingTrackStyle}" />
      <style:StatefulCompositeStyle Name="ArtistStatefulStyle" Base="{styles:SharedStyles.NowPlayingArtistStyle}" />
      <zuneUI:SignIn Name="SignIn" SignIn="{zuneUI:SignIn.Instance}" />
      <signInDialog:SignInDialog Name="SignInDialog" SignInDialog="{null}" />
    </Locals>
    <Scripts>
      <Script><![CDATA[
[DeclareTrigger(Style.State.Hovered), DeclareTrigger(RowModel.Focused), DeclareTrigger(SignIn.LastSignedInUserHadActiveSubscription), DeclareTrigger(SignIn.SignedIn)]
RowModel.ButtonState.ChosenValue = "Hidden";
if (#Style.State #.Hovered # || #RowModel.Focused #)
{
    if (Model.IsInVisibleCollection)
    {
        RowModel.ButtonState.ChosenValue = "Buttons";
    }
    else
    {
        if (!#SignIn.LastSignedInUserHadActiveSubscription #)
        {
            RowModel.ButtonState.ChosenValue = "Upsell";
        }
        else
        {
            if (#SignIn.SignedIn #)
            {
                RowModel.ButtonState.ChosenValue = "Buttons";
            }
            else
            {
                RowModel.ButtonState.ChosenValue = "SignIn";
            }
        }
    }
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(RowModel.ButtonState.ChosenValue)]
SignInButton.Visible = #RowModel.ButtonState #.ChosenValue # == "SignIn";
Upsell.Visible = util:FeatureEnablement.IsFeatureEnabled(zuneDBApi:Features.eSubscription) && RowModel.ButtonState.ChosenValue == "Upsell";
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(zuneUI:TransportControls.Instance.CurrentTrack)]
RowModel.IsNowPlaying = Model == #zuneUI:TransportControls.Instance.CurrentTrack #;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(RowModel.IsNowPlaying), DeclareTrigger(RowModel.ForceNonMarketplace)]
if (#RowModel.IsNowPlaying #)
{
    TrackStatefulStyle.Base = styles:SharedStyles.NowPlayingTrackStylePlaying;
    ArtistStatefulStyle.Base = styles:SharedStyles.NowPlayingArtistStylePlaying;
}
else
{
    if (!#RowModel.ForceNonMarketplace # && Model != null && !Model.IsInVisibleCollection)
    {
        TrackStatefulStyle.Base = styles:SharedStyles.NowPlayingTrackStyleMarketplace;
        ArtistStatefulStyle.Base = styles:SharedStyles.NowPlayingArtistStyleMarketplace;
    }
    else
    {
        TrackStatefulStyle.Base = styles:SharedStyles.NowPlayingTrackStyle;
        ArtistStatefulStyle.Base = styles:SharedStyles.NowPlayingArtistStyle;
    }
}
]]></Script>
      <Script><![CDATA[
if (Model is zuneUI:LibraryPlaybackTrack)
{
    zuneUI:LibraryPlaybackTrack track = (zuneUI:LibraryPlaybackTrack)Model;
    ArtistName.Content = track.DisplayArtist;
}
else
{
    if (Model is zuneUI:MarketplacePlaybackTrack)
    {
        track = (zuneUI:MarketplacePlaybackTrack)Model;
        ArtistName.Content = track.Artist;
    }
    else
    {
        ArtistName.Content = "";
    }
}

TrackName.Content = Model.Title;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(SignInModel.Invoked)]
if (SignInDialog == null)
{
    // Unsupported instruction: INIT 567
    ;
    SignInDialog = new signInDialog:SignInDialog();
}

SignInDialog.Show();
]]></Script>
    </Scripts>
    <Content>
      <Panel Layout="Dock">
        <Children>
          <Panel Layout="Dock">
            <Children>
              <label:DarkLabel Name="TrackName" LayoutInput="Top" MouseInteractive="true" WordWrap="false" MaximumLines="0" Style="{TrackStatefulStyle}" />
              <label:DarkLabel Name="ArtistName" LayoutInput="Top" MouseInteractive="true" WordWrap="false" MaximumLines="0" Style="{ArtistStatefulStyle}" />
            </Children>
          </Panel>
          <nowPlayingLand:ZunePassUpsell Name="Upsell" Alignment="Far, Center" LayoutInput="Right" LineAlignment="Far" Margins="0, 0, -87, 0" />
          <wizardControls:NavigationActionButton Name="SignInButton" LayoutInput="Right" Model="{SignInModel}" Alignment="Far, Center" Margins="0, 0, -87, 0" />
        </Children>
      </Panel>
    </Content>
  </UI>
  <UI Name="ZunePassUpsell" Base="label:Label">
    <Properties>
      <style:Style Name="Style" Style="{styles:SharedStyles.NowPlayingZunePassUpsellStyle}" />
      <String Name="Content" String="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_NOWPLAYING_ZUNEPASS_NOTRIAL_UPSELL)}" />
      <Boolean Name="WordWrap" Boolean="true" />
      <Int32 Name="MaximumLines" Int32="3" />
    </Properties>
    <Input>
      <ClickHandler Name="Clicker" />
    </Input>
    <Scripts>
      <Script><![CDATA[
[DeclareTrigger(Clicker.Invoked)]
zuneUI:ZuneShell.DefaultInstance.Execute("Settings\\Account\\PurchaseSubscription", null);
util1:SQMLog.Log(util:SQMDataId.QuickMixUpsell, 1);
]]></Script>
    </Scripts>
  </UI>
  <UI Name="MoreInfoCell" Base="spreadSheet:Cell">
    <Properties>
      <nowPlayingLand:NowPlayingListModel Name="ListModel" NowPlayingListModel="$Required" />
      <zuneUI:PlaybackTrack Name="Model" PlaybackTrack="$Required" />
      <style:StatefulCompositeStyle Name="Style" StatefulCompositeStyle="$Required" />
      <nowPlayingLand:NowPlayingRowModel Name="RowModel" NowPlayingRowModel="$Required" />
    </Properties>
    <Locals>
      <zuneUI:SignIn Name="SignIn" SignIn="{zuneUI:SignIn.Instance}" />
      <moreInfoActions:TrackMoreInfoActions Name="TrackMoreInfoActions" />
    </Locals>
    <Scripts>
      <Script><![CDATA[
TrackMoreInfoActions.ZuneMediaId = Model.ZuneMediaId;
TrackMoreInfoActions.ServiceContext = Model.ServiceContext;
TrackMoreInfoActions.Title = Model.Title;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TrackMoreInfoActions.PrimaryMenuCommand.Available)]
if (MoreInfo.Model != null)
{
    UI.Enabled = #TrackMoreInfoActions.PrimaryMenuCommand #.Available # && Model.MediaType == zuneUI:MediaType.Track;
    UI.KeyInteractive = UI.Enabled;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(RowModel.IsNowPlaying), DeclareTrigger(RowModel.ButtonState.ChosenValue), DeclareTrigger(TrackMoreInfoActions.PrimaryMenuCommand.Available)]
object isNowPlaying = RowModel is spreadSheetCells:SpreadSheetTrackRowModel && ((spreadSheetCells:SpreadSheetTrackRowModel)RowModel).IsNowPlaying;
if (isNowPlaying)
{
    MoreInfo.Image = styles:Styles.NPInformationDefault;
    MoreInfo.HoverImage = styles:Styles.NPInformationHover;
    MoreInfo.PressedImage = styles:Styles.NPInformationClick;
}
else
{
    MoreInfo.Image = styles:Styles.OverlayInformationDefault;
    MoreInfo.HoverImage = styles:Styles.OverlayInformationHover;
    MoreInfo.PressedImage = styles:Styles.OverlayInformationClick;
}

if ((#RowModel.ButtonState #.ChosenValue # != "Buttons" || !#TrackMoreInfoActions.PrimaryMenuCommand #.Available #) || (Model.MediaType != zuneUI:MediaType.Track))
{
    MoreInfo.Image = styles:Styles.RatingBlank;
    MoreInfo.HoverImage = styles:Styles.RatingBlank;
    MoreInfo.PressedImage = styles:Styles.RatingBlank;
}
]]></Script>
    </Scripts>
    <Content>
      <button:IconButton Name="MoreInfo" Model="{TrackMoreInfoActions.PrimaryMenuCommand}" Margins="0, 1, 0, 0" KeyInteractiveNStuff="false" AllowDoubleClicks="false" />
    </Content>
  </UI>
  <UI Name="DownloadCell" Base="spreadSheet:Cell">
    <Properties>
      <nowPlayingLand:NowPlayingListModel Name="ListModel" NowPlayingListModel="$Required" />
      <zuneUI:PlaybackTrack Name="Model" PlaybackTrack="$Required" />
      <style:StatefulCompositeStyle Name="Style" StatefulCompositeStyle="$Required" />
      <nowPlayingLand:NowPlayingRowModel Name="RowModel" NowPlayingRowModel="$Required" />
    </Properties>
    <Locals>
      <zuneUI:SignIn Name="SignIn" SignIn="{zuneUI:SignIn.Instance}" />
      <iris:Command Name="DownloadCommand" Description="{zuneUI:Shell.LoadString(zuneUI:StringId.IDS_DOWNLOAD_MENUITEM)}" />
      <schema2:MarketplaceSingleTrackDataQuery Name="SingleTrackQuery" Enabled="false" />
    </Locals>
    <Scripts>
      <Script><![CDATA[
[DeclareTrigger(RowModel.IsNowPlaying), DeclareTrigger(RowModel.ForceNonMarketplace), DeclareTrigger(RowModel.ButtonState.ChosenValue)]
object isNowPlaying = RowModel is spreadSheetCells:SpreadSheetTrackRowModel && ((spreadSheetCells:SpreadSheetTrackRowModel)RowModel).IsNowPlaying;
if (isNowPlaying)
{
    Download.Image = styles:Styles.NPDownloadDefault;
    Download.HoverImage = styles:Styles.NPDownloadHover;
    Download.PressedImage = styles:Styles.NPDownloadClick;
}
else
{
    Download.Image = styles:Styles.OverlayDownloadDefault;
    Download.HoverImage = styles:Styles.OverlayDownloadHover;
    Download.PressedImage = styles:Styles.OverlayDownloadClick;
}

object dontShowIcon = (Model != null) || ((Model != null) && (Model.IsInVisibleCollection || Model.ZuneMediaId == zuneUI:GuidHelper.Empty)) || !shell:ZuneApplication.Service.CanDownloadSubscriptionContent();
if (dontShowIcon)
{
    Download.Image = styles:Styles.RatingBlank;
    Download.HoverImage = styles:Styles.RatingBlank;
    Download.PressedImage = styles:Styles.RatingBlank;
}

DownloadCommand.Available = !dontShowIcon;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(DownloadCommand.Invoked)]
object modelId = Model.ZuneMediaId.ToString();
SingleTrackQuery.Id = modelId;
SingleTrackQuery.Enabled = !string.IsNullOrEmpty(modelId);
DownloadCommand.Available = false;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(SingleTrackQuery.Status)]
if (#SingleTrackQuery.Status # == iris:DataProviderQueryStatus.Complete)
{
    object track = SingleTrackQuery.Result.Item;
    if (track != null && track.CanDownload)
    {
        track.ReferrerContext = Model.ServiceContext;
        object downloadItems = new collections:ArrayList(1);
        downloadItems.Add(track);
        zuneUI:Download.Instance.DownloadContent(downloadItems, service:EDownloadFlags.Subscription);
        RowModel.ForceNonMarketplace = true;
    }
}
]]></Script>
    </Scripts>
    <Content>
      <button:IconButton Name="Download" Model="{DownloadCommand}" Margins="0, 1, 0, 0" KeyInteractiveNStuff="false" AllowDoubleClicks="false" />
    </Content>
  </UI>
  <UI Name="RatingCell" Base="tracksPanelColumns:RatingCellBase">
    <Properties>
      <nowPlayingLand:NowPlayingListModel Name="ListModel" NowPlayingListModel="$Required" />
      <nowPlayingLand:NowPlayingRowModel Name="RowModel" NowPlayingRowModel="$Required" />
      <zuneUI:PlaybackTrack Name="Model" PlaybackTrack="$Required" />
      <Int32 Name="UserRating" Int32="{Model.UserRating}" />
      <Boolean Name="DisplayNowPlayingNotRated" Boolean="true" />
      <Boolean Name="DontDisplayWhenNotAvailable" Boolean="true" />
      <Image Name="NowPlayingNotRated" Image="{styles:Styles.NPRatingNowPlayingNotRated}" />
      <Image Name="NowPlayingNotRatedHover" Image="{styles:Styles.NPRatingNowPlayingNotRatedHover}" />
      <Image Name="NowPlayingNotRatedPressed" Image="{styles:Styles.NPRatingNowPlayingNotRatedPressed}" />
      <Image Name="NotRated" Image="{styles:Styles.RatingBlank}" />
      <Image Name="NotRatedHover" Image="{styles:Styles.NPRatingNotRatedHover}" />
      <Image Name="NotRatedHasFocus" Image="{styles:Styles.NPRatingNotRated}" />
      <Image Name="NotRatedPressed" Image="{styles:Styles.NPRatingNotRatedPressed}" />
      <Image Name="NowPlayingHate" Image="{styles:Styles.NPRatingNowPlayingHateIt}" />
      <Image Name="NowPlayingHateHover" Image="{styles:Styles.NPRatingNowPlayingHateItHover}" />
      <Image Name="NowPlayingHatePressed" Image="{styles:Styles.NPRatingNowPlayingHateItPressed}" />
      <Image Name="Hate" Image="{styles:Styles.NPRatingHateIt}" />
      <Image Name="HateHover" Image="{styles:Styles.NPRatingHateItHover}" />
      <Image Name="HateSelected" Image="{styles:Styles.NPRatingHateItSelected}" />
      <Image Name="HatePressed" Image="{styles:Styles.NPRatingHateItPressed}" />
      <Image Name="NowPlayingLove" Image="{styles:Styles.NPRatingNowPlayingLikeIt}" />
      <Image Name="NowPlayingLoveHover" Image="{styles:Styles.NPRatingNowPlayingLikeItHover}" />
      <Image Name="NowPlayingLovePressed" Image="{styles:Styles.NPRatingNowPlayingLikeItPressed}" />
      <Image Name="Love" Image="{styles:Styles.NPRatingLikeIt}" />
      <Image Name="LoveHover" Image="{styles:Styles.NPRatingLikeItHover}" />
      <Image Name="LoveSelected" Image="{styles:Styles.NPRatingLikeItSelected}" />
      <Image Name="LovePressed" Image="{styles:Styles.NPRatingLikeItPressed}" />
    </Properties>
    <Scripts>
      <Script><![CDATA[
[DeclareTrigger(RowModel.ButtonState.ChosenValue)]
ShowOverride = #RowModel.ButtonState #.ChosenValue # == "Buttons";
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(RowModel.ButtonState.ChosenValue)]
ChangeRating.Available = nowPlayingLand:NowPlayingPersistentState.IsQuickMix() && nowPlayingLand:NowPlayingPersistentState.IsQuickMix() || Model.CanRate && Model.IsInVisibleCollection;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(Model.RatingChanged.Invoked)]
UserRating = Model.UserRating;
]]></Script>
      <Script><![CDATA[
if (Model.UserRating != UserRating)
{
    Model.UserRating = UserRating;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(ChangeRating.Invoked)]
if (ListModel.SelectionManager != null && ListModel.SelectionManager.IsSelected(RowIndex.Value))
{
    foreach (zuneUI:PlaybackTrack track in ListModel.SelectionManager.SelectedItems)
    {
        if (track.UserRating != UserRating)
        {
            track.UserRating = UserRating;
        }
    }
}
]]></Script>
    </Scripts>
  </UI>
  <Class Name="NowPlayingInfo" Shared="true">
    <Properties>
      <Size Name="TinySize" Size="38, 38" />
      <Size Name="BigSize" Size="144, 144" />
      <String Name="TrackTitle" String="{null}" />
      <String Name="ArtistName" String="{null}" />
      <String Name="AlbumTitle" String="{null}" />
      <String Name="ArtistBio" String="{null}" />
      <String Name="ArtistBioAuthor" String="{null}" />
      <Image Name="BigAlbumArt" Image="{null}" />
      <Image Name="TinyAlbumArt" Image="{null}" />
      <Int32 Name="TrackPlayCount" />
      <List Name="ArtistImages" List="{null}" />
      <system:Guid Name="ArtistId" />
      <zuneUI:LibraryAlbumInfo Name="LibraryAlbumInfo" LibraryAlbumInfo="{null}" />
      <List Name="ExtendedPlayInfo" List="{null}" />
      <collections:IList Name="ArtistGenres" IList="{null}" />
      <collections:IList Name="ArtistMoods" IList="{null}" />
      <iris:BooleanChoice Name="IsFullscreen" Value="false" />
      <String Name="RotatingPlayInfo" String="{null}" />
      <Command Name="Rotate" />
    </Properties>
    <Locals>
      <schema2:MarketplaceSingleTrackDataQuery Name="MPTrackQuery" Enabled="false" />
      <schema2:MarketplaceArtistBiographyQuery Name="ArtistBiographyQuery" Enabled="false" />
      <schema2:MarketplaceArtistDataQuery Name="ArtistQuery" Enabled="false" />
      <schema2:PhotoList Name="ArtistPhotos" PhotoList="{null}" />
      <schema1:TopListenersTopListenersDataQuery Name="TopListenersQuery" Enabled="false" />
      <imageSelector:ImageSelector Name="TinyImageSelector" ImageLoadSize="{TinySize}" />
      <imageSelector:ImageSelector Name="BigImageSelector" ImageLoadSize="{BigSize}" Fallback="{styles:Styles.NoAlbumArtNowPlayingBig}" />
      <Size Name="MinArtistImageSize" Width="420" Height="315" />
      <Image Name="FallbackImage" />
      <imageSelector:ImageSelector Name="ArtistImageSelector" ImageLoadSize="{utility:Utility.SizeToSize(zuneUI:ImageConstants.NowPlaying)}" Fallback="{FallbackImage}" />
      <schema2:MarketplaceArtistPhotosDataQuery Name="ArtistPhotosQuery" Enabled="false" MinWidth="{MinArtistImageSize.Width}" MinHeight="{MinArtistImageSize.Height}" />
      <Timer Name="RotateInfo" Interval="4000" AutoRepeat="true" Enabled="false" />
      <Int32 Name="RotationCode" Int32="0" />
      <List Name="RotateInfoList" List="{null}" />
      <Int32 Name="ArtistImageIndex" Int32="0" />
      <List Name="SelectedArtistImages" List="{null}" />
      <system:Random Name="Random" />
      <Int32 Name="TotalTrackPlays" />
      <Int32 Name="TotalArtistPlays" />
      <String Name="TopListenerTag" />
      <Int32 Name="TopListenerPlays" />
      <nowPlayingMusicBackground:NowPlayingBackgroundHelper Name="NowPlayingBackgroundHelper" />
      <schema2:ArtistData Name="ArtistData" ArtistData="{null}" />
      <system:Guid Name="TrackId" />
    </Locals>
    <Scripts>
      <Script><![CDATA[
[DeclareTrigger(zuneUI:TransportControls.Instance.CurrentTrack)]
zuneUI:PlaybackTrack track = #zuneUI:TransportControls.Instance.CurrentTrack #;
if (LibraryAlbumInfo != null)
{
    Class.DisposeOwnedObject(LibraryAlbumInfo);
    LibraryAlbumInfo = null;
}

TrackId = zuneUI:GuidHelper.Empty;
ArtistId = zuneUI:GuidHelper.Empty;
MPTrackQuery.Enabled = false;
ArtistQuery.Enabled = false;
TopListenersQuery.Enabled = false;
TotalTrackPlays = 0;
TotalArtistPlays = 0;
TopListenerTag = null;
TopListenerPlays = 0;
ArtistData = null;
ArtistImages = null;
TrackPlayCount = 1;
TrackTitle = null;
AlbumTitle = null;
ArtistName = null;
ArtistGenres = null;
ArtistMoods = null;
this.private_ResetImageSelectors();
ExtendedPlayInfo = new List();
if (track != null)
{
    TrackTitle = track.Title;
    if (track is zuneUI:LibraryPlaybackTrack)
    {
        zuneUI:LibraryPlaybackTrack libTrack = (zuneUI:LibraryPlaybackTrack)track;
        LibraryAlbumInfo = new zuneUI:LibraryAlbumInfo(libTrack, TinySize.Width, TinySize.Height);
        AlbumTitle = LibraryAlbumInfo.AlbumTitle;
        ArtistName = LibraryAlbumInfo.ArtistName;
    }
    else
    {
        if (track is zuneUI:MarketplacePlaybackTrack)
        {
            zuneUI:MarketplacePlaybackTrack mptrack = (zuneUI:MarketplacePlaybackTrack)track;
            AlbumTitle = mptrack.Album;
            ArtistName = mptrack.Artist;
        }
        else
        {
            if (track is zuneUI:VideoPlaybackTrack)
            {
                zuneUI:VideoPlaybackTrack mvtrack = (zuneUI:VideoPlaybackTrack)track;
                ArtistName = mvtrack.Artist;
            }
        }
    }

    if (!track is zuneUI:VideoPlaybackTrack)
    {
        TrackId = track.ZuneMediaId;
    }

    if (track.IsVideo)
    {
        TinyImageSelector.Fallback = styles:Styles.NoAlbumArtNowPlayingTinyWide;
    }
    else
    {
        TinyImageSelector.Fallback = styles:Styles.NoAlbumArtNowPlayingTiny;
    }
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(MPTrackQuery.Status)]
if (zuneUI:QueryHelper.HasCompleted(#MPTrackQuery.Status #))
{
    object track = MPTrackQuery.Result.Item;
    if (track != null && MPTrackQuery.Enabled)
    {
        if (string.IsNullOrEmpty(BigImageSelector.ImageUri))
        {
            BigImageSelector.ImageId = track.ImageId;
        }

        TotalTrackPlays = track.PlayCount;
        if (track.PlayCount > 0)
        {
            TrackPlayCount = track.PlayCount;
        }

        if (track.AlbumArtist != null)
        {
            ArtistId = track.AlbumArtist.Id;
        }
        else
        {
            ArtistId = track.PrimaryArtist.Id;
        }
    }
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(BigImageSelector.ImageUri)]
TinyImageSelector.ImageUri = #BigImageSelector.ImageUri #;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(BigImageSelector.Image)]
BigAlbumArt = #BigImageSelector.Image #;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(LibraryAlbumInfo.ThumbnailImage), DeclareTrigger(TinyImageSelector.Image)]
if (LibraryAlbumInfo != null && #LibraryAlbumInfo.ThumbnailImage # != null)
{
    TinyAlbumArt = LibraryAlbumInfo.ThumbnailImage;
}
else
{
    TinyAlbumArt = #TinyImageSelector.Image #;
}
]]></Script>
      <Script><![CDATA[
RotateInfoList = new List();
if (!string.IsNullOrEmpty(TrackTitle))
{
    RotateInfoList.Add(TrackTitle);
}

if (!string.IsNullOrEmpty(ArtistName))
{
    RotateInfoList.Add(ArtistName);
}

if (!string.IsNullOrEmpty(AlbumTitle))
{
    RotateInfoList.Add(AlbumTitle);
}

RotationCode = 0;
if (RotateInfoList.Count > 1)
{
    RotateInfo.Start();
}
else
{
    RotateInfo.Stop();
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(IsFullscreen.Value)]
if (#IsFullscreen.Value #)
{
    IsFullscreen.Description = zuneUI:Shell.LoadString(zuneUI:StringId.IDS_FULLSCREEN_OFF);
}
else
{
    IsFullscreen.Description = zuneUI:Shell.LoadString(zuneUI:StringId.IDS_FULLSCREEN_ON);
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(LibraryAlbumInfo.AlbumArtUrl)]
if (LibraryAlbumInfo != null)
{
    BigImageSelector.ImageUri = #LibraryAlbumInfo.AlbumArtUrl #;
}
else
{
    BigImageSelector.ImageUri = null;
}
]]></Script>
      <Script><![CDATA[
Null content = null;
if (!List.IsNullOrEmpty(RotateInfoList))
{
    RotationCode = RotationCode % RotateInfoList.Count;
    content = (string)RotateInfoList[RotationCode];
}

RotatingPlayInfo = content;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(RotateInfo.Tick)]
RotationCode = RotationCode + 1;
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(Rotate.Invoked)]
RotationCode = RotationCode + 1;
if (RotateInfo.Enabled)
{
    RotateInfo.Stop();
    RotateInfo.Start();
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(NowPlayingBackgroundHelper.Visible)]
MPTrackQuery.Enabled = false;
MPTrackQuery.Id = null;
zuneUI:PlaybackTrack currentTrack = zuneUI:TransportControls.Instance.CurrentTrack;
if (#NowPlayingBackgroundHelper.Visible # && NowPlayingBackgroundHelper.Visible || !currentTrack.IsInVisibleCollection && util:FeatureEnablement.IsFeatureEnabled(zuneDBApi:Features.eMusic))
{
    MPTrackQuery.Id = TrackId.ToString();
    MPTrackQuery.Enabled = true;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(NowPlayingBackgroundHelper.Visible)]
ArtistPhotosQuery.Enabled = false;
ArtistPhotosQuery.Id = null;
ArtistBiographyQuery.Enabled = false;
ArtistBiographyQuery.Id = null;
ArtistQuery.Enabled = false;
ArtistQuery.Id = null;
TopListenersQuery.Enabled = false;
TopListenersQuery.ArtistId = null;
zuneUI:PlaybackTrack currentTrack = zuneUI:TransportControls.Instance.CurrentTrack;
if (((!zuneUI:GuidHelper.IsEmpty(ArtistId) && #NowPlayingBackgroundHelper.Visible # && util:FeatureEnablement.IsFeatureEnabled(zuneDBApi:Features.eMusic) && configuration:ClientConfiguration.Playback.ShowNowPlayingClipAnimations) && (iris:Application.RenderingQuality == iris:RenderingQuality.MaxQuality)) && (currentTrack != null) && currentTrack.IsMusic)
{
    ArtistPhotosQuery.Id = ArtistId.ToString();
    ArtistPhotosQuery.Enabled = true;
    if (!string.IsNullOrEmpty(ArtistQuery.Result.Item.BiographyLink))
    {
        ArtistBiographyQuery.Id = ArtistId.ToString();
        ArtistBiographyQuery.Enabled = true;
    }

    ArtistQuery.Id = ArtistId.ToString();
    ArtistQuery.Enabled = true;
    TopListenersQuery.ArtistId = ArtistId.ToString();
    TopListenersQuery.Enabled = true;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(ArtistQuery.Status)]
if (ArtistQuery.Enabled && #ArtistQuery.Status # == iris:DataProviderQueryStatus.Complete)
{
    TotalArtistPlays = ArtistQuery.Result.Item.PlayCount;
    ArtistData = ArtistQuery.Result;
    ArtistGenres = ArtistData.Item.Genres;
    ArtistMoods = ArtistData.Item.Moods;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(TopListenersQuery.Status)]
if ((TopListenersQuery.Enabled && #TopListenersQuery.Status # == iris:DataProviderQueryStatus.Complete) && (TopListenersQuery.Result.Profiles.Count > 0))
{
    schema1:ProfileData profile = (schema1:ProfileData)TopListenersQuery.Result.Profiles[0];
    TopListenerTag = profile.ZuneTag;
    TopListenerPlays = profile.PlayCount;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(ArtistPhotosQuery.Status)]
if (ArtistPhotosQuery.Enabled && #ArtistPhotosQuery.Status # == iris:DataProviderQueryStatus.Complete)
{
    ArtistImages = null;
    SelectedArtistImages = null;
    ArtistImageIndex = 0;
    ArtistPhotos = ArtistPhotosQuery.Result;
    if (ArtistPhotos.Items.Count > 0)
    {
        schema2:Photo photo = (schema2:Photo)ArtistPhotos.Items[0];
        ArtistImageSelector.ImageId = photo.ImageId;
        ArtistImageSelector.Image = null;
    }
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(ArtistBiographyQuery.Status)]
if (ArtistBiographyQuery.Enabled && #ArtistBiographyQuery.Status # == iris:DataProviderQueryStatus.Complete)
{
    ArtistBio = ArtistBiographyQuery.Result.BiographyContent;
    ArtistBioAuthor = ArtistBiographyQuery.Result.BiographyAuthor;
}
]]></Script>
      <Script><![CDATA[
[DeclareTrigger(ArtistImageSelector.Image)]
if (#ArtistImageSelector.Image # != null)
{
    if (ArtistImageSelector.Image != FallbackImage)
    {
        if (SelectedArtistImages == null)
        {
            SelectedArtistImages = new List();
        }

        SelectedArtistImages.Add(ArtistImageSelector.Image);
    }

    ArtistImageIndex = ArtistImageIndex + 1;
    if (ArtistImageIndex < ArtistPhotos.Items.Count)
    {
        schema2:Photo photo = (schema2:Photo)ArtistPhotos.Items[ArtistImageIndex];
        ArtistImageSelector.ImageId = photo.ImageId;
        ArtistImageSelector.Image = null;
    }
    else
    {
        if ((SelectedArtistImages != null) && (SelectedArtistImages.Count >= 2))
        {
            ArtistImages = SelectedArtistImages;
        }
    }
}
]]></Script>
      <Script><![CDATA[
if (ExtendedPlayInfo != null)
{
    if (!string.IsNullOrEmpty(TrackTitle) && !ExtendedPlayInfo.Contains(TrackTitle))
    {
        ExtendedPlayInfo.Add(TrackTitle);
    }

    if (!string.IsNullOrEmpty(AlbumTitle) && !ExtendedPlayInfo.Contains(AlbumTitle))
    {
        ExtendedPlayInfo.Add(AlbumTitle);
    }

    if (TotalTrackPlays > 0)
    {
        Null text = null;
        if (TotalTrackPlays == 1)
        {
            text = zuneUI:Shell.LoadString(zuneUI:StringId.IDS_NOWPLAYING_TRACK_PLAYS_SINGULAR);
        }
        else
        {
            text = string.Format(zuneUI:Shell.LoadString(zuneUI:StringId.IDS_NOWPLAYING_TRACK_PLAYS), TotalTrackPlays);
        }

        if (!ExtendedPlayInfo.Contains(text))
        {
            ExtendedPlayInfo.Add(text);
        }
    }

    if (!string.IsNullOrEmpty(ArtistName) && !ExtendedPlayInfo.Contains(ArtistName))
    {
        ExtendedPlayInfo.Add(ArtistName);
    }

    if (TotalArtistPlays > 0)
    {
        text = null;
        if (TotalArtistPlays == 1)
        {
            text = zuneUI:Shell.LoadString(zuneUI:StringId.IDS_NOWPLAYING_ARTIST_PLAYS_SINGULAR);
        }
        else
        {
            text = string.Format(zuneUI:Shell.LoadString(zuneUI:StringId.IDS_NOWPLAYING_ARTIST_PLAYS), TotalArtistPlays);
        }

        if (!ExtendedPlayInfo.Contains(text))
        {
            ExtendedPlayInfo.Add(text);
        }
    }

    if (!string.IsNullOrEmpty(TopListenerTag) && TopListenerPlays > 0)
    {
        text = null;
        if (TopListenerPlays == 1)
        {
            text = string.Format(zuneUI:Shell.LoadString(zuneUI:StringId.IDS_NOWPLAYING_TOP_LISTENER_PLAYS_SINGULAR), TopListenerTag);
        }
        else
        {
            text = string.Format(zuneUI:Shell.LoadString(zuneUI:StringId.IDS_NOWPLAYING_TOP_LISTENER_PLAYS), TopListenerTag, TopListenerPlays);
        }

        if (!ExtendedPlayInfo.Contains(text))
        {
            ExtendedPlayInfo.Add(text);
        }
    }
}
]]></Script>
    </Scripts>
    <Methods><![CDATA[
void private_ResetImageSelectors()
{
    BigImageSelector.ImageId = zuneUI:GuidHelper.Empty;
    TinyImageSelector.ImageId = zuneUI:GuidHelper.Empty;
    BigImageSelector.ImageUri = "";
    TinyImageSelector.ImageUri = "";
}
]]></Methods>
  </Class>
</UIX>