internal static void Login() #endif { if (loggedUser != null && clientAccount != null) { return; } if (string.IsNullOrWhiteSpace(UserName)) { return; } #if Win8 || WINDOWS_PHONE Binding binding = new BasicHttpBinding(); EndpointAddress address = new EndpointAddress(ServerUrl); wsdl = new TaskDatabaseSoapClient(binding, address); #if Win8 string salt = await wsdl.GetUserSaltAsync(UserName); CalculateFinalPassword(salt); #else wsdl.GetUserSaltCompleted += wsdl_GetUserSaltCompleted; wsdl.GetUserSaltAsync(UserName); #endif #else wsdl = new TaskDatabase(); string salt = wsdl.GetUserSalt(UserName); CalculateFinalPassword(salt); #endif #if Win8 loggedUser = await wsdl.LoginUser2Async(UserName, finalPassword); #else #if WINDOWS_PHONE loggedUser = null; //wsdl.LoginUser2Async(UserName, finalPassword); <- done in wsdl_GetUserSaltCompleted #else loggedUser = wsdl.LoginUser2(UserName, finalPassword); #endif #endif if (loggedUser != null) { #if Win8 clientAccount = await wsdl.GetAccountForClient2Async(loggedUser.InternalId.ToString(), Guid.Parse(ClientRegistrationID).ToString()); #else #if WINDOWS_PHONE clientAccount = null; // clientAccount = await wsdl.GetAccountForClientAsync(loggedUser.InternalId, Guid.Parse(ClientRegistrationID));<- done in wsdl_LoginUser2Completed #else #if iOS clientAccount = wsdl.GetAccountForClient2(loggedUser.InternalId, (ClientRegistrationID)); #else clientAccount = wsdl.GetAccountForClient2(loggedUser.InternalId.ToString(), Guid.Parse(ClientRegistrationID).ToString()); #endif #endif #endif } }
private async static void Login() { if (loggedUser != null && clientAccount != null) { return; } Binding binding = new BasicHttpBinding(); EndpointAddress address = new EndpointAddress(ServerUrl); wsdl = new TaskDatabaseSoapClient(binding, address); string salt = await wsdl.GetUserSaltAsync(UserName); string hashedPasword = CreateHash1(Password, salt); string finalPassword = CreateHash2(hashedPasword, salt); loggedUser = await wsdl.LoginUser2Async(UserName, finalPassword); clientAccount = await wsdl.GetAccountForClientAsync(loggedUser.InternalId, Guid.Parse(ClientRegistrationID)); }