﻿// Copyright (c) Alex Hardwicke. All rights reserved.
// Licensed under the MIT licence. See LICENCE file in the project root for full licence information.

using Auth.Models;
using Windows.UI.Xaml;

namespace Auth.ViewModels
{
    public class FirstRunPageViewModel : CodeViewModelBase
    {
        public override void AddCode()
        {
            _settings.AddCode(new AuthCode(Name, Secret.Replace(" ", "")));
            NavigateToMainPage();
        }

        public override void Cancel()
        {
            NavigateToMainPage();
        }

        private void NavigateToMainPage()
        {
            (Application.Current as App).InitialiseShell();
            NavigationService = (Application.Current as App).NavigationService;
            NavigationService.Navigate(typeof(Views.MainPage));
            NavigationService.ClearHistory();
        }
    }
}
