예제 #1
0
        private async Task LoadAllAsync(HttpQueryDispatcher dispatcher, HttpQueryDispatcher.Next next, ListAllCurrency listAll)
        {
            models.Clear();
            if (!serverConnection.IsAvailable)
            {
                var items = await localStorage.LoadAsync();

                if (items != null)
                {
                    models.AddRange(items);
                    return;
                }
            }

            if (dispatcher != null)
            {
                models.AddRange(await dispatcher.QueryAsync(listAll));
            }
            else
            {
                models.AddRange((List <CurrencyModel>) await next(listAll));
            }

            await localStorage.SaveAsync(models);
        }
예제 #2
0
        private async Task LoadAllAsync(ListAllCurrency listAll, HttpQueryDispatcher.Next next)
        {
            models.Clear();
            if (!network.IsOnline)
            {
                var items = await localStorage.LoadAsync();

                if (items != null)
                {
                    models.AddRange(items);
                    return;
                }
            }

            models.AddRange((List <CurrencyModel>) await next(listAll));
            await localStorage.SaveAsync(models);
        }