/// <summary> /// Auth the specified connectionProfile. /// </summary> /// <param name="connectionProfile">Connection profile.</param> public void Auth(ConnectionProfile connectionProfile) { //send login packet ServerPacketUserLogin serverPacketUserLogin = ServerHelper.LoginUserHashed(connectionProfile.UserName, connectionProfile.UserPassword); //if login success if (serverPacketUserLogin.NetworkError == NetworkError.NONE) { //set actual user infos Application.ActualUser = serverPacketUserLogin.UserProfile; Application.UserPassword = tfPasswordField.Text; if (serverPacketUserLogin.UserAccountActivate) { if (serverPacketUserLogin.UserDAuthPrivateKey != null) { Application.ActualUserPrivateKey = serverPacketUserLogin.UserDAuthPrivateKey; PerformSegue("DAuthLoginSegue", this); return; } //load user pets Application.PetManager.LoadUserPetList(serverPacketUserLogin.UserProfile); //instantiate main view controller UIStoryboard mainBoard = UIStoryboard.FromName("Main", null); MainTabBarController mainTabBarController = mainBoard.InstantiateViewController("MainTabBarController") as MainTabBarController; PresentViewController(mainTabBarController, true, null); } else { PerformSegue("ConnectConfirmAccountSegue", this); } return; } //chose right error message String messageError = string.Empty; switch (serverPacketUserLogin.NetworkError) { case NetworkError.GLOBAL_UNKNOWN: goto default; case NetworkError.SQL_USER_UNKNOWN: messageError = "Utilisateur ou mot de passe incorect"; break; case NetworkError.SERVER_UNAVAILABLE: messageError = MSGBank.ERROR_NO_SERVER; break; default: messageError = MSGBank.ERROR_UNKNOWN; break; } BarHelper.DisplayErrorBar(uivMainView, MSGBank.ERROR_TITLE, messageError, 5); //ßMessageBox.ShowOK(MSGBank.ERROR_TITLE, messageError, this); }