コード例 #1
0
    public static void Main(string[] args)
    {
        Console.WriteLine("Testig the Flickr API");
        TestAuthFlickr flickr = new TestAuthFlickr();
        string         frob   = flickr.TestAuth();

        Console.WriteLine("Frob: " + frob);
        string login_url = flickr.uploader.AuthCalcUrl(frob, FlickrNet.AuthLevel.Write);

        Console.WriteLine("Please, login in Flickr using the next URL");
        Console.WriteLine("Login link: " + login_url);
        Console.WriteLine("Press any key when you have login in ...");
        Console.ReadLine();
        Console.WriteLine("Trying to get the token");
        try {
            Auth auth = flickr.uploader.AuthGetToken(frob);
            Console.WriteLine("We have the token!" + auth.Token);
            flickr.uploader.ApiToken = auth.Token;
            // Time to upload an image
            flickr.uploader.UploadPicture("/home/acs/fotos/dvd-sarge/sarge31.png");
        } catch (FlickrNet.FlickrException ex) {
            Console.WriteLine("ERROR: Problems uploading photo to Flickr - " + ex.Verbose);
        }
    }
コード例 #2
0
 public static void Main (string[] args) {
     Console.WriteLine ("Testig the Flickr API");
     TestAuthFlickr flickr = new TestAuthFlickr ();
     string frob = flickr.TestAuth();
     Console.WriteLine ("Frob: " + frob);
     string login_url = flickr.uploader.AuthCalcUrl (frob, FlickrNet.AuthLevel.Write);
     
     Console.WriteLine ("Please, login in Flickr using the next URL");
     Console.WriteLine ("Login link: " + login_url);
     Console.WriteLine ("Press any key when you have login in ...");
     Console.ReadLine ();
     Console.WriteLine ("Trying to get the token");
     try {
         Auth auth = flickr.uploader.AuthGetToken(frob);
         Console.WriteLine ("We have the token!" + auth.Token);
         flickr.uploader.ApiToken = auth.Token;
         // Time to upload an image
         flickr.uploader.UploadPicture ("/home/acs/fotos/dvd-sarge/sarge31.png");
         
     } catch (FlickrNet.FlickrException ex) {
         Console.WriteLine ("ERROR: Problems uploading photo to Flickr - "+ex.Verbose);
     } 
 }