2

I'm adding user authorization into my WPF application and I'm having a problem with the login screen.

I have the login screen showing but the application continues to process the current action.

IE. Show the main window
1. check if user is allowed to view the main window
2. User is not allowed
3. Show login screen
4. Load the main window

I would like the application to pause at the login screen until the user is authenticated with the correct authorization.

3
  • You can't pause Application or UI Thread. Just start processes after successful authorization. Commented Oct 28, 2010 at 6:49
  • What method do you use to show the login screen? Commented Oct 28, 2010 at 8:36
  • I've used AOP to intercept the getter of properties with the custom attribute of Authorise etc Commented Oct 28, 2010 at 9:08

1 Answer 1

1

You can show the login window with Window.ShowDialog, ShowDialog will return only after the window closes.

If you want to display the login screen inside the same window it get's a little bit messier, you call Dispatcher.PushFrame where you want to stop and set DispatcherFrame.Continue = false; (on the frame objects you passed to PushFrame, obviously) to resume execution.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.