From cf4554b7e60a147d3ad9c4c5d951c69c0143ea7b Mon Sep 17 00:00:00 2001 From: Nick Bisby Date: Sun, 10 Feb 2019 14:47:24 -0600 Subject: [PATCH] Begin work on server selection screen --- components/ServerSelect.brs | 9 +++++++ components/ServerSelect.xml | 21 +++++++++++++++ components/signin.xml | 22 --------------- source/Main.brs | 53 +++++++++++++++++++++++++++---------- 4 files changed, 69 insertions(+), 36 deletions(-) create mode 100644 components/ServerSelect.brs create mode 100644 components/ServerSelect.xml delete mode 100644 components/signin.xml diff --git a/components/ServerSelect.brs b/components/ServerSelect.brs new file mode 100644 index 00000000..47397049 --- /dev/null +++ b/components/ServerSelect.brs @@ -0,0 +1,9 @@ +sub init() + print "HI" + m.top.backgroundColor = "#000b35" + r = m.top.findNode("theRect") + print(r) + m.top.visible = true + print "HI" + m.top.setFocus(true) +end sub diff --git a/components/ServerSelect.xml b/components/ServerSelect.xml new file mode 100644 index 00000000..2466db02 --- /dev/null +++ b/components/ServerSelect.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + - - diff --git a/source/Main.brs b/source/Main.brs index 417d3734..d9910b91 100644 --- a/source/Main.brs +++ b/source/Main.brs @@ -1,25 +1,26 @@ sub Main() - 'Indicate this is a Roku SceneGraph application' - globals() - - screen = CreateObject("roSGScreen") - m.port = CreateObject("roMessagePort") - screen.setMessagePort(m.port) if get_setting("server") = invalid then - set_setting("server", get_var("server")) - screen.CreateScene("ServerSelect") - screen.show() - ' TODO - Do server select logic here + print("SERVER IS MISSING") + ShowServerSelect() end if + print("WE MOVED ON") + m.port = CreateObject("roMessagePort") if get_setting("active_user") = invalid then + screen = CreateObject("roSGScreen") + screen.setMessagePort(m.port) + screen.CreateScene("UserSignIn") screen.show() ' TODO - sign in here - get_token(get_var("username"), get_var("password")) + await_response() + screen.close() end if + screen = CreateObject("roSGScreen") + screen.setMessagePort(m.port) + first_scene = "Library" 'Create a scene and load a component' m.scene = screen.CreateScene(first_scene) @@ -30,6 +31,8 @@ sub Main() 'librow.GetRowListContent() + print 1 + "halt" + while(true) msg = wait(0, m.port) msgType = type(msg) @@ -39,8 +42,30 @@ sub Main() end while end sub +sub ShowServerSelect() + screen = CreateObject("roSGScreen") + m.port = CreateObject("roMessagePort") + screen.setMessagePort(m.port) + scene = screen.CreateScene("ServerSelect") + screen.show() -function get_var(key as String) - return GetGlobalAA().Lookup(key) -end function + while(true) + msg = wait(0, m.port) + msgType = type(msg) + if msgType = "roSGScreenEvent" + if msg.isScreenClosed() then return + end if + + end while +end sub + +sub await_response() + while(true) + msg = wait(0, m.port) + msgType = type(msg) + if msgType = "roSGScreenEvent" + if msg.isScreenClosed() then return + end if + end while +end sub