<commit_before>﻿using TimelineForms.Common;
using GalaSoft.MvvmLight.Views;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace TimelineForms.Services
{
    public enum HistoryBehavior
    {
        Default,
        ClearHistory
    }

    public class NavigationService : INavigationService
    {
        private Dictionary<string, Type> pages { get; } = new Dictionary<string, Type>();

        public string CurrentPageKey { get; private set; }

        public Page MainPage => Application.Current.MainPage;

        public void Configure(string key, Type pageType) => pages.Add(key, pageType);

        #region INavigationService implementation

        public void GoBack()
        {
            if (MainPage.Navigation.ModalStack.Count > 0)
                MainPage.Navigation.PopModalAsync();
            else<commit_msg>Add support for MasterDetailPage<commit_after>﻿using TimelineForms.Common;
using GalaSoft.MvvmLight.Views;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace TimelineForms.Services
{
    public enum HistoryBehavior
    {
        Default,
        ClearHistory
    }

    public class NavigationService : INavigationService
    {
        private Dictionary<string, Type> pages { get; } = new Dictionary<string, Type>();

        public string CurrentPageKey { get; private set; }

        public Page MainPage
        {
            get
            {
                var page = Application.Current.MainPage;
                if (page is MasterDetailPage)
                    page = (page as MasterDetailPage).Detail;

                return page;
            }
        }

        public void Configure(string key, Type pageType) => pages.Add(key, pageType);

        #region INavigationService implementation

        public void GoBack()
        {
            if (MainPage.Navigation.ModalStack.Count > 0)
                MainPage.Navigation.PopModalAsync();
            else
{'fraction_non_alphanumeric': 0.07785547785547786, 'fraction_numerical': 0.0009324009324009324, 'mean_word_length': 2.4612903225806453, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 12, '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': '3436747', 'n_tokens_mistral': 558, 'n_tokens_neox': 542, 'n_words': 147}