WeeXnesSuite/WeeXnes/Views/ProfileView/LoginView.xaml.cs
2023-11-21 21:02:39 +01:00

49 lines
No EOL
1.2 KiB
C#

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using WeeXnes.Core;
namespace WeeXnes.Views.ProfileView
{
public partial class LoginView : Page
{
public static bool alreadyLoggedIn = false;
public static UpdateVar<string> errorStringCache = new UpdateVar<string>();
public LoginView()
{
InitializeComponent();
}
private void SwitchToProfileView()
{
NavigationService.Navigate(new Uri("/Views/ProfileView/ProfileView.xaml",UriKind.Relative));
}
private void LoginView_OnLoaded(object sender, RoutedEventArgs e)
{
if (alreadyLoggedIn)
{
SwitchToProfileView();
}
}
private void LoginButton_OnClick(object sender, RoutedEventArgs e)
{
attemptLogin();
}
private void InputKeydown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
attemptLogin();
}
private void attemptLogin()
{
ProfileView.auth._email = tb_email.Text;
ProfileView.auth._password = tb_password.Text;
SwitchToProfileView();
}
}
}