private void Service_UserGetImageDataCompleted(object sender, UserGetImageDataCompletedEventArgs e)
        {
            LOLConnectClient service = (LOLConnectClient)sender;

            if (e.Result.Errors.Count == 0 && e.Result.ImageData.Length > 0)
            {
                RunOnUiThread(delegate
                {
                    using (Bitmap userImage = ImageHelper.CreateUserProfileImageForDisplay(e.Result.ImageData, this.thumbImageWidth, this.thumbImageHeight, this.Resources))
                    {
                        ImageView pic = (ImageView)imgProfilePic.FindViewWithTag(new Java.Lang.String("profilepic_" + e.Result.AccountID));
                        if (pic != null)
                            pic.SetImageBitmap(userImage);
                    }

                    service.UserGetImageDataCompleted -= Service_UserGetImageDataCompleted;

                    dbm.UpdateUserImage(e.Result.AccountID.ToString(), e.Result.ImageData);
                });
            }
        }
Пример #2
0
        private void Service_UserGetImageDataCompleted(object sender, UserGetImageDataCompletedEventArgs e)
        {
            LOLConnectClient service = (LOLConnectClient)sender;

            if (e.Result.Errors.Count == 0 && e.Result.ImageData.Length > 0)
            {
                using (Bitmap userImage = ImageHelper.CreateUserProfileImageForDisplay(e.Result.ImageData, (int)imageSize[0], (int)imageSize[1], this.Resources))
                {
                    if (userImage != null)
                        RunOnUiThread(() => modalImage.SetImageBitmap(userImage));
                    else
                        RunOnUiThread(() => modalImage.SetImageResource(Resource.Drawable.defaultuserimage));
                }

                service.UserGetImageDataCompleted -= Service_UserGetImageDataCompleted;
                dbm.UpdateUserImage(e.Result.AccountID.ToString(), e.Result.ImageData);
            }
        }
Пример #3
0
        private void Service_UserGetImageDataCompleted(object sender, UserGetImageDataCompletedEventArgs e)
        {
            LOLConnectClient service = (LOLConnectClient)sender;
            service.UserGetImageDataCompleted -= Service_UserGetImageDataCompleted;

            if (e.Result.Errors.Count == 0)
            {
                using (Bitmap myBitmap = ImageHelper.CreateUserProfileImageForDisplay (e.Result.ImageData, xSize, ySize, this.Resources))
                {
                    #if DEBUG
                    System.Diagnostics.Debug.WriteLine("saving");
                    #endif
                    RunOnUiThread(() => contactpic.SetImageBitmap(myBitmap));
                    File.WriteAllBytes(System.IO.Path.Combine(wowZapp.LaffOutOut.Singleton.ImageDirectory, e.Result.AccountID.ToString()), e.Result.ImageData);
                    ContactsUtil.contactFilenames.Add(e.Result.AccountID.ToString());
                }

                dbm.UpdateUserImage(e.Result.AccountID.ToString(), e.Result.ImageData);
            }
        }
        private void Service_UserGetImageDataCompleted(object sender, UserGetImageDataCompletedEventArgs e)
        {
            LOLConnectClient service = (LOLConnectClient)sender;

            if (e.Result.Errors.Count == 0)
            {
                if (e.Result.ImageData.Length > 0 && e.Result.ImageData.Length != 2)
                {
                    using (Bitmap userImage = ImageHelper.CreateUserProfileImageForDisplay(e.Result.ImageData, (int)imageSize[0], (int)imageSize[1], this.Resources))
                    {
                        ImageView pic = (ImageView)listWrapper.FindViewWithTag(new Java.Lang.String("profilepic_" + e.Result.AccountID));
                        RunOnUiThread(() => pic.SetImageBitmap(userImage));

                        if (!Contacts.ContactsUtil.contactFilenames.Contains(e.Result.AccountID.ToString()))
                        {
                            File.WriteAllBytes(System.IO.Path.Combine(wowZapp.LaffOutOut.Singleton.ImageDirectory, e.Result.AccountID.ToString()), e.Result.ImageData);
                            Contacts.ContactsUtil.contactFilenames.Add(e.Result.AccountID.ToString());
                        }
                    }

                    db.UpdateUserImage(e.Result.AccountID.ToString(), e.Result.ImageData);

                    profilePicsGrabIndex++;
                    if (profilePicsGrabIndex < profilePicsToBeGrabbed.Count)
                        service.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID, profilePicsToBeGrabbed [profilePicsGrabIndex], new Guid(AndroidData.ServiceAuthToken));
                    else
                        service.UserGetImageDataCompleted -= Service_UserGetImageDataCompleted;
                } else
                {
                    if (e.Result.ImageData.Length == 0)
                    {
                        ImageView pic = (ImageView)listWrapper.FindViewWithTag(new Java.Lang.String("profilepic_" + e.Result.AccountID));
                        RunOnUiThread(() => pic.SetBackgroundResource(Resource.Drawable.defaultuserimage));
                        profilePicsGrabIndex++;
                        if (profilePicsGrabIndex < profilePicsToBeGrabbed.Count)
                            service.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID, profilePicsToBeGrabbed [profilePicsGrabIndex], new Guid(AndroidData.ServiceAuthToken));
                        else
                            service.UserGetImageDataCompleted -= Service_UserGetImageDataCompleted;
                    } else
                    {
                        if (profilePicsGrabIndex < profilePicsToBeGrabbed.Count)
                            service.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID, profilePicsToBeGrabbed [profilePicsGrabIndex], new Guid(AndroidData.ServiceAuthToken));
                        else
                            service.UserGetImageDataCompleted -= Service_UserGetImageDataCompleted;
                    }
                }
            } else
            {
                if (profilePicsGrabIndex < profilePicsToBeGrabbed.Count)
                {
                    service.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID, profilePicsToBeGrabbed [profilePicsGrabIndex], new Guid(AndroidData.ServiceAuthToken));
                } else
                {
                    service.UserGetImageDataCompleted -= Service_UserGetImageDataCompleted;
                }
            }
        }
 private void Service_UserGetImageDataCompleted(object sender, UserGetImageDataCompletedEventArgs e)
 {
     #if DEBUG
     System.Diagnostics.Debug.WriteLine ("UserGetImageDataCompleted!");
     #endif
     LOLConnectClient service = (LOLConnectClient)sender;
     if (e.Result.Errors.Count == 0) {
         using (Bitmap userImage = ImageHelper.CreateUserProfileImageForDisplay(e.Result.ImageData, this.thumbImageWidth, this.thumbImageHeight, this.Resources)) {
             ImageView pic = (ImageView)listWrapper.FindViewWithTag (new Java.Lang.String ("profilepic_" + e.Result.AccountID));
             if (pic != null)
                 RunOnUiThread (() => pic.SetImageBitmap (userImage));
         }//end using userImage
         cpUI++;
         dbm.UpdateUserImage (e.Result.AccountID.ToString (), e.Result.ImageData);
         if (cpUI < getGuid.Count)
             service.UserGetImageDataAsync (AndroidData.CurrentUser.AccountID, getGuid [cpUI], new Guid (AndroidData.ServiceAuthToken));
         else
             service.UserGetImageDataCompleted -= Service_UserGetImageDataCompleted;
     }
 }
Пример #6
0
        private void Service_UserGetImageDataCompleted(object sender, UserGetImageDataCompletedEventArgs e)
        {
            LOLConnectClient service = (LOLConnectClient)sender;

            if (e.Result.Errors.Count == 0 && (e.Result.ImageData.Length > 0 && e.Result.ImageData.Length != 2))
            {
                using (Bitmap userImage = ImageHelper.CreateUserProfileImageForDisplay(e.Result.ImageData, picSize, picSize, this.Resources))
                {
                    ImageView pic = (ImageView)messageBar.FindViewWithTag(new Java.Lang.String("profilepic_" + e.Result.AccountID));
                    if (pic != null)
                    {
                        RunOnUiThread(() => pic.SetImageBitmap(userImage));
                        File.WriteAllBytes(System.IO.Path.Combine(wowZapp.LaffOutOut.Singleton.ImageDirectory, e.Result.AccountID.ToString()), e.Result.ImageData);
                        Contacts.ContactsUtil.contactFilenames.Add(e.Result.AccountID.ToString());
                    } else
                        RunOnUiThread(() => pic.SetImageResource(Resource.Drawable.defaultuserimage));
                }

                service.UserGetImageDataCompleted -= Service_UserGetImageDataCompleted;
                dbm.UpdateUserImage(e.Result.AccountID.ToString(), e.Result.ImageData);
            }
        }
        private void Service_UserGetImageDataCompleted(object sender, UserGetImageDataCompletedEventArgs e)
        {
            LOLConnectClient service = (LOLConnectClient)sender;

            if (e.Result.Errors.Count == 0 && e.Result.ImageData.Length > 0)
            {
                RunOnUiThread(delegate
                {
                    using (Bitmap myBitmap = ImageHelper.CreateUserProfileImageForDisplay(e.Result.ImageData, (int)newSizes[0], (int)newSizes[1], this.Resources))
                    {
                        ImageView pic = (ImageView)listWrapper.FindViewWithTag(new Java.Lang.String("profilepic_" + e.Result.AccountID.ToString()));
                        if (myBitmap != null)
                            pic.SetImageBitmap(myBitmap);
                        else
                            pic.SetImageResource(Resource.Drawable.defaultuserimage);
                    }
                });

                db.UpdateUserImage(e.Result.AccountID.ToString(), e.Result.ImageData);
                profilePicsGrabIndex++;
                if (profilePicsGrabIndex < profilePicsToBeGrabbed.Count)
                {
                    service.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID, profilePicsToBeGrabbed [profilePicsGrabIndex], new Guid(AndroidData.ServiceAuthToken));
                } else
                {
                    service.UserGetImageDataCompleted -= Service_UserGetImageDataCompleted;
                }
            } else
            if (e.Result.Errors.Count == 0 && e.Result.ImageData.Length == 0)
            {
                ImageView pic = (ImageView)listWrapper.FindViewWithTag(new Java.Lang.String("profilepic_" + e.Result.AccountID.ToString()));
                pic.SetBackgroundResource(Resource.Drawable.defaultuserimage);
            }
        }