<commit_before>﻿using System;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using GiTracker.Models;
using GiTracker.Services.Api;
using Prism.Commands;
using Prism.Navigation;

namespace GiTracker.ViewModels
{
    public class IssueListViewModel : BaseViewModel
    {
        readonly IGitApiService _gitApiService;
        readonly INavigationService _navigationService;

        public IssueListViewModel(IGitApiServiceFactory gitApiServiceFactory,
            INavigationService navigationService)
        {
            _gitApiService = gitApiServiceFactory.GetApiService();
            _navigationService = navigationService;
        }

        public override void OnNavigatedTo(NavigationParameters parameters)
        {
            base.OnNavigatedTo(parameters);

            UpdateIssues();
        }

        ObservableCollection<IIssue> _issues = new ObservableCollection<IIssue>();
        public ObservableCollection<IIssue> Issues
        {
            get { return _issues; }
            private set { SetProperty(ref _issues, value); }
        }

        Task LoadIssuesAsync()
        {
            return Loader.LoadAsync(async (cancellationToken) =>
            {
                var issues = await _gitApiService.GetIssuesAsync(cancellationToken);
                Issues = new ObservableCollection<IIssue>(issues);
            });
        }

        DelegateCommand _updateIssuesCommand;
        public DelegateCommand UpdateIssuesCommand
        {
            get { return _updateIssuesCommand ?? (_updateIssuesCommand = new DelegateCommand(UpdateIssues)); }
        }

        async void UpdateIssues()
        {
            try
            {
                await LoadIssuesAsync();
            }
            catch (Exception e)
            { }
        }

        DelegateCommand<IIssue> _openIssueDetailsCommand;
        public DelegateCommand<IIssue> OpenIssueDetailsCommand
        {
            get { return _openIssueDetailsCommand ?? (_openIssueDetailsCommand = new DelegateCommand<IIssue>(OpenIssueDetails)); }
        }

        void OpenIssueDetails(IIssue issue)
        {
            _navigationService.Navigate<IssueDetailsViewModel>(new NavigationParameters { { IssueDetailsViewModel.IssueParameterName, issue } });<commit_msg>Play around with loading issues<commit_after>﻿using System;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using GiTracker.Models;
using GiTracker.Services.Api;
using Prism.Commands;
using Prism.Navigation;

namespace GiTracker.ViewModels
{
    public class IssueListViewModel : BaseViewModel
    {
        readonly IGitApiService _gitApiService;
        readonly INavigationService _navigationService;

        public IssueListViewModel(IGitApiServiceFactory gitApiServiceFactory,
            INavigationService navigationService)
        {
            _gitApiService = gitApiServiceFactory.GetApiService();
            _navigationService = navigationService;
        }

        public override async void OnNavigatedTo(NavigationParameters parameters)
        {
            base.OnNavigatedTo(parameters);

            await LoadIssuesAsync();
        }

        ObservableCollection<IIssue> _issues = new ObservableCollection<IIssue>();
        public ObservableCollection<IIssue> Issues
        {
            get { return _issues; }
            private set { SetProperty(ref _issues, value); }
        }

        async Task LoadIssuesAsync()
        {
            try
            {
                await Loader.LoadAsync(async (cancellationToken) =>
                {
                    var issues = await _gitApiService.GetIssuesAsync(cancellationToken);
                    Issues = new ObservableCollection<IIssue>(issues);
                });
            }
            catch (Exception e)
            { }
        }

        DelegateCommand _updateIssuesCommand;
        public DelegateCommand UpdateIssuesCommand
        {
            get { return _updateIssuesCommand ?? (_updateIssuesCommand = new DelegateCommand(UpdateIssues)); }
        }

        async void UpdateIssues()
        {
            await LoadIssuesAsync();
        }

        DelegateCommand<IIssue> _openIssueDetailsCommand;
        public DelegateCommand<IIssue> OpenIssueDetailsCommand
        {
            get { return _openIssueDetailsCommand ?? (_openIssueDetailsCommand = new DelegateCommand<IIssue>(OpenIssueDetails)); }
        }

        void OpenIssueDetails(IIssue issue)
        {
            _navigationService.Navigate<IssueDetailsViewModel>(new NavigationParameters { { IssueDetailsViewModel.IssueParameterName, issue } });
{'fraction_non_alphanumeric': 0.06704152249134948, 'fraction_numerical': 0.0, 'mean_word_length': 2.370991253644315, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '2389480', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1092, 'n_words': 221}