namespace TornadoAce_CJOnStyle.Views
{
    /// <summary>
    /// A simple page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public partial class MainPage : Page
    {
        private readonly MainViewModel viewModel = new();

        public MainPage()
        {
            this.InitializeComponent();
            Loaded += MainPage_Loaded;
        }

        public MainViewModel ViewModel => viewModel;

        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            LoginIntroStoryboard.Begin();
            OperatorNameTextBox.Focus(FocusState.Programmatic);
        }

        private async void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            ViewModel.BeginLogin(OperatorNameTextBox.Text, OperatorPasswordBox.Password);
            await Task.Delay(1050);
            ViewModel.CompleteLogin();
        }
    }
}
