<?xml version="1.0" encoding="utf-8" ?>

<component name="AccountScreenDialog" extends="StandardDialog" initialFocus="buttonArea" >

<script type="text/brightscript" >
<![CDATA[
function init()
    m.top.width  = "1380"

    m.buttonArea = m.top.findNode("buttonArea")
	m.primaryTitle = m.top.findNode("primaryTitle")
	m.contentArea = m.top.findNode("contentArea")
	
	m.primaryTitle.primaryTitle = tr("Usuário")
	
    m.top.observeFieldScoped("buttonSelected", "printSelectedButtonAndClose")
    m.top.observeFieldScoped("wasClosed", "wasClosedChanged")
	
    buttonDataArray = [ { text: tr("Cancel") } ]
    for each buttonData in buttonDataArray
        button = m.buttonArea.createChild("StdDlgButton")
        button.text = buttonData.text
        m.buttonArea.appendChild(button)
    end for
	
	storeLinkedUsers()
	
end function

Sub storeLinkedUsers()

    textItem = m.contentArea.createChild("StdDlgTextItem")
    'Populate linked user list
	str = tr("Usuário: ") + m.global.user
	never = m.global.expire
	if m.global.expire <> "Never"
	    dt = CreateObject("roDateTime")
	    dt.fromSeconds(m.global.expire.toInt())
	    never =dt.AsDateString("short-month-no-weekday")
	end if
	str = str + chr(10) + tr("Validade: ") + tr(never)
	str = str + chr(10) + tr("Dispositivo: ") + m.global.GetModel
	str = str + chr(10) + tr("Conexões: ") + m.global.active_cons
	str = str + chr(10) + tr("Máximo de conexões: ") + m.global.max_connections
	str = str + chr(10) + tr("Serial: ") + m.global.rokuUniqueID
	if m.global.email <> ""
	    str = str + chr(10)  + tr("Email: ") + m.global.email
	end if
    'Store content node and current registry selection
    textItem.text = str
	m.contentArea.appendChild(textItem)
End Sub

sub printFocusButton()
    print "m.buttonArea button ";m.buttonArea.getChild(m.top.buttonFocused).text;" focused"
end sub

sub printSelectedButtonAndClose()
    print "m.buttonArea button ";m.buttonArea.getChild(m.top.buttonSelected).text;" selected"
    m.top.close = true
end sub

sub wasClosedChanged()
    print "SideCardRightDialog Closed"
end sub

]]>
</script>

<children>
  <StdDlgTitleArea id ="primaryTitle" />
  <StdDlgContentArea id ="contentArea"/>
  <StdDlgButtonArea id="buttonArea" />
  <StdDlgSideCardArea id="buttonArea" horizAlign="left" extendToDialogEdge="true" showDivider="false"  >
	  <Poster id="sideCardPoster" loadSync="true" loadDisplayMode="limitSize" uri="pkg:/images/MountainLakeSideCard.jpg" translation="[0.0, 0.0]" />
	  <SimpleLabel text="" vertOrigin="bottom" horizOrigin="right" translation="[575, 775]" color="0xFFFFFFFF" fontUri="font:SystemFontFile" fontSize="24"/>      	  
  </StdDlgSideCardArea>
</children>

</component>