Exemplo n.º 1
0
        private async Task <IEnumerable <SessionGroup> > Load()
        {
            Username = await CardboardKnight.Username();

            var plays = await CardboardKnight.RetrievePlays();

            if (!plays.Any())
            {
                plays = await CardboardKnight.FetchPlays();
            }

            var user = await CardboardKnight.Username();

            foreach (var p in plays)
            {
                p.User = user;
            }

            var results = plays
                          .GroupBy(p => p.Date, p => p, (key, g) => new SessionGroup(g.ToList())
            {
                Date = key
            })
                          .OrderByDescending(i => i.Date);

            Sessions = new ObservableCollection <SessionGroup>(results);

            return(Sessions);
        }
        private async Task Appearing()
        {
            string username;

            username = await CardboardKnight.Username();

            if (string.IsNullOrEmpty(username)) // if no user name, launch the login experience
            {
                await _navigationService.Navigate <LoginViewModel>();
            }
            else
            {
                await _navigationService.Navigate <MenuViewModel>();

                await _navigationService.Navigate <HomeViewModel>();
            }
        }