当前位置: 首页>>代码示例>>C#>>正文


C# FlickrNet.Flickr类代码示例

本文整理汇总了C#中FlickrNet.Flickr的典型用法代码示例。如果您正苦于以下问题:C# Flickr类的具体用法?C# Flickr怎么用?C# Flickr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Flickr类属于FlickrNet命名空间,在下文中一共展示了Flickr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CompletedAuth

 public CompletedAuth(FlickrNet.Flickr flickrProxy, string frob)
 {
     InitializeComponent();
     _proxy = flickrProxy;
     this.Frob = frob;
     Load += new EventHandler(CompletedAuth_Load);
 }
开发者ID:npk,项目名称:flickr4writer,代码行数:7,代码来源:CompletedAuth.cs

示例2: Login

        public void Login()
        {
            // Create Flickr instance
            m_flickr = new Flickr(API_KEY, SECRET);

            m_frob = m_flickr.AuthGetFrob();

            string flickrUrl = m_flickr.AuthCalcUrl(m_frob, AuthLevel.Write);

            // The following line will load the URL in the users default browser.
            System.Diagnostics.Process.Start(flickrUrl);

            bool bIsAuthorized = false;
            m_auth = new Auth();

            // do nothing until flickr authorizes.
            while (!bIsAuthorized)
            {
                try
                {
                    m_auth = m_flickr.AuthGetToken(m_frob);
                    m_flickr.AuthToken = m_auth.Token;
                }
                catch (FlickrException ex)
                {
                    ;
                }

                if (m_flickr.IsAuthenticated)
                {
                    bIsAuthorized = true;
                }
            }
        }
开发者ID:pvt10rr,项目名称:pvt10flickr,代码行数:34,代码来源:FlickrAddon.cs

示例3: GetOnePhotoInfoFromFlickr

 public FlickrPhoto GetOnePhotoInfoFromFlickr(string photoId)
 {
     Flickr flickr = new Flickr(_apiKey, _secret);
     flickr.InstanceCacheDisabled = true;
     PhotoInfo photoInfo = new PhotoInfo();
     FlickrPhoto flickrPhoto = new FlickrPhoto();
     try
     {
         photoInfo = flickr.PhotosGetInfo(photoId);
         flickrPhoto.PictureId = photoInfo.PhotoId;
         flickrPhoto.OwnerName = !string.IsNullOrWhiteSpace(photoInfo.OwnerRealName) ? photoInfo.OwnerRealName : photoInfo.OwnerUserName;
         flickrPhoto.Title = photoInfo.Title;
         flickrPhoto.Description = photoInfo.Description;
         flickrPhoto.AvailablePublic = photoInfo.IsPublic;
         flickrPhoto.SmallImageUrl = photoInfo.Small320Url;
     }
     catch (Exception ex)
     {
         if (ex is PhotoNotFoundException)
         {
             flickrPhoto.AvailablePublic = false;
         }
     }
     return flickrPhoto;
 }
开发者ID:kgfaith,项目名称:ExperimentalCRM,代码行数:25,代码来源:PhotoManager.cs

示例4: GetPagedSetCount

 public static int GetPagedSetCount(string setId)
 {
     Flickr flickr = new Flickr(ConfigurationManager.AppSettings["apiKey"],
         ConfigurationManager.AppSettings["sharedSecret"]);
     Photoset set = flickr.PhotosetsGetInfo(setId);
     return set.NumberOfPhotos;
 }
开发者ID:holdenben,项目名称:photoStarter,代码行数:7,代码来源:FlickrBLL.cs

示例5: GetPhotoSetsByUser

        public static PhotosetCollection GetPhotoSetsByUser(string userId)
        {
            Flickr flickr = new Flickr(ConfigurationManager.AppSettings["apiKey"],
                ConfigurationManager.AppSettings["sharedSecret"]);

            return flickr.PhotosetsGetList(userId);
        }
开发者ID:holdenben,项目名称:photoStarter,代码行数:7,代码来源:FlickrBLL.cs

示例6: ButtonPhoto_Click

 private void ButtonPhoto_Click(object sender, EventArgs e)
 {
     var flickr = new Flickr(Program.ApiKey, Program.SharedSecret, Program.AuthToken);
     // Referrers
     DateTime day = DateTime.Today;
     var statfile = new System.IO.StreamWriter("stats_dom.csv");
     var reffile = new System.IO.StreamWriter("stats_referrers.csv");
     while (day > Program.LastUpdate)
     {
         try
         {
             var s = flickr.StatsGetPhotoDomains(day, 1, 100);
             day -= TimeSpan.FromDays(1);
             StatusLabel.Text = "Chargement des domaines " + day.ToShortDateString();
             Application.DoEvents();
             statfile.Write(Utility.toCSV(s, day.ToShortDateString()));
             foreach (StatDomain dom in s)
             {
                 var r = flickr.StatsGetPhotoReferrers(day, dom.Name, 1, 100);
                 reffile.Write(Utility.toCSV(r, day.ToShortDateString() + ";" + dom.Name));
             }
         }
         catch (FlickrApiException ex)
         {
             MessageBox.Show("Erreur lors du chargement des domaines référents du "
                 + day.ToShortDateString() + " : " + ex.OriginalMessage,
                 "Erreur", MessageBoxButtons.OK);
             break;
         }
     }
     statfile.Close();
 }
开发者ID:remyoudompheng,项目名称:flickrstats,代码行数:32,代码来源:MainForm.cs

示例7: UploadToFlickr

        private string UploadToFlickr(TideTrackerInputModel model)
        {
            string flickrId = string.Empty;

            var flickr = new Flickr(FlickrApiKey, FlickrApiSecret);

            //var oauthRequestToken = flickr.OAuthGetRequestToken("http://www.witnesskingtides.com/");
            //var ouathRequestToken = flickr.OAuthGetRequestToken("http://www.flickr.com/auth-72157638432779974");

            var client = new WebClient();
            var miniToken = client.DownloadString("http://www.flickr.com/auth-72157638432779974");

            //flickr = new Flickr(FlickrApiKey, FlickrApiSecret, oauthRequestToken.Token);

            //var auth = flickr.OAuthGetAccessToken(oauthRequestToken.Token, oauthRequestToken.TokenSecret, "72157638432779974");

            //var auth = flickr.AuthOAuthGetAccessToken();
            //using (var memoryStream = new MemoryStream())
            //{
            //    memoryStream.Write(model.Photo, 0, model.Photo.Length);

            //    flickrId = flickr.UploadPicture(memoryStream, model.FileName, null, model.Description, null, true, true, true, ContentType.Photo, SafetyLevel.None, HiddenFromSearch.Visible);
            //}

            return flickrId;
        }
开发者ID:RHoKAustralia,项目名称:witnesskingtides-web-api,代码行数:26,代码来源:PhotoController.cs

示例8: Upload

        public string Upload(WitnessKingTidesApiInputModel model)
        {
            string flickrId = string.Empty;
            model.FileName = Guid.NewGuid().ToString() + ".jpg";

            var flickr = new Flickr(FlickrApiKey, FlickrApiSecret);
            flickr.OAuthAccessToken = FlickrOAuthKey;
            flickr.OAuthAccessTokenSecret = FlickrOAuthSecret;

            var path = Path.Combine(AppDataDirectory, model.FileName);
            using (var stream = File.OpenWrite(path))
            {
                stream.Write(model.Photo, 0, model.Photo.Length);
            }

            //TODO: We should probably fill the title here. Otherwise default flickr captions will be gibberish guids
            flickrId = flickr.UploadPicture(path, null, model.Description, null, true, false, false);

            //TODO: Should probably try/catch this section here. Failure to set location and/or delete the temp file should
            //not signal a failed upload.

            //TODO: Need to check if coordinates can be embedded in EXIF and extracted by Flickr. If so we can probably
            //skip this and embed the coordinates client-side.
            flickr.PhotosGeoSetLocation(flickrId, Convert.ToDouble(model.Latitude), Convert.ToDouble(model.Longitude));

            File.Delete(path);

            return flickrId;
        }
开发者ID:RHoKAustralia,项目名称:witnesskingtides-web-api,代码行数:29,代码来源:FlickrService.cs

示例9: EffectGraphHomeView

        public EffectGraphHomeView()
        {
            this.InitializeComponent();

            _flickr = new FlickrNet.Flickr(apiKey, apiSecret);

            PopupService.Init(layoutRoot);
 

            LoggingService.LogInformation("Showing splash screeen", "Views.HomeView");
            _vm = new HomeViewModel();
            _vm.Load();
            this.DataContext = _vm;

            //_vm.ShowLoginCommand.Execute(null);


            try
            {
                
                //Messenger.Default.Register<GeneralSystemWideMessage>(this, DoGeneralSystemWideMessageCallback);

                
            }
            catch { }


            //AppDatabase.Current.DeleteProjects(SessionID);


        }
开发者ID:rolandsmeenk,项目名称:ModernApps,代码行数:31,代码来源:EffectGraphHomeView.xaml.cs

示例10: UploadPhoto

        public IPhoto UploadPhoto(Stream stream, string filename, string title, string description, string tags)
        {
            using (MiniProfiler.Current.Step("FlickrPhotoRepository.UploadPhoto"))
            {
                Flickr fl = new Flickr();

                string authToken = (ConfigurationManager.AppSettings["FlickrAuth"] ?? "").ToString();
                if (string.IsNullOrEmpty(authToken))
                    throw new ApplicationException("Missing Flickr Authorization");

                fl.AuthToken = authToken;
                string photoID = fl.UploadPicture(stream, filename, title, description, tags, true, true, false,
                    ContentType.Photo, SafetyLevel.Safe, HiddenFromSearch.Visible);
                var photo = fl.PhotosGetInfo(photoID);
                var allSets = fl.PhotosetsGetList();
                var blogSet = allSets
                                .FirstOrDefault(s => s.Description == "Blog Uploads");
                if (blogSet != null)
                    fl.PhotosetsAddPhoto(blogSet.PhotosetId, photo.PhotoId);

                FlickrPhoto fphoto = new FlickrPhoto();
                fphoto.Description = photo.Description;
                fphoto.WebUrl = photo.MediumUrl;
                fphoto.Title = photo.Title;
                fphoto.Description = photo.Description;

                return fphoto;
            }
        }
开发者ID:sgwill,项目名称:familyblog,代码行数:29,代码来源:FlickrPhotoRepository.cs

示例11: GetImages

 public IEnumerable<FlickrImage> GetImages(string tags)
 {
     Flickr.CacheDisabled = true;
     var flickr = new Flickr("340b341adedd9b2613d5c447c4541e0f");
     flickr.InstanceCacheDisabled = true;
     var options = new PhotoSearchOptions { Tags = tags, PerPage = 2  };
     var photos = flickr.PhotosSearch(options);
     return photos.Select(i =>
     {
         using (var client = new WebClient())
         {
             var data = client.DownloadData(i.Medium640Url);
             using (var memoryStream = new MemoryStream(data))
             {
                 var bitmap = new Bitmap(memoryStream);
                 return new FlickrImage
                            {
                                Url = i.Medium640Url,
                                Image = new Bitmap(bitmap),
                                Encoded = Convert.ToBase64String(memoryStream.ToArray())
                            };
             }
         }
     });
 }
开发者ID:pebblecode,项目名称:raci,代码行数:25,代码来源:FlickrImageService.cs

示例12: Set

        //
        // GET: /Photo/
        public ActionResult Set(string photosetID)
        {
            Flickr flickr = new Flickr(flickrKey, sharedSecret);
            PhotosetPhotoCollection photos = GetPhotosetPhotos(photosetID, flickr);

            return View(photos);
        }
开发者ID:lauraemilyjacobsen,项目名称:HikeBlog,代码行数:9,代码来源:PhotoController.cs

示例13: getFlickr

 public static Flickr getFlickr()
 {
     Flickr f = new Flickr(Secrets.apiKey, Secrets.apiSecret);
     f.OAuthAccessToken = Settings.OAuthAccessToken;
     f.OAuthAccessTokenSecret = Settings.OAuthAccessTokenSecret;
     return f;
 }
开发者ID:JamieKitson,项目名称:FlickrAutoUploader,代码行数:7,代码来源:MyFlickr.cs

示例14: FlickrHome

        public FlickrHome()
        {
            this.InitializeComponent();

            _flickr = new FlickrNet.Flickr();
            CheckAlreadyExists();
        }
开发者ID:liquidboy,项目名称:X,代码行数:7,代码来源:FlickrHome.xaml.cs

示例15: AccountController

 public AccountController(IBoekService bs)
 {
     this.bs = bs;
     flickr = MvcApplication.flickr;
     if (flickr == null) flickr = FlickrApiManager.GetInstance();
 
 }
开发者ID:octagonal,项目名称:Omgevingsboek,代码行数:7,代码来源:AccountController.cs


注:本文中的FlickrNet.Flickr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。