示例#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;
            }
        }
示例#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;
     }
 }
示例#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;
            }
        }
示例#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;
            }
        }