本文整理汇总了C#中FlickrNet.Flickr.UploadPictureAsync方法的典型用法代码示例。如果您正苦于以下问题:C# Flickr.UploadPictureAsync方法的具体用法?C# Flickr.UploadPictureAsync怎么用?C# Flickr.UploadPictureAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlickrNet.Flickr
的用法示例。
在下文中一共展示了Flickr.UploadPictureAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteUpload
protected void ExecuteUpload(IExecuteFlickrUploaderWorkflowMessage message, Flickr flickr, FileInfo inputFilePath)
{
var cancellationTokenSource = new CancellationTokenSource();
var cancellationToken = cancellationTokenSource.Token;
var task = Task.Factory.StartNew(() => { });
task.ContinueWith((t) =>
{
if (!cancellationToken.IsCancellationRequested)
{
FlickrUploaderService.Uploaders.Add(message, new CancellableTask
{
Task = task,
CancellationTokenSource = cancellationTokenSource
});
var asyncUploadSettings = new AsyncUploadSettings
{
Message = message,
InputStream = inputFilePath.OpenRead()
};
var uploader = new Uploader(asyncUploadSettings);
flickr.OnUploadProgress += uploader.OnUploadProgress;
flickr.UploadPictureAsync(asyncUploadSettings.InputStream, inputFilePath.Name,
message.Settings.MetaData.Title,
message.Settings.MetaData.Description,
message.Settings.MetaData.Keywords,
message.Settings.MetaData.IsPublic,
message.Settings.MetaData.IsFamily,
message.Settings.MetaData.IsFriend,
message.Settings.MetaData.ContentType,
message.Settings.MetaData.SafetyLevel,
message.Settings.MetaData.HiddenFromSearch,
result =>
{
FlickrUploaderService.Uploaders.Remove(message);
uploader.OnUploadCompleted(result);
}
);
}
cancellationToken.ThrowIfCancellationRequested();
}
, cancellationToken);
}
开发者ID:taliesins,项目名称:talifun-commander,代码行数:47,代码来源:ExecuteFlickrUploaderWorkflowMessageHandlerBase.cs