本文整理汇总了C#中Facebook.FacebookClient.DeleteAsync方法的典型用法代码示例。如果您正苦于以下问题:C# FacebookClient.DeleteAsync方法的具体用法?C# FacebookClient.DeleteAsync怎么用?C# FacebookClient.DeleteAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facebook.FacebookClient
的用法示例。
在下文中一共展示了FacebookClient.DeleteAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteLastMessage_Click
private void DeleteLastMessage_Click(object sender, RoutedEventArgs e)
{
btnDeleteLastMessage.IsEnabled = false;
var fb = new FacebookClient(_accessToken);
// make sure to add event handler for DeleteCompleted.
fb.DeleteCompleted += (o, args) =>
{
// incase you support cancellation, make sure to check
// e.Cancelled property first even before checking (e.Error!=null).
if (args.Cancelled)
{
// for this example, we can ignore as we don't allow this
// example to be cancelled.
// you can check e.Error for reasons behind the cancellation.
var cancellationError = args.Error;
}
else if (args.Error != null)
{
// error occurred
Dispatcher.BeginInvoke(
() =>
{
MessageBox.Show(args.Error.Message);
});
}
else
{
// the request was completed successfully
// make sure to be on the right thread when working with ui.
Dispatcher.BeginInvoke(() =>
{
MessageBox.Show("Message deleted successfully");
btnDeleteLastMessage.IsEnabled = false;
});
}
};
fb.DeleteAsync(_lastMessageId);
}
示例2: DeleteLastMessage_Click
private void DeleteLastMessage_Click(object sender, RoutedEventArgs e)
{
btnDeleteLastMessage.IsEnabled = false;
var fb = new FacebookClient(_accessToken);
fb.DeleteCompleted += (o, args) =>
{
if (args.Error != null)
{
Dispatcher.BeginInvoke(() => MessageBox.Show(args.Error.Message));
return;
}
Dispatcher.BeginInvoke(() =>
{
MessageBox.Show("Message deleted successfully");
btnDeleteLastMessage.IsEnabled = false;
});
};
fb.DeleteAsync(_lastMessageId);
}
示例3: DeletePost
/// <summary>
/// Delete post from wall of facebook user
/// </summary>
public void DeletePost()
{
var fb = new FacebookClient(_accessToken);
fb.DeleteCompleted += (o, args) =>
{
if (args.Error != null)
{
Dispatcher.BeginInvoke(() => MessageBox.Show(args.Error.Message));
return;
}
Dispatcher.BeginInvoke(() =>
{
MessageBox.Show("Message deleted successfully");
btnDeletePost.IsEnabled = false;
});
};
fb.DeleteAsync(_lastMessageId); // delete message from wall
}