在编译和运行时,当我尝试在Google Chrome或Mozilla Firefox中加载页面时,它只显示在圈子中旋转的蓝色进度事件,并且在瞬间显示百分比然后消失
整个LoginPage的代码
public partial class LoginPage : UserControl
{
public bool UsernameExists = false;
public bool PasswordExists = false;
public bool SchoolExists = false;
public LoginPage()
{
InitializeComponent();
}
private void username_autocompletebox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//Checks if user entered all neccessary values, enables Login_button if so
if (username_autocompletebox.Text.Length != 0)
{
UsernameExists = true;
}
else
{
UsernameExists = false;
}
if (UsernameExists = true && PasswordExists == true && SchoolExists == true)
{
Login_button.IsEnabled = true;
}
else
{
Login_button.IsEnabled = false;
}
}
private void password_passwordbox_PasswordChanged(object sender, RoutedEventArgs e)
{
//Checks if user entered all neccessary values, enables Login_button if so
if (password_passwordbox.Password.Length != 0)
{
PasswordExists = true;
}
else
{
PasswordExists = false;
}
if (UsernameExists = true && PasswordExists == true && SchoolExists == true)
{
Login_button.IsEnabled = true;
}
else
{
Login_button.IsEnabled = false;
}
}
private void school_combobox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//Checks if user entered all neccessary values, enables Login_button if so
if (school_combobox.SelectedItem != null && school_combobox.SelectedItem.ToString() != "Select a School")
{
SchoolExists = true;
}
else
{
SchoolExists = false;
}
if (UsernameExists = true && PasswordExists == true && SchoolExists == true)
{
Login_button.IsEnabled = true;
}
else
{
Login_button.IsEnabled = false;
}
}
private void Login_button_Click(object sender, RoutedEventArgs e)
{
Authenticate Authenticator = new Authenticate();
User CurrentUser = Authenticator.Login(username_autocompletebox.Text, password_passwordbox.Password, school_combobox.SelectedItem.ToString());
}
}
答案 0 :(得分:1)
很可能在Application_UnHandledException
中处理了未处理的异常。在Application_UnHandledException
处理程序中放置一个断点以查看问题,或在抛出它们时在VS turn on the notification中处理未处理的异常。您还可以在浏览器中找到堆栈跟踪以查看问题。当XAML在某处不正确时,通常会发生这种情况。引用可能不存在的事件处理程序或样式等......