using System.Windows;
using WPF_Sample.Views.Examples;
using WPF_Sample.Views;
using WPF_Sample.Views.Tools;

namespace WPF_Sample
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {

        #region Members

        private Overview _about;
        private Settings _settings;
        private UserInfo _userInfo;
        private SSO _sso;
        private TimeCard _timeCard;
        private RestSample _restSample;
        private TokenGenerator _tokenGen;
        
        #endregion

        #region Constructor

        public MainWindow()
        {
            InitializeComponent();
            _about = new Overview();
            _mainFrame.NavigationService.Navigate(_about);
        }

        #endregion

        #region Private Event Methods

        private void About_Click(object sender, RoutedEventArgs e)
        {
            _mainFrame.NavigationService.Navigate(_about);
        }

        private void Settings_Click(object sender, RoutedEventArgs e)
        {
            _settings = (_settings == null) ? new Settings() : _settings;
            _mainFrame.NavigationService.Navigate(_settings);
        }

        private void Examples_Click(object sender, RoutedEventArgs e)
        {
            _userInfo = (_userInfo == null) ? new UserInfo() : _userInfo;
            _mainFrame.NavigationService.Navigate(_userInfo);
        }

        private void SSO_Click(object sender, RoutedEventArgs e)
        {
            _sso = (_sso == null) ? new SSO() : _sso;
            _mainFrame.NavigationService.Navigate(_sso);
        }

        private void TimeCards_Click(object sender, RoutedEventArgs e)
        {
            _timeCard = (_timeCard == null) ? new TimeCard() : _timeCard;
            _mainFrame.NavigationService.Navigate(_timeCard);

        }

        private void RestSample_Click(object sender, RoutedEventArgs e)
        {
            _restSample = (_restSample == null) ? new RestSample() : _restSample;
            _mainFrame.NavigationService.Navigate(_restSample);

        }

        private void TokenGenerator_Click(object sender, RoutedEventArgs e)
        {
            _tokenGen = (_tokenGen == null) ? new TokenGenerator() : _tokenGen;
            _mainFrame.NavigationService.Navigate(_tokenGen);

        }

        

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Height = 768;
            Width = 1024;
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (_settings != null)
            {
                _settings.Save();
            }
        }

        #endregion

    }
}
