<commit_before>﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using Eagleslist.Controls;

namespace Eagleslist
{
    public class NavigationManager
    {
        private static MainWindow _mainWindow
        {
            get
            {
                return ((MainWindow)Application.Current.MainWindow);
            }
        }

        private static int _navIndexBacking = -1;
        private static int _navigationIndex
        {
            get
            {
                return _navIndexBacking;
            }

            set
            {
                _navIndexBacking = value;

                if (NavigationStateChangeListener != null)
                {
                    NavigationStateChangeListener();
                }
            }
        }

        private static List<NavigationContext> _navigationStack = new List<NavigationContext>();
        private static Dictionary<ContentControl, Type> _buttonAssociations = new Dictionary<ContentControl, Type>();

        public static Action _navigationStateChangeListener;
        public static Action NavigationStateChangeListener
        {
            get
            {
                return _navigationStateChangeListener;
            }

            set
            {
                _navigationStateChangeListener = value;

                if (_navigationStateChangeListener != null)
                {
                    _navigationStateChangeListener();
                }
            }
        }

        public static bool CanGoBack
        {
            get
            {
                return _navigationIndex > 0;
            }
        }

        public static bool CanGoForward
        {
            get
            {
                return _navigationIndex >= 0 && _navigationIndex < _navigationStack.Count - 1;
            }
        }

        public static void AddAssociation<T>(ContentControl button) where T : Navigatable, new()
        {
            _buttonAssociations.Add(button, typeof(T));
        }

        public static void ClearAllAssociations()
        {
            _buttonAssociations.Clear();
        }

        public static void NavigateFromClick(ContentControl contentControl, object obj)
        {
            //if (contentControl is SearchButton)
            //{
            //    var searchButton = (SearchButton)contentControl;
            //    Console.WriteLine(searchButton.isSelected);

            //    if (searchButton.isSelected)
            //    {
            //        if (_navigationIndex >= 0
            //            && _navigationIndex < _navigationStack.Count
            //            && _navigationStack[_navigationIndex].Type.Equals(typeof(SearchControl)))
            //        {
            //            NavigateBack();
            //            return;
            //        }

            //        return;
            //    }
            //}
            
            if (contentControl is SearchButton)
            {<commit_msg>Removed dead code<commit_after>﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using Eagleslist.Controls;

namespace Eagleslist
{
    public class NavigationManager
    {
        private static MainWindow _mainWindow
        {
            get
            {
                return ((MainWindow)Application.Current.MainWindow);
            }
        }

        private static int _navIndexBacking = -1;
        private static int _navigationIndex
        {
            get
            {
                return _navIndexBacking;
            }

            set
            {
                _navIndexBacking = value;

                if (NavigationStateChangeListener != null)
                {
                    NavigationStateChangeListener();
                }
            }
        }

        private static List<NavigationContext> _navigationStack = new List<NavigationContext>();
        private static Dictionary<ContentControl, Type> _buttonAssociations = new Dictionary<ContentControl, Type>();

        public static Action _navigationStateChangeListener;
        public static Action NavigationStateChangeListener
        {
            get
            {
                return _navigationStateChangeListener;
            }

            set
            {
                _navigationStateChangeListener = value;

                if (_navigationStateChangeListener != null)
                {
                    _navigationStateChangeListener();
                }
            }
        }

        public static bool CanGoBack
        {
            get
            {
                return _navigationIndex > 0;
            }
        }

        public static bool CanGoForward
        {
            get
            {
                return _navigationIndex >= 0 && _navigationIndex < _navigationStack.Count - 1;
            }
        }

        public static void AddAssociation<T>(ContentControl button) where T : Navigatable, new()
        {
            _buttonAssociations.Add(button, typeof(T));
        }

        public static void ClearAllAssociations()
        {
            _buttonAssociations.Clear();
        }

        public static void NavigateFromClick(ContentControl contentControl, object obj)
        {            
            if (contentControl is SearchButton)
            {
{'fraction_non_alphanumeric': 0.06454613095238096, 'fraction_numerical': 0.0016741071428571428, 'mean_word_length': 1.3176724137931035, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 18, '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': '2111773', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1139, 'n_words': 259}