Hello
I have 2 user controls in my project : 1- authentification form - AuthForm and 2 - ChatForm
AuthForm user control has event UserAuthentificated.
How can i switch between these controls in code? I mean when user is authetificated then AuthForm control shold be replaced byChatForm
public
partial class App : Application
{
public App() {
this.Startup += this.Application_Startup; this.Exit += this.Application_Exit; this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
}
private void Application_Startup(object sender, StartupEventArgs e)
{
var AuthForm = new AuthForm();
this.RootVisual = AuthForm; AuthForm.UserAuthentificated += new UserAuthEventHandler(AuthForm_UserAuthentificated);
}
private void Application_Exit(object sender, EventArgs e){}
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e){} void AuthForm_UserAuthentificated(object sender, UserAuthEventArgs e)
{
var chatForm = new ChatForm(); this.RootVisual = chatForm;
}
}
It doesn`t work