private async void OnLogin(System.Windows.Controls.PasswordBox password) { await sunnyPortal.Connect(UserName, password.Password); if (sunnyPortal.IsConnected) { Messenger.Default.Send <Messages>(Messages.IsLoggedIn); } else { Messenger.Default.Send <OpenWindowMessage>( new OpenWindowMessage { IsModal = true, WindowToOpen = WindowsToOpen.MessageBox, Caption = "Login", Text = "Invalid login or password" }); } }