本文整理汇总了C#中FlickrNet.Flickr.StatsGetTotalViews方法的典型用法代码示例。如果您正苦于以下问题:C# Flickr.StatsGetTotalViews方法的具体用法?C# Flickr.StatsGetTotalViews怎么用?C# Flickr.StatsGetTotalViews使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlickrNet.Flickr
的用法示例。
在下文中一共展示了Flickr.StatsGetTotalViews方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainForm_Load
private void MainForm_Load(object sender, EventArgs e)
{
label.Text = "Statistiques pour " + Program.Username + endl;
label.Text += "Dernière mise à jour le " + Program.LastUpdate.ToShortDateString() + endl;
var flickr = new Flickr(Program.ApiKey, Program.SharedSecret, Program.AuthToken);
string info = "Aujourd'hui :\n";
try
{
var stats = flickr.StatsGetTotalViews();
info += "Vues totales: " + stats.TotalViews + endl +
"Vues photos: " + stats.PhotoViews + endl +
"Vues albums: " + stats.PhotosetViews + endl +
"Vues galerie: " + stats.PhotostreamViews + endl +
"Vues expos: " + stats.CollectionViews;
// MessageBox.Show(info, "Stats", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (FlickrException ex)
{
// MessageBox.Show(ex.ToString(), "Erreur",
// MessageBoxButtons.OK, MessageBoxIcon.Error);
info += ex.Message;
}
label.Text += info;
}
示例2: ButtonStats_Click
private void ButtonStats_Click(object sender, EventArgs e)
{
var flickr = new Flickr(Program.ApiKey, Program.SharedSecret, Program.AuthToken);
// Statistiques générales
var statfile = new System.IO.StreamWriter("stats.csv");
DateTime day = DateTime.Today;
statfile.WriteLine("Date;Photos;Albums;Flux;Expos");
while (day > Program.LastUpdate)
{
try
{
var s = flickr.StatsGetTotalViews(day);
statfile.WriteLine(day.ToShortDateString() + ";" + Utility.toCSV(s));
StatusLabel.Text = "Chargement des stats " + day.ToShortDateString();
Application.DoEvents();
day -= TimeSpan.FromDays(1);
}
catch (FlickrApiException ex) {
MessageBox.Show("Erreur lors du chargement des statistiques du "
+ day.ToShortDateString() + " : " + ex.OriginalMessage,
"Erreur", MessageBoxButtons.OK);
break;
}
}
statfile.Close();
}