<commit_before>﻿using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using BloodApp.Core.Services;
using MvvmCross.Core.ViewModels;
using MvvmCross.Platform;

namespace BloodApp.Core.ViewModels
{
	public class BloodDonationListViewModel : MvxViewModel
	{

		private ObservableCollection<BloodDonationListItemViewModel> _donationsCollection;
		private readonly Lazy<IBloodDonationService> _eventService;


		public ObservableCollection<BloodDonationListItemViewModel> DonationsCollection
		{
			get { return this._donationsCollection; }
			set
			{
				this._donationsCollection = value;
				this.RaisePropertyChanged();
			}
		}

		public BloodDonationListViewModel()
		{
			this._eventService = new Lazy<IBloodDonationService>(Mvx.Resolve<IBloodDonationService>);
			this._donationsCollection = new ObservableCollection<BloodDonationListItemViewModel>();
		}


		protected async Task LoadData()
		{
			var events = await this._eventService.Value.ListAllBloodDonationsAsync();
			this.DonationsCollection = new ObservableCollection<BloodDonationListItemViewModel>(events.Select(e => new BloodDonationListItemViewModel(e)));
		}

		public override async void Start()
		{
			base.Start();
			await this.LoadData();
		}
	}
}<commit_msg>added try-catch block to BloodDonationVM<commit_after>﻿using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using BloodApp.Core.Services;
using BloodApp.Core.Services.Exceptions;
using MvvmCross.Core.ViewModels;
using MvvmCross.Platform;

namespace BloodApp.Core.ViewModels
{
	public class BloodDonationListViewModel : MvxViewModel
	{

		private ObservableCollection<BloodDonationListItemViewModel> _donationsCollection;
		private readonly Lazy<IBloodDonationService> _eventService;


		public ObservableCollection<BloodDonationListItemViewModel> DonationsCollection
		{
			get { return this._donationsCollection; }
			set
			{
				this._donationsCollection = value;
				this.RaisePropertyChanged();
			}
		}

		public BloodDonationListViewModel()
		{
			this._eventService = new Lazy<IBloodDonationService>(Mvx.Resolve<IBloodDonationService>);
			this._donationsCollection = new ObservableCollection<BloodDonationListItemViewModel>();
		}


		protected async Task LoadData()
		{
			try {
				var events = await this._eventService.Value.ListAllBloodDonationsAsync();
				this.DonationsCollection = new ObservableCollection<BloodDonationListItemViewModel>(events
						.Select(e => new BloodDonationListItemViewModel(e)));
			} catch (ServiceException ex) {
				//todo: handle it (some toast)
			}
		}

		public override async void Start()
		{
			base.Start();
			await this.LoadData();
		}
	}
}
{'fraction_non_alphanumeric': 0.08593463092177746, 'fraction_numerical': 0.0, 'mean_word_length': 5.364485981308412, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4735841', 'n_tokens_mistral': 909, 'n_tokens_neox': 779, 'n_words': 148}