/*ServerStream FbFeedStreamWaiting = null; * static void feed(ServerStream svstream) { * if (FacebookClient.Instance.Token.Length > 0 && FbFeedStreamWaiting == null) { * StreamBuffer buf = new StreamBuffer(svstream.PostData); * string message = buf.readSStr(); * FbFeedStreamWaiting = svstream; * FacebookClient.Instance.PostMessageOnWall(AppObject.GameInfo.FacebookFeedTitle, * message, * //AppObject.GameInfo.FacebookFeedAttahLink, * AppObject.AppLink, * AppObject.GameInfo.FacebookFeedImageUrl, * new UploadStringCompletedEventHandler(fb_feed_handle)); * } else { * svstream.Status = (int)ServerStreamStatus.STREAM_STATUS_ERROR; * } * } * static private void fb_feed_handle(object sender, UploadStringCompletedEventArgs e) { * if (FbFeedStreamWaiting != null) { * if (e != null && e.Error == null) { * FbFeedStreamWaiting.Status = (int)ServerStreamStatus.STREAM_STATUS_RESPONSED; * //MessageBox.Show("Completed"); * } else { * FbFeedStreamWaiting.Status = (int)ServerStreamStatus.STREAM_STATUS_ERROR; * //MessageBox.Show("Error! Please retry later"); * } * FbFeedStreamWaiting = null; * } * } * */ static public void getFriends(Actions.DelegateBegin onBegin, Actions.DelegateDone onDone, Actions.DelegateCancel onCancel) { Actions.ActionFacebookGetFriendsArg arg = new Actions.ActionFacebookGetFriendsArg(); Actions.ActionFacebookGetFriends action_fbfriend = new Actions.ActionFacebookGetFriends(); try { if (onBegin != null) { action_fbfriend.OnBegin += onBegin; } if (onDone != null) { action_fbfriend.OnDone += onDone; } if (onCancel != null) { action_fbfriend.OnCancel += onCancel; } action_fbfriend.Do(arg); } catch (Exception ex) { if (onCancel != null) { onCancel(null, arg); } } }
static public void login(ServerStream stream, Actions.DelegateBegin onBegin, Actions.DelegateDone onDone, Actions.DelegateCancel onCancel) { Actions.ActionFacebookLoginArgs arg = new Actions.ActionFacebookLoginArgs(AppObject.RootLayout); Actions.ActionFacebookLogin action_fblogin = new Actions.ActionFacebookLogin(); _stream_wating.Add(action_fblogin, stream); try { action_fblogin.OnBegin += onBegin; action_fblogin.OnDone += action_fblogin_stream_OnDone; action_fblogin.OnDone += onDone; action_fblogin.OnCancel += action_fblogin_stream_OnCancel; action_fblogin.OnCancel += onCancel; stream.Status = (int)ServerStreamStatus.STREAM_STATUS_REQUESTING; AppObject.PopupOfAction.Add(new Actions.ActionArgLinker(action_fblogin, arg)); ////ApplicationInfomation.onPopupOn(); action_fblogin.Do(arg); } catch (Exception ex) { stream.Status = (int)ServerStreamStatus.STREAM_STATUS_ERROR; } }
static public void loadAvatar(Actions.DelegateBegin onBegin, Actions.DelegateDone onDone, Actions.DelegateCancel onCancel) { Actions.ActionFacebookGetAvatarArgs arg = new Actions.ActionFacebookGetAvatarArgs(); Actions.ActionFacebookGetAvatar action_fbavar = new Actions.ActionFacebookGetAvatar(); try { if (onBegin != null) { action_fbavar.OnBegin += onBegin; } if (onDone != null) { action_fbavar.OnDone += onDone; } if (onCancel != null) { action_fbavar.OnCancel += onCancel; } action_fbavar.Do(arg); } catch (Exception ex) { if (onCancel != null) { onCancel(null, arg); } } }
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); }
static public void getFollower(Actions.DelegateBegin onBegin, Actions.DelegateDone onDone, Actions.DelegateCancel onCancel) { Actions.ActionTwitterGetFollowerArgs arg = new ActionTwitterGetFollowerArgs(); Actions.ActionTwitterGetFollower action = new ActionTwitterGetFollower(); action.OnBegin += onBegin; action.OnCancel += onCancel; action.OnDone += onDone; action.Do(arg); }
public static void login(ServerStream stream, Actions.DelegateBegin onBegin, Actions.DelegateDone onDone, Actions.DelegateCancel onCancel) { Actions.ActionTwitterLoginArgs arg = new Actions.ActionTwitterLoginArgs(AppObject.RootLayout); Actions.ActionTwitterLogin action_twlogin = new Actions.ActionTwitterLogin(); _stream_wating.Add(action_twlogin, stream); try { if (onBegin != null) { action_twlogin.OnBegin += onBegin; } action_twlogin.OnDone += action_twitter_login_OnDone; if (onDone != null) { action_twlogin.OnDone += onDone; } action_twlogin.OnCancel += action_twitter_login_OnCancel; if (onCancel != null) { action_twlogin.OnCancel += onCancel; } stream.Status = (int)ServerStreamStatus.STREAM_STATUS_REQUESTING; ApplicationInfomation.onPopupOn(); AppObject.PopupOfAction.Add(new Actions.ActionArgLinker(action_twlogin, arg)); action_twlogin.Do(arg); } catch (Exception ex) { stream.Status = (int)ServerStreamStatus.STREAM_STATUS_ERROR; } }
//Bo add static public void UpdateNewScore(int score, ServerStream stream, Actions.DelegateBegin onBegin, Actions.DelegateDone onDone, Actions.DelegateCancel onCancel) { Actions.ActionFacebookPostHighScoreArg arg_post_score = new Actions.ActionFacebookPostHighScoreArg(); Actions.ActionFacebookPostHighScore action_post_score = new Actions.ActionFacebookPostHighScore(); _stream_wating.Add(action_post_score, stream); try { if (onBegin != null) { action_post_score.OnBegin += onBegin; } action_post_score.OnDone += action_post_score_OnDone; if (onCancel != null) { action_post_score.OnCancel += onCancel; } arg_post_score.Score = score; stream.Status = (int)ServerStreamStatus.STREAM_STATUS_REQUESTING; action_post_score.Do(arg_post_score); } catch (Exception ex) { stream.ErrorCode = 1; stream.Status = (int)ServerStreamStatus.STREAM_STATUS_ERROR; } }