Esempio n. 1
0
 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;
     }
 }
Esempio n. 2
0
 static private void action_fbinfo_stream_onCancel(object sender, Actions.ActionArgs e)
 {
     try {
         ServerStream svstream = _stream_wating[(Actions.Action)sender];
         svstream.Status = (int)ServerStreamStatus.STREAM_STATUS_ERROR;
         _stream_wating.Remove((Actions.Action)sender);
         ApplicationInfomation.onPopupOff();
     } catch (Exception ex) {
     }
 }
Esempio n. 3
0
 static private void action_fbinfo_stream_do(ServerStream onstream)
 {
     Actions.ActionFacebookGetInfomationArgs arg           = new Actions.ActionFacebookGetInfomationArgs();
     Actions.ActionFacebookGetInfomation     action_fbinfo = new Actions.ActionFacebookGetInfomation();
     _stream_wating.Add(action_fbinfo, onstream);
     try {
         action_fbinfo.OnDone   += action_fbinfo_stream_onDone;
         action_fbinfo.OnCancel += action_fbinfo_stream_onCancel;
         onstream.Status         = (int)ServerStreamStatus.STREAM_STATUS_REQUESTING;
         action_fbinfo.Do(arg);
     } catch (Exception ex) {
         onstream.Status = (int)ServerStreamStatus.STREAM_STATUS_ERROR;
         ApplicationInfomation.onPopupOff();
     }
 }
Esempio n. 4
0
 static private void action_fblogin_stream_OnCancel(object sender, Actions.ActionArgs e)
 {
     try {
         ServerStream            svstream = _stream_wating[(Actions.Action)sender];
         ActionFacebookLoginArgs arg      = e as ActionFacebookLoginArgs;
         foreach (ActionArgLinker link in AppObject.PopupOfAction)
         {
             if (link.AttachArg == arg)
             {
                 AppObject.PopupOfAction.Remove(link);
                 break;
             }
         }
         svstream.Status = (int)ServerStreamStatus.STREAM_STATUS_ERROR;
         _stream_wating.Remove((Actions.Action)sender);
         ApplicationInfomation.onPopupOff();
     } catch (Exception ex) {
     }
 }
Esempio n. 5
0
 static private void action_fbinfo_stream_onDone(object sender, Actions.ActionArgs e)
 {
     try {
         Actions.ActionFacebookGetInfomationArgs fbarg = e as Actions.ActionFacebookGetInfomationArgs;
         if (fbarg != null)
         {
             ServerStream svstream = _stream_wating[(Actions.Action)sender];
             svstream.Status = (int)ServerStreamStatus.STREAM_STATUS_RESPONSED;
             _stream_wating.Remove((Actions.Action)sender);
         }
         else
         {
             ServerStream svstream = _stream_wating[(Actions.Action)sender];
             svstream.Status = (int)ServerStreamStatus.STREAM_STATUS_ERROR;
             _stream_wating.Remove((Actions.Action)sender);
         }
         ApplicationInfomation.onPopupOff();
     } catch (Exception ex) {
     }
 }
Esempio n. 6
0
 static private void action_fblogin_stream_OnDone(object sender, Actions.ActionArgs e)
 {
     try {
         Actions.ActionFacebookLoginArgs fbarg = e as Actions.ActionFacebookLoginArgs;
         ActionFacebookLoginArgs         arg   = e as ActionFacebookLoginArgs;
         foreach (ActionArgLinker link in AppObject.PopupOfAction)
         {
             if (link.AttachArg == arg)
             {
                 AppObject.PopupOfAction.Remove(link);
                 break;
             }
         }
         if (fbarg != null && (fbarg.IsCancelByLogedin || (fbarg.Result != null && fbarg.Result.IsSuccess)))
         {
             if (fbarg.IsCancelByLogedin)
             {
                 ServerStream svstream = _stream_wating[(Actions.Action)sender];
                 svstream.Status = (int)ServerStreamStatus.STREAM_STATUS_RESPONSED;
                 ApplicationInfomation.onPopupOff();
             }
             else
             {
                 FacebookClient.Instance.Token        = fbarg.Result.Token;
                 FacebookClient.Instance.TokenExprite = fbarg.Result.TokenExprite;
                 FacebookClient.Instance.SaveUserData();
                 ServerStream svstream = _stream_wating[(Actions.Action)sender];
                 action_fbinfo_stream_do(svstream);
             }
         }
         else
         {
             ServerStream svstream = _stream_wating[(Actions.Action)sender];
             svstream.Status = (int)ServerStreamStatus.STREAM_STATUS_ERROR;
             _stream_wating.Remove((Actions.Action)sender);
             ApplicationInfomation.onPopupOff();
         }
     } catch (Exception ex) {
         Debug.WriteLine(ex.Message);
     }
 }
Esempio n. 7
0
 static private void action_twitter_login_OnDone(object sender, Actions.ActionArgs e)
 {
     try {
         Actions.ActionTwitterLoginArgs twarg = e as Actions.ActionTwitterLoginArgs;
         foreach (ActionArgLinker link in AppObject.PopupOfAction)
         {
             if (link.AttachArg == twarg)
             {
                 AppObject.PopupOfAction.Remove(link);
                 break;
             }
         }
         if (twarg != null && (twarg.IsCancelByLogedin || (twarg.Result != null && twarg.Result.IsSuccess)))
         {
             if (twarg.IsCancelByLogedin)
             {
                 ServerStream svstream = _stream_wating[(Actions.Action)sender];
                 svstream.Status = (int)ServerStreamStatus.STREAM_STATUS_RESPONSED;
                 _stream_wating.Remove((Actions.Action)sender);
                 ApplicationInfomation.onPopupOff();
             }
             else
             {
                 ServerStream svstream = _stream_wating[(Actions.Action)sender];
                 svstream.Status = (int)ServerStreamStatus.STREAM_STATUS_RESPONSED;
                 _stream_wating.Remove((Actions.Action)sender);
                 ApplicationInfomation.onPopupOff();
             }
         }
         else
         {
             ServerStream svstream = _stream_wating[(Actions.Action)sender];
             svstream.Status = (int)ServerStreamStatus.STREAM_STATUS_ERROR;
             _stream_wating.Remove((Actions.Action)sender);
             ApplicationInfomation.onPopupOff();
         }
         AppObject.PopupOfAction.Clear();
     } catch (Exception ex) {
     }
 }
Esempio n. 8
0
 static public void login(FacebookAppInfomation appinfo, ServerStream stream, Actions.DelegateBegin onBegin, Actions.DelegateDone onDone, Actions.DelegateCancel onCancel)
 {
     Actions.ActionFacebookLoginArgs arg = new Actions.ActionFacebookLoginArgs(AppObject.RootLayout)
     {
         AppInfo = appinfo
     };
     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;
     }
 }