void avatar_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
 {
     if (!e.Cancelled && e.Error == null)
     {
         try
         {
             ActionFacebookGetInfomationArgs arg = _wating[(WebClient)sender];
             string data  = e.Result;
             var    juser = JsonConvert.DeserializeObject <AvatarRedirect>(data);
             if (juser != null)
             {
                 FacebookClient.Instance.updateUserAvatarUrl(juser.data.url);
             }
             Done(arg);
             _wating.Remove((WebClient)sender);
         }
         catch (Exception ex)
         {
         }
     }
     else
     {
         try
         {
             ActionFacebookGetInfomationArgs arg = _wating[(WebClient)sender];
             Done(arg);
             _wating.Remove((WebClient)sender);
         }
         catch (Exception ex)
         {
         }
     }
 }
 private void LoadInfomationComplete(object sender, DownloadStringCompletedEventArgs e)
 {
     if (!e.Cancelled && e.Error == null)
     {
         try {
             ActionFacebookGetInfomationArgs arg = _wating[(WebClient)sender];
             string data  = e.Result;
             var    juser = JsonConvert.DeserializeObject <UserInfomation>(data);
             if (juser != null)
             {
                 FacebookClient.Instance.updateUserInfomation(juser.id, juser.name);
                 arg.UserInfomation = juser;
                 WebClient client = new WebClient();
                 _wating.Add(client, arg);
                 client.DownloadStringCompleted += avatar_DownloadStringCompleted;
                 client.DownloadStringAsync(new Uri(FacebookClient.Instance.getUserAvatarUrlNotRedirect()));
             }
             else
             {
                 Cancel(arg);
             }
         } catch (Exception ex) {
         }
     }
     else
     {
         try {
             string data = e.Result;
             ActionFacebookGetInfomationArgs arg = _wating[(WebClient)sender];
             Cancel(arg);
         } catch (Exception ex) {
         }
     }
 }
Example #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();
     }
 }
Example #4
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) {
     }
 }