private void DoCheckConnection(PasswordBox passwordBox) { _server.Disconnect(); var serverUri = new Uri(_url); var credential = new NetworkCredential(UserName, passwordBox.Password); try { _server.Connect(serverUri, credential); } catch (DeployitServerConnectionException dsce) { ErrorMessage = dsce.Message; } RaisePropertyChanged(() => ErrorMessage); if (_credentialManager != null && _server.LastConnectionStatus == ConnectionStatus.Connected && SaveCredentials) { _credentialManager.Set(serverUri, credential); } RaisePropertyChanged(() => IsConnected); EventHandler handler = IsConnectedChanged; if (handler != null) { handler(this, EventArgs.Empty); } }