public static LoginCanvas GetInstance(Canvas canvas) { if (loginCanvas == null) { loginCanvas = new LoginCanvas(canvas); } return(loginCanvas); }
public void LoginButtonUserData_Click(object sender, RoutedEventArgs args) { Front_End.LoginCanvas loginCanvas = Front_End.LoginCanvas.GetInstance(LoginCanvas); if (DataModels.GetInstance().isAdmin(loginCanvas.GetUserName(), loginCanvas.GetPassword())) { ShowAdminPanel(); return; } User user = DataModels.GetInstance().LogUser(loginCanvas.GetUserName(), loginCanvas.GetPassword()); if (user == null) { MessageBox.Show("Invalid data"); return; } Front_End.NavigationCanvas.GetInstance(NavigationCanvas).Hide(); InitializeLoggedinNavigationCanvas(user); ActiveUser = user; CurrentCanvas.Hide(); InitializeHomeCanvas(); }