I use a dialogservice for my login and expose an event
event EventHandler<RequestCloseEventArgs> RequestCloseDialog;
which closes the dialog when the client succesfully looged in.
edit: Here's an example
In your app.xaml.cs
protected override void OnStartup(StartupEventArgs e)
{
var result = this._dialogService.Show("Login",this._myloginviewmodel);
// When use click cancel in the login dialog
if(!result)
{
// Close app or whatever
}
// Access the properties of myloginviewmodel if you want
// Now the only part of my app where I use view-first instead of viewmodel-first
this.MainWindow = new MainWindow(_mainwindowviwemodel);
this.MainWindow.Show();
}
That's all in my OnStartup(), and yes thats the codebehind from my app.xaml, but this is my application root and thats why this is ok for me. I don't have a AppViewModel or something like that because app.xaml will never "shown" to the user.