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 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          = wsdl.GetUserSalt(UserName);
            string hashedPasword = CreateHash1(Password, salt);
            string finalPassword = CreateHash2(hashedPasword, salt);

            loggedUser    = wsdl.LoginUser2(UserName, finalPassword);
            clientAccount = wsdl.GetAccountForClient(loggedUser.InternalId, Guid.Parse(ClientRegistrationID));
        }
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(TaskDatabaseSoapClient.GetEndpointAddress(EndpointConfiguration.TaskDatabaseSoap));
 }
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(TaskDatabaseSoapClient.GetBindingForEndpoint(EndpointConfiguration.TaskDatabaseSoap));
 }
 public TaskDatabaseSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(TaskDatabaseSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
 public TaskDatabaseSoapClient(EndpointConfiguration endpointConfiguration) :
     base(TaskDatabaseSoapClient.GetBindingForEndpoint(endpointConfiguration), TaskDatabaseSoapClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
 public TaskDatabaseSoapClient() :
     base(TaskDatabaseSoapClient.GetDefaultBinding(), TaskDatabaseSoapClient.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.TaskDatabaseSoap.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }