• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# FlickrNet.Flickr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: FlickrWrapper

        public FlickrWrapper(Settings settings)
        {
            if (settings == null) throw new ArgumentNullException("settings");

            Settings = settings;
            Flickr = new Flickr(Settings.FlickrApiKey);
        }
开发者ID:slowmonkey,项目名称:Blog-My-Flickr,代码行数:7,代码来源:FlickrWrapper.cs


示例17: CheckApiKeyDoesNotThrowWhenPresent

        public void CheckApiKeyDoesNotThrowWhenPresent()
        {
            Flickr f = new Flickr();
            f.ApiKey = "X";

            Assert.DoesNotThrow(f.CheckApiKey);
        }
开发者ID:MichaelAzar,项目名称:flickr-net,代码行数:7,代码来源:CheckTests.cs


示例18: CompletedAuth

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


示例19: OpenAuthURL

 public static void OpenAuthURL()
 {
     Flickr flickr = new Flickr(ApiKey, SharedSecret);
     frob = flickr.AuthGetFrob();
     AuthUrl = flickr.AuthCalcUrl(frob, AuthLevel.Write);
     System.Diagnostics.Process.Start(AuthUrl);
 }
开发者ID:adamlamers,项目名称:Clipboard-Manager,代码行数:7,代码来源:FlickrManager.cs


示例20: buttonStart_Click

 private void buttonStart_Click(object sender, EventArgs e)
 {
     // Create Flickr instance
     Flickr flickr = new Flickr(Program.ApiKey, Program.SharedSecret);
     try
     {
         // use the temporary Frob to get the authentication
         Auth auth = flickr.AuthGetToken(Program.tempFrob);
         // Store this Token for later usage,
         // or set your Flickr instance to use it.
         string info = "Authentification réussie\n" +
             "Utilisateur identifié: " + auth.User.UserName + "\n" +
             "L'identifiant pour cette session est " + auth.Token + "\n";
         Program.AuthToken = auth.Token;
         Program.Username = auth.User.UserName;
         MessageBox.Show(info, "Identification Flickr",
           MessageBoxButtons.OK, MessageBoxIcon.Information);
         Program.WriteConfig();
         Hide();
         var main_window = new MainForm();
         main_window.Show();
     }
     catch (FlickrException ex)
     {
         // If user did not authenticate your application
         // then a FlickrException will be thrown.
         string info = "L'authentification a échoué:\n" + ex.Message;
         MessageBox.Show(info, "Identification Flickr",
           MessageBoxButtons.OK, MessageBoxIcon.Error);
         // Quit application
         Application.Exit();
     }
 }
开发者ID:remyoudompheng,项目名称:flickrstats,代码行数:33,代码来源:DialogAuth.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# FlickrNet.PhotoSearchOptions类代码示例发布时间:2022-05-24
下一篇:
C# FlexWiki.LocalTopicName类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap