/// <summary> /// Authenticate with twitter to get a token /// </summary> public static void Authenticate() { // STEP 1 of authentication Flickr f = FlickrManager.GetInstance(); OAuthRequestToken requestToken = f.OAuthGetRequestToken("oob"); string url = f.OAuthCalculateAuthorizationUrl(requestToken.Token, AuthLevel.Write); System.Diagnostics.Process.Start(url); // STEP 2 of authentication Console.WriteLine("Enter the verifier code"); string verifierCode = Console.ReadLine(); Flickr f1 = FlickrManager.GetInstance(); try { var accessToken = f1.OAuthGetAccessToken(requestToken, verifierCode); FlickrManager.OAuthToken = accessToken; } catch (FlickrApiException ex) { throw; } Trace.WriteLine("Authentication with twitter is complete"); }
/// <summary> /// Upload picture /// </summary> public static string UploadPicture(string fileToUpload, string title, string description, string tags, bool isPublic, bool isFamily, bool isFriend) { Contract.Assert(File.Exists(fileToUpload)); Flickr f = FlickrManager.GetAuthInstance(); return(f.UploadPicture(fileToUpload, title, description, tags, isPublic, isFamily, isFriend)); }