Example #1
0
        public async Task <IEnumerable <Liste> > GetListeAsync(ListenTyp listenTyp, bool forceRefresh = false)
        {
#if !__WASM__
            if (forceRefresh)
            {
                Barrel.Current.Empty("liste_" + listenTyp.ToString());
            }

            if (!Barrel.Current.IsExpired("liste_" + listenTyp.ToString()) || !IsOnline())
            {
                return(Barrel.Current.Get <IEnumerable <Liste> >("liste_" + listenTyp.ToString()));
            }
#endif

            var client = GetClient(_apiKey);
            try
            {
                var result = await client.GetAsync("listen/" + listenTyp.ToString(), HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false);

                var resultContent = await result.Content.ReadAsAsync <List <VolleMoehre.Contracts.Model.Liste> >();

#if !__WASM__
                Barrel.Current.Add <IEnumerable <Liste> >("liste_" + listenTyp.ToString(), resultContent, TimeSpan.FromDays(180));
#endif

                return(resultContent);
            }
            catch (Exception ex)
            {
            }
            return(new List <VolleMoehre.Contracts.Model.Liste>());
        }
Example #2
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            _listentyp = (Contracts.Model.ListenTyp)e.Parameter;

            await InitAsync();
        }