public AuthenticationResult authenticate(string username, string password, string consumerKey, string consumerSecret) { #if !SILVERLIGHT && !NETFX_CORE send_authenticate(username, password, consumerKey, consumerSecret); return recv_authenticate(); #else var asyncResult = Begin_authenticate(null, null, username, password, consumerKey, consumerSecret); return End_authenticate(asyncResult); #endif } #if SILVERLIGHT || NETFX_CORE
/// <summary> /// Logs into Evernote with the given username and password. /// </summary> private static AuthenticationResult Authenticate( string username, string password ) { try { UserStore.Client userClient = new UserStore.Client( new TBinaryProtocol( new THttpClient( new Uri( BaseUrl + "/edam/user" ) ) ) ); if ( !userClient.checkVersion( "EvernoteSharp", Evernote.EDAM.UserStore.Constants.EDAM_VERSION_MAJOR, Evernote.EDAM.UserStore.Constants.EDAM_VERSION_MINOR ) ) throw new OldApiException( ); return userClient.authenticate( username, password, ApiConsumerKey, ApiConsumerSecret ); } catch ( EDAMUserException ex ) { throw DecodeLoginFailure( ex ); } }