Exemplo n.º 1
0
        void LoadEntries()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            LogEntries.Clear();

            try
            {
                _cache.GetAndFetchLatest("entries", async()
                                         => await _tripLogService.GetEntriesAsync())
                .Subscribe(entries
                           => LogEntries = new ObservableCollection <TripLogEntry>(entries));
            }
            catch (Exception e)
            {
                AnalyticsService.TrackError(e,
                                            new Dictionary <string, string>
                {
                    { "Method", "MainViewModel.LoadEntries()" }
                });
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 2
0
 private void LoadEntries()
 {
     if (IsBusy)
     {
         return;
     }
     IsBusy = true;
     LogEntries.Clear();
     try
     {
         _cache.GetAndFetchLatest("entries", async() => await _tripLogService.GetEntriesAsync())
         .Subscribe(x => LogEntries = new ObservableCollection <TripLogEntry>(x),
                    ex => System.Diagnostics.Debug.WriteLine("No Key"));
     }
     finally
     {
         IsBusy = false;
     }
 }
Exemplo n.º 3
0
        void LoadEntries()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            LogEntries.Clear();

            try
            {
                //Load data from the cache and then get entries from azure database
                _cache.GetAndFetchLatest("entries", async() => await _tripLogDataService.GetEntriesAsync())
                .Subscribe(entries => LogEntries = new ObservableCollection <TripLogEntry>(entries));
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 4
0
        void LoadEntries()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            LogEntries.Clear();

            try
            {
                // Load from local cache and then immediately load from API
                _cache.GetAndFetchLatest("entries", async() => await _tripLogService.GetEntriesAsync())
                .Subscribe(entries => LogEntries = new ObservableCollection <TripLogEntry>(entries));
            }
            finally
            {
                IsBusy = false;
            }
        }