static public void feed(Actions.ActionFacebookFeedArgs arg, Actions.DelegateBegin onBegin, Actions.DelegateDone onDone, Actions.DelegateCancel onCancel) { Actions.ActionFacebookFeed action = new ActionFacebookFeed(); action.OnDone += onDone; action.OnBegin += onBegin; action.OnCancel += onCancel; action.Do(arg); }
async void feed(ActionFacebookFeedArgs arg) { HttpClient client = new HttpClient(); Uri uri = new Uri("https://graph.beta.facebook.com/me/feed"); string param = "message=" + WebUtility.UrlEncode(arg.Message) + "&access_token=" + FacebookClient.Instance.Token + "&link=" + arg.PageLink + "&picture=" + arg.IconLink + "&caption=" + WebUtility.UrlEncode(arg.Title); StringContent content = new StringContent(param); HttpResponseMessage rs = await client.PostAsync(uri, content); if (rs.IsSuccessStatusCode) { Done(arg); } else { Cancel(arg); } }